Skip to content

Commit ebb8424

Browse files
authored
Add support for Pack target in Microsoft.Build.Traversal (#53)
Closes #52
1 parent 868f4a3 commit ebb8424

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/Traversal.UnitTests/TraversalTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void SkipsNonExistentTargets()
7575
[InlineData("Clean")]
7676
[InlineData("Build")]
7777
[InlineData("Test")]
78+
[InlineData("Pack")]
7879
public void TraversalTargetsRun(string target)
7980
{
8081
string[] projects = new[]

src/Traversal/Sdk/Sdk.targets

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
CleanPublishFolder;
5656
AfterClean
5757
</CleanDependsOn>
58+
59+
<PackDependsOn>
60+
ResolveReferences;
61+
</PackDependsOn>
5862
</PropertyGroup>
5963

6064
<ItemGroup Condition=" '$(TraversalTranslateProjectFileItems)' != 'false' ">
@@ -204,6 +208,49 @@
204208
SkipNonexistentProjects="$(SkipNonexistentProjects)"
205209
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
206210
</Target>
211+
212+
<Target Name="Pack"
213+
DependsOnTargets="$(PackDependsOn)">
214+
215+
<MSBuild Projects="@(PreTraversalProject)"
216+
Targets="Pack"
217+
Properties="$(PreTraversalGlobalProperties)"
218+
Condition=" '@(PreTraversalProject)' != '' "
219+
BuildInParallel="$(BuildInParallel)"
220+
SkipNonexistentProjects="$(SkipNonexistentProjects)"
221+
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
222+
223+
<MSBuild Projects="@(PreTraversalPackProject)"
224+
Targets="Pack"
225+
Properties="$(PreTraversalPackGlobalProperties)"
226+
Condition=" '@(PreTraversalPackProject)' != '' "
227+
BuildInParallel="$(BuildInParallel)"
228+
SkipNonexistentProjects="$(SkipNonexistentProjects)"
229+
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
230+
231+
<MSBuild Projects="@(_MSBuildProjectReferenceExistent)"
232+
Targets="Pack"
233+
Properties="$(TraversalGlobalProperties);$(TraversalPackGlobalProperties)"
234+
BuildInParallel="$(BuildInParallel)"
235+
SkipNonexistentProjects="$(SkipNonexistentProjects)"
236+
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
237+
238+
<MSBuild Projects="@(PostTraversalPackProject)"
239+
Targets="Pack"
240+
Properties="$(PostTraversalPackGlobalProperties)"
241+
Condition=" '@(PostTraversalPackProject)' != '' "
242+
BuildInParallel="$(BuildInParallel)"
243+
SkipNonexistentProjects="$(SkipNonexistentProjects)"
244+
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
245+
246+
<MSBuild Projects="@(PostTraversalProject)"
247+
Targets="Pack"
248+
Properties="$(PostTraversalGlobalProperties)"
249+
Condition=" '@(PostTraversalProject)' != '' "
250+
BuildInParallel="$(BuildInParallel)"
251+
SkipNonexistentProjects="$(SkipNonexistentProjects)"
252+
SkipNonexistentTargets="$(SkipNonexistentTargets)" />
253+
</Target>
207254

208255
<!--
209256
Traversal projects do not build anything and should not check for invalid configuration/platform.

0 commit comments

Comments
 (0)