Skip to content

Commit

Permalink
Add more common GetTargetPath to multi-targeting
Browse files Browse the repository at this point in the history
We already add `GetTargetPathWithTargetPlatformMoniker` for multi-targeting, but `GetTargetPath` is probably more common, so we add it with the same pattern used in the built-in targets.
  • Loading branch information
kzu committed Dec 4, 2020
1 parent dae123f commit 0365f56
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/NuGetizer.Tasks/NuGetizer.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ Copyright (c) .NET Foundation. All rights reserved.
<Target Name="GetNativeManifest" />
<Target Name="GetCopyToOutputDirectoryItems" />


<!--
============================================================
GetTargetPath
When cross-targeting and the authoring project references a
nugetized library, return all the determined target paths.
============================================================
-->
<Target Name="GetTargetPath" Returns="@(TargetPathWithTargetPlatformMoniker)" />

<!--
============================================================
GetTargetPathWithTargetPlatformMoniker
Expand All @@ -27,6 +38,7 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Target Name="GetTargetPathWithTargetPlatformMoniker"
DependsOnTargets="_ComputeTargetFrameworkItems"
BeforeTargets="GetTargetPath"
Returns="@(TargetPathWithTargetPlatformMoniker)">

<MSBuild Projects="@(_InnerBuildProjects)"
Expand Down
10 changes: 10 additions & 0 deletions src/NuGetizer.Tests/given_a_multitargeting_library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,15 @@ public void when_customizing_item_then_adds_package_metadata()
}));
}

[Fact]
public void when_getting_target_path_then_includes_all_frameworks()
{
var result = Builder.BuildScenario(
nameof(given_a_multitargeting_library), target: "GetTargetPath", output: output);

result.AssertSuccess(output);

Assert.Equal(2, result.Items.Length);
}
}
}

0 comments on commit 0365f56

Please sign in to comment.