Skip to content

Commit

Permalink
[xharness] Process Import elements, but don't add LogicalName to them.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Jul 27, 2018
1 parent afcad3b commit 50e0554
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/xharness/ProjectFileExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ public static void ResolveAllPaths (this XmlDocument csproj, string project_path
new string [] { "ObjcBindingCoreSource", "Include" },
new string [] { "ObjcBindingNativeLibrary", "Include" },
new string [] { "ObjcBindingNativeFramework", "Include" },
new string [] { "Import", "Project", "CustomBuildActions.targets", "../SyncTestResources.targets" },
new string [] { "FilesToCopy", "Include" },
new string [] { "FilesToCopyFoo", "Include" },
new string [] { "FilesToCopyFooBar", "Include" },
Expand Down Expand Up @@ -843,10 +844,22 @@ public static void ResolveAllPaths (this XmlDocument csproj, string project_path
var a = node.Attributes [attrib];
if (a == null)
continue;

// entries after index 2 is a list of values to filter the attribute value against.
var found = kvp.Length == 2;
var skipLogicalName = kvp.Length > 2;
for (var i = 2; i < kvp.Length; i++) {
if (a.Value.Contains ("Sync"))
Console.WriteLine ("STOP");
found |= a.Value == kvp [i];
}
if (!found)
continue;

// Fix any default LogicalName values (but don't change existing ones).
var ln = node.SelectElementNodes ("LogicalName")?.SingleOrDefault ();
var links = node.SelectElementNodes ("Link");
if (ln == null && !links.Any ()) {
if (!skipLogicalName && ln == null && !links.Any ()) {
ln = csproj.CreateElement ("LogicalName", MSBuild_Namespace);
node.AppendChild (ln);

Expand Down

0 comments on commit 50e0554

Please sign in to comment.