Skip to content

Commit

Permalink
Make it easier to hook into the outer/inner Build/Clean/Publish process.
Browse files Browse the repository at this point in the history
Closes #69.
  • Loading branch information
alexrp committed Jan 5, 2024
1 parent 619b3bc commit fb09251
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/sdk/build/Vezel.Zig.Sdk.Build.targets
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<Project>
<PropertyGroup>
<_InnerOrOuterBuild>_InnerBuild</_InnerOrOuterBuild>
<_InnerOrOuterBuild Condition="'$(IsOuterBuild)' == 'true'">_OuterBuild</_InnerOrOuterBuild>
<_InnerOrOuterBuild>InnerBuild</_InnerOrOuterBuild>
<_InnerOrOuterBuild Condition="'$(IsOuterBuild)' == 'true'">OuterBuild</_InnerOrOuterBuild>
</PropertyGroup>

<Target Name="Build"
DependsOnTargets="$(_InnerOrOuterBuild)"
Condition="'$(_InvalidConfigurationWarning)' != 'true'" />

<Target Name="_OuterBuild">
<Target Name="OuterBuild"
DependsOnTargets="$(OuterBuildDependsOn)">
<ItemGroup>
<_RuntimeIdentifiers Include="$(RuntimeIdentifiers)" />
<_InnerProjects Include="$(MSBuildProjectFullPath)"
Properties="RuntimeIdentifier=%(_RuntimeIdentifiers.Identity)" />
</ItemGroup>

<MSBuild Projects="@(_InnerProjects)"
Targets="_InnerBuild"
Targets="InnerBuild"
BuildInParallel="$(BuildInParallel)" />
</Target>

<Target Name="_InnerBuild"
<Target Name="InnerBuild"
DependsOnTargets="$(BuildDependsOn)"
Returns="@(TargetPathWithTargetPlatformMoniker)" />

Expand Down
11 changes: 6 additions & 5 deletions src/sdk/build/Vezel.Zig.Sdk.Clean.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
</ItemGroup>

<PropertyGroup>
<_InnerOrOuterClean>_InnerClean</_InnerOrOuterClean>
<_InnerOrOuterClean Condition="'$(IsOuterBuild)' == 'true'">_OuterClean</_InnerOrOuterClean>
<_InnerOrOuterClean>InnerClean</_InnerOrOuterClean>
<_InnerOrOuterClean Condition="'$(IsOuterBuild)' == 'true'">OuterClean</_InnerOrOuterClean>
</PropertyGroup>

<Target Name="Clean"
DependsOnTargets="$(_InnerOrOuterClean)"
Condition="'$(_InvalidConfigurationWarning)' != 'true'" />

<Target Name="_OuterClean">
<Target Name="OuterClean"
DependsOnTargets="$(OuterCleanDependsOn)">
<ItemGroup>
<_RuntimeIdentifiers Include="$(RuntimeIdentifiers)" />
<_InnerProjects Include="$(MSBuildProjectFullPath)"
Properties="RuntimeIdentifier=%(_RuntimeIdentifiers.Identity)" />
</ItemGroup>

<MSBuild Projects="@(_InnerProjects)"
Targets="_InnerClean"
Targets="InnerClean"
BuildInParallel="$(BuildInParallel)" />
</Target>

<Target Name="_InnerClean"
<Target Name="InnerClean"
DependsOnTargets="$(CleanDependsOn)" />
</Project>
11 changes: 6 additions & 5 deletions src/sdk/build/Vezel.Zig.Sdk.Publish.targets
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Project>
<PropertyGroup>
<_InnerOrOuterPublish>_InnerPublish</_InnerOrOuterPublish>
<_InnerOrOuterPublish Condition="'$(IsOuterBuild)' == 'true'">_OuterPublish</_InnerOrOuterPublish>
<_InnerOrOuterPublish>InnerPublish</_InnerOrOuterPublish>
<_InnerOrOuterPublish Condition="'$(IsOuterBuild)' == 'true'">OuterPublish</_InnerOrOuterPublish>
</PropertyGroup>

<Target Name="Publish"
DependsOnTargets="$(_InnerOrOuterPublish)"
Condition="'$(_InvalidConfigurationWarning)' != 'true'" />

<Target Name="_OuterPublish">
<Target Name="OuterPublish"
DependsOnTargets="$(OuterPublishDependsOn)">
<ItemGroup>
<_RuntimeIdentifiers Include="$(RuntimeIdentifiers)" />
<_InnerProjects Include="$(MSBuildProjectFullPath)"
Properties="RuntimeIdentifier=%(_RuntimeIdentifiers.Identity)" />
</ItemGroup>

<MSBuild Projects="@(_InnerProjects)"
Targets="_InnerPublish"
Targets="InnerPublish"
BuildInParallel="$(BuildInParallel)" />
</Target>

Expand All @@ -25,7 +26,7 @@
well as the build and clean logic in MSBuild, so we have to duplicate some
of the logic in the default Publish target here.
-->
<Target Name="_InnerPublish"
<Target Name="InnerPublish"
DependsOnTargets="_PublishBuildAlternative; _PublishNoBuildAlternative"
Condition="'$(IsPublishable)' == 'true'">
<Message Text="$(MSBuildProjectName) -> $([System.IO.Path]::GetFullPath('$(PublishDir)'))"
Expand Down

0 comments on commit fb09251

Please sign in to comment.