[xharness] Propagate custom defines to referenced projects as well. Fixes maccore #655. (#3615)

The ProtocolTest test is located in the bindings-test assembly, and it
requires certain conditional compilation defines to be set in order to behave
properly.

With this fix we correctly set these defines when cloning the bindings-test
project (in addition to when we set the defines for the main project, which is
either monotouch-test or linkall for this test).

Fixes https://github.com/xamarin/maccore/issues/655.
This commit is contained in:
Rolf Bjarne Kvinge 2018-02-28 21:55:26 +01:00 коммит произвёл GitHub
Родитель 27e757e45e
Коммит 7ddb263e7d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 15 добавлений и 2 удалений

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

@ -245,8 +245,16 @@ namespace xharness
clone.Xml.AddMonoBundlingExtraArgs (bundling_extra_args, task.ProjectPlatform, configuration);
if (!string.IsNullOrEmpty (link_mode))
clone.Xml.SetNode (isMac ? "LinkMode" : "MtouchLink", link_mode, task.ProjectPlatform, configuration);
if (!string.IsNullOrEmpty (defines))
if (!string.IsNullOrEmpty (defines)) {
clone.Xml.AddAdditionalDefines (defines, task.ProjectPlatform, configuration);
if (clone.ProjectReferences != null) {
foreach (var pr in clone.ProjectReferences) {
pr.Xml.AddAdditionalDefines (defines, task.ProjectPlatform, configuration);
pr.Xml.Save (pr.Path);
}
}
}
clone.Xml.SetNode (isMac ? "Profiling" : "MTouchProfiling", profiling ? "True" : "False", task.ProjectPlatform, configuration);
if (!debug && !isMac)

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

@ -661,7 +661,7 @@ namespace xharness
continue;
var defines = csproj.CreateElement ("DefineConstants", MSBuild_Namespace);
defines.InnerText = value;
defines.InnerText = "$(DefineConstants);" + value;
xmlnode.AppendChild (defines);
return;
}

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

@ -19,6 +19,8 @@ namespace xharness
public bool GenerateVariations = true;
public string [] Configurations;
public IEnumerable<TestProject> ProjectReferences;
public TestProject ()
{
}
@ -120,11 +122,14 @@ namespace xharness
}
doc.ResolveAllPaths (original_path);
var projectReferences = new List<TestProject> ();
foreach (var pr in doc.GetProjectReferences ()) {
var tp = new TestProject (pr.Replace ('\\', '/'));
await tp.CreateCopyAsync (test);
doc.SetProjectReferenceInclude (pr, tp.Path.Replace ('/', '\\'));
projectReferences.Add (tp);
}
this.ProjectReferences = projectReferences;
doc.Save (Path);
}