[xharness] Don't depend on the Harness.Mac value except to determine what to configure.

Currently we execute most of the same logic both during the configure phase
and when running tests, and the Harness.Mac value is only set in the configure
phase.

While it doesn't matter right now, this makes sure there aren't any future
surprises in this area, since otherwise we could end up with different
behavior between the configure phase and when running tests.
This commit is contained in:
Rolf Bjarne Kvinge 2019-06-20 08:27:45 +02:00
Родитель 4893a4a1f5
Коммит 4c990affe7
3 изменённых файлов: 44 добавлений и 19 удалений

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

@ -186,5 +186,13 @@ namespace xharness
return null;
}
}
protected override void PostProcessExecutableProject ()
{
base.PostProcessExecutableProject ();
ProjectGuid = "{" + Harness.NewStableGuid ().ToString ().ToUpper () + "}";
inputProject.SetProjectGuid (ProjectGuid);
}
}
}

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

@ -120,27 +120,18 @@ namespace xharness
protected void CreateExecutableProject ()
{
ProcessProject ();
if (Harness.Mac) {
ProjectGuid = "{" + Harness.NewStableGuid ().ToString ().ToUpper () + "}";
inputProject.SetProjectGuid (ProjectGuid);
} else {
inputProject.FixArchitectures (SimulatorArchitectures, DeviceArchitectures);
inputProject.FixInfoPListInclude (Suffix);
inputProject.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml");
}
PostProcessExecutableProject ();
Harness.Save (inputProject, ProjectPath);
if (!Harness.Mac) {
ProjectGuid = inputProject.GetProjectGuid ();
UpdateInfoPList ();
}
XmlDocument info_plist = new XmlDocument ();
var target_info_plist = Path.Combine (TargetDirectory, "Info" + Suffix + ".plist");
info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, "Info.plist"));
BundleIdentifier = info_plist.GetCFBundleIdentifier ();
info_plist.SetMinimumOSVersion (GetMinimumOSVersion (info_plist.GetMinimumOSVersion ()));
info_plist.SetUIDeviceFamily (UIDeviceFamily);
Harness.Save (info_plist, target_info_plist);
}
protected virtual void PostProcessExecutableProject ()
{
}
protected virtual void UpdateInfoPList ()
{
}
protected void CreateLibraryProject ()

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

@ -1,4 +1,7 @@
using System;
using System.IO;
using System.Xml;
using Xamarin;
namespace xharness
{
@ -8,5 +11,28 @@ namespace xharness
public iOSTestProject TestProject;
public MonoNativeInfo MonoNativeInfo => TestProject.MonoNativeInfo;
protected override void PostProcessExecutableProject ()
{
base.PostProcessExecutableProject ();
inputProject.FixArchitectures (SimulatorArchitectures, DeviceArchitectures);
inputProject.FixInfoPListInclude (Suffix);
inputProject.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml");
ProjectGuid = inputProject.GetProjectGuid ();
}
protected override void UpdateInfoPList ()
{
XmlDocument info_plist = new XmlDocument ();
var target_info_plist = Path.Combine (TargetDirectory, "Info" + Suffix + ".plist");
info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, "Info.plist"));
BundleIdentifier = info_plist.GetCFBundleIdentifier ();
info_plist.SetMinimumOSVersion (GetMinimumOSVersion (info_plist.GetMinimumOSVersion ()));
info_plist.SetUIDeviceFamily (UIDeviceFamily);
Harness.Save (info_plist, target_info_plist);
}
}
}