[xharness] Add support for generating/duplicating projects with a Touch.Client reference.

This also means removing support for generating/duplicating MonoTouch.NUnit references,
since we're not using those anymore.
This commit is contained in:
Rolf Bjarne Kvinge 2020-07-14 16:29:41 +02:00
Родитель a528c4e869
Коммит 349a6b6d5a
5 изменённых файлов: 26 добавлений и 21 удалений

Просмотреть файл

@ -269,6 +269,13 @@ namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities {
reference.ParentNode.RemoveChild (reference);
}
public static void RemovePackageReference (this XmlDocument csproj, string projectName)
{
var reference = csproj.SelectSingleNode ("/*/*/*[local-name() = 'PackageReference' and @Include = '" + projectName + "']");
if (reference != null)
reference.ParentNode.RemoveChild (reference);
}
public static void AddCompileInclude (this XmlDocument csproj, string link, string include, bool prepend = false)
{
AddInclude (csproj, "Compile", link, include, prepend);

Просмотреть файл

@ -116,18 +116,21 @@ namespace Xharness.Targets
{
var fn = Path.GetFileName (include);
fixed_include = include;
switch (fn) {
case "GuiUnit_NET_4_5.csproj":
if (Flavor == MacFlavors.Full || Flavor == MacFlavors.System)
return false;
fixed_include = include.Replace (fn, "GuiUnit_xammac_mobile.csproj");
return true;
case "GuiUnit_xammac_mobile.csproj":
if (Flavor == MacFlavors.Modern)
return false;
fixed_include = include.Replace (fn, "GuiUnit_NET_4_5.csproj");
return true;
case "Touch.Client-macOS-mobile.csproj":
switch (Flavor) {
case MacFlavors.Full:
case MacFlavors.System:
var dir = Path.GetDirectoryName (include);
var parentDir = Path.GetDirectoryName (dir);
dir = Path.Combine (parentDir, "full");
fixed_include = Path.Combine (dir, fn.Replace ("-mobile", "-full"));
return true;
case MacFlavors.Modern:
default:
break;
}
break;
}
return base.FixProjectReference (include, subdir, suffix, out fixed_include);

Просмотреть файл

@ -106,16 +106,6 @@ namespace Xharness.Targets {
var srcDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "..", "src");
string project_guid;
var mt_nunitlite_project_path = Path.GetFullPath (Path.Combine (srcDirectory, "MonoTouch.NUnitLite.tvos.csproj"));
if (!project_guids.TryGetValue (mt_nunitlite_project_path, out project_guid)) {
XmlDocument mt_nunitlite_project = new XmlDocument ();
mt_nunitlite_project.LoadWithoutNetworkAccess (mt_nunitlite_project_path);
project_guid = mt_nunitlite_project.GetProjectGuid ();
project_guids [mt_nunitlite_project_path] = project_guid;
}
inputProject.CreateProjectReferenceValue ("MonoTouch.NUnitLite", mt_nunitlite_project_path, project_guid, "MonoTouch.NUnitLite");
inputProject.AddExtraMtouchArgs ("--bitcode:asmonly", "iPhone", "Release");
inputProject.SetMtouchUseLlvm (true, "iPhone", "Release");
inputProject.ResolveAllPaths (TemplateProjectPath);

Просмотреть файл

@ -104,6 +104,9 @@ namespace Xharness.Targets
case "Touch.Client-iOS.dotnet.csproj":
case "Touch.Client-iOS.csproj":
var dir = Path.GetDirectoryName (include);
var parentDir = Path.GetFileName (dir);
if (parentDir == "iOS")
dir = Path.Combine (Path.GetDirectoryName (dir), PlatformString);
fixed_include = Path.Combine (dir, fn.Replace ("-iOS", "-" + PlatformString));
break;
default:

Просмотреть файл

@ -120,6 +120,7 @@ namespace Xharness.Targets {
csproj.AddAdditionalDefines ("BITCODE", "iPhone", "Release");
csproj.AddAdditionalDefines ("XAMCORE_3_0;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;");
csproj.RemoveReferences ("OpenTK-1.0");
csproj.RemovePackageReference ("MonoTouch.Dialog");
var ext = IsFSharp ? "fs" : "cs";
csproj.AddCompileInclude ("InterfaceController." + ext, Path.Combine (Harness.WatchOSExtensionTemplate, "InterfaceController." + ext));
csproj.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml");
@ -195,6 +196,7 @@ namespace Xharness.Targets {
csproj.SetImport (IsBindingProject ? BindingsImports : Imports);
csproj.AddAdditionalDefines ("XAMCORE_3_0;MONOTOUCH_WATCH;");
csproj.FixProjectReferences (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), Suffix, FixProjectReference);
csproj.RemovePackageReference ("MonoTouch.Dialog");
csproj.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml");
csproj.FixTestLibrariesReferences (Platform);
csproj.ResolveAllPaths (TemplateProjectPath);