[xharness] Select the right GuiUnit project file depending on the mac flavor.
This commit is contained in:
Родитель
0cd58ff199
Коммит
a63ee4f782
|
@ -119,13 +119,22 @@ namespace xharness
|
|||
|
||||
public MonoNativeInfo MonoNativeInfo { get; set; }
|
||||
|
||||
protected override bool FixProjectReference (string name)
|
||||
protected override bool FixProjectReference (string name, out string fixed_name)
|
||||
{
|
||||
fixed_name = null;
|
||||
switch (name) {
|
||||
case "GuiUnit_NET_4_5":
|
||||
return false;
|
||||
if (Flavor == MacFlavors.Full || Flavor == MacFlavors.System)
|
||||
return false;
|
||||
fixed_name = "GuiUnit_xammac_mobile";
|
||||
return true;
|
||||
case "GuiUnit_xammac_mobile":
|
||||
if (Flavor == MacFlavors.Modern)
|
||||
return false;
|
||||
fixed_name = "GuiUnit_NET_4_5";
|
||||
return true;
|
||||
default:
|
||||
return base.FixProjectReference (name);
|
||||
return base.FixProjectReference (name, out fixed_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -460,20 +460,33 @@ namespace xharness
|
|||
return imports [0].Attributes ["Project"].Value;
|
||||
}
|
||||
|
||||
public static void FixProjectReferences (this XmlDocument csproj, string suffix, Func<string, bool> fixCallback = null)
|
||||
public delegate bool FixReferenceDelegate (string reference, out string fixed_reference);
|
||||
public static void FixProjectReferences (this XmlDocument csproj, string suffix, FixReferenceDelegate fixCallback = null)
|
||||
{
|
||||
var nodes = csproj.SelectNodes ("/*/*/*[local-name() = 'ProjectReference']");
|
||||
if (nodes.Count == 0)
|
||||
return;
|
||||
foreach (XmlNode n in nodes) {
|
||||
var name = n ["Name"].InnerText;
|
||||
if (fixCallback != null && !fixCallback (name))
|
||||
string fixed_name = null;
|
||||
if (fixCallback != null && !fixCallback (name, out fixed_name))
|
||||
continue;
|
||||
var include = n.Attributes ["Include"];
|
||||
include.Value = include.Value.Replace (".csproj", suffix + ".csproj");
|
||||
include.Value = include.Value.Replace (".fsproj", suffix + ".fsproj");
|
||||
string fixed_include;
|
||||
if (fixed_name == null) {
|
||||
fixed_include = include.Value;
|
||||
fixed_include = fixed_include.Replace (".csproj", suffix + ".csproj");
|
||||
fixed_include = fixed_include.Replace (".fsproj", suffix + ".fsproj");
|
||||
} else {
|
||||
var unix_path = include.Value.Replace ('\\', '/');
|
||||
var unix_dir = System.IO.Path.GetDirectoryName (unix_path);
|
||||
fixed_include = System.IO.Path.Combine (unix_dir, fixed_name + System.IO.Path.GetExtension (unix_path));
|
||||
fixed_include = fixed_include.Replace ('/', '\\');
|
||||
}
|
||||
n.Attributes ["Include"].Value = fixed_include;
|
||||
var nameElement = n ["Name"];
|
||||
nameElement.InnerText = System.IO.Path.GetFileNameWithoutExtension (include.Value.Replace ('\\', '/'));
|
||||
name = System.IO.Path.GetFileNameWithoutExtension (fixed_include.Replace ('\\', '/'));
|
||||
nameElement.InnerText = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,9 @@ namespace xharness
|
|||
|
||||
public string LanguageGuid { get { return IsFSharp ? FSharpGuid : CSharpGuid; } }
|
||||
|
||||
protected virtual bool FixProjectReference (string name)
|
||||
protected virtual bool FixProjectReference (string name, out string fixed_name)
|
||||
{
|
||||
fixed_name = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче