forked from dotnet/Nerdbank.GitVersioning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add property that can disable the private MSBuild task invocation
This allows Nerdbank.GitVersioning to (once again) work under quickbuild.
- Loading branch information
Showing
11 changed files
with
147 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Nerdbank.GitVersioning.Tasks/build/InProjectVersionComputation.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="Nerdbank.GitVersioning.Inner.targets"/> | ||
|
||
<Target Name="SetPropertiesForInvokeGetBuildVersionTask"> | ||
<!-- Set properties required for InvokeGetBuildVersionTask here, because | ||
CallTarget invoked targets do not see properties set by the calling target. --> | ||
<PropertyGroup> | ||
<BuildMetadata>@(BuildMetadata, ',')</BuildMetadata> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<Target Name="InvokeGetBuildVersionTask" DependsOnTargets="SetPropertiesForInvokeGetBuildVersionTask"> | ||
<CallTarget Targets="GetBuildVersion_Properties"> | ||
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" /> | ||
</CallTarget> | ||
<CallTarget Targets="GetBuildVersion_CloudBuildVersionVars"> | ||
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" /> | ||
</CallTarget> | ||
</Target> | ||
</Project> |
60 changes: 60 additions & 0 deletions
60
src/Nerdbank.GitVersioning.Tasks/build/MSBuildTargetCaching.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<NBGV_InnerGlobalProperties Condition=" '$(GitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)GitRepoRoot=$(GitRepoRoot);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(PublicRelease)' != '' ">$(NBGV_InnerGlobalProperties)PublicRelease=$(PublicRelease);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(_NBGV_BuildingRef)' != '' ">$(NBGV_InnerGlobalProperties)_NBGV_BuildingRef=$(_NBGV_BuildingRef);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(ProjectPathRelativeToGitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)ProjectPathRelativeToGitRepoRoot=$(ProjectPathRelativeToGitRepoRoot);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(GitVersionBaseDirectory)' != '' ">$(NBGV_InnerGlobalProperties)GitVersionBaseDirectory=$(GitVersionBaseDirectory);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(OverrideBuildNumberOffset)' != '' ">$(NBGV_InnerGlobalProperties)OverrideBuildNumberOffset=$(OverrideBuildNumberOffset);</NBGV_InnerGlobalProperties> | ||
<NBGV_InnerGlobalProperties Condition=" '$(NBGV_CacheMode)' != '' ">$(NBGV_InnerGlobalProperties)NBGV_CacheMode=$(NBGV_CacheMode);</NBGV_InnerGlobalProperties> | ||
</PropertyGroup> | ||
|
||
<!-- Compile a list of global properties that may vary when a project builds but that would never influence the result of the GetBuildVersion task. --> | ||
<ItemGroup> | ||
<NBGV_GlobalPropertiesToRemove Include="TargetFramework" /> | ||
<NBGV_GlobalPropertiesToRemove Include="RuntimeIdentifier" /> | ||
<NBGV_GlobalPropertiesToRemove Include="Configuration" /> | ||
<NBGV_GlobalPropertiesToRemove Include="Platform" /> | ||
|
||
<_BuildMetadataSnapped Include="@(BuildMetadata)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project. --> | ||
<ProjectReference Include="$(MSBuildThisFileDirectory)Nerdbank.GitVersioning.Inner.targets"> | ||
<Targets>GetBuildVersion_Properties;GetBuildVersion_CloudBuildVersionVars</Targets> | ||
<Properties>$(NBGV_InnerGlobalProperties)BuildMetadata=@(BuildMetadata, ',');</Properties> | ||
<GlobalPropertiesToRemove>@(NBGV_GlobalPropertiesToRemove)</GlobalPropertiesToRemove> | ||
|
||
<!-- Do our very best to prevent Microsoft.Common.CurrentVersion.targets or IDEs from processing this P2P. It's only here for MSBuild's static graph. --> | ||
<BuildReference>false</BuildReference> | ||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> | ||
<Visible>false</Visible> | ||
<NBGV_InnerProject>true</NBGV_InnerProject> | ||
</ProjectReference> | ||
</ItemGroup> | ||
|
||
<Target Name="InvokeGetBuildVersionTask"> | ||
<Error Text="BuildMetadata items changed after a copy was made. Add all BuildMetadata items before importing this file." Condition=" '@(BuildMetadata)' != '@(_BuildMetadataSnapped)' " /> | ||
|
||
<!-- Calculate version by invoking another "project" with global properties that will serve as a key | ||
into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. --> | ||
<MSBuild Projects="@(ProjectReference)" | ||
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' " | ||
Properties="%(ProjectReference.Properties)" | ||
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)" | ||
Targets="GetBuildVersion_Properties"> | ||
<Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" /> | ||
</MSBuild> | ||
|
||
<!-- Also get other items. --> | ||
<MSBuild Projects="@(ProjectReference)" | ||
Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' " | ||
Properties="%(ProjectReference.Properties)" | ||
RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)" | ||
Targets="GetBuildVersion_CloudBuildVersionVars"> | ||
<Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" /> | ||
</MSBuild> | ||
</Target> | ||
</Project> |
1 change: 1 addition & 0 deletions
1
src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.Common.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.Inner.Empty.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- These targets are called by MSBuild static graph because we declare a ProjectReference item to this file. --> | ||
<Target Name="GetTargetFrameworks" /> | ||
<Target Name="GetNativeManifest" /> | ||
<Target Name="GetCopyToOutputDirectoryItems" /> | ||
<Target Name="GetTargetFrameworksWithPlatformForSingleTargetFramework" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<!-- Cache modes include: | ||
MSBuildTargetCaching | ||
This is the default. | ||
Versions will be computed by an MSBuild target which can be shared across an entire build session via MSBuild target output caching. | ||
None | ||
Every project will compute its own version. | ||
Note that the choice in caching should have no bearing on the result of the versions computed - only on build perf and which systems it can work with. | ||
--> | ||
<NBGV_CacheMode Condition=" '$(NBGV_CacheMode)' == '' and '$(QBuild)' == '1' ">None</NBGV_CacheMode> | ||
<NBGV_CacheMode Condition=" '$(NBGV_CacheMode)' == '' ">MSBuildTargetCaching</NBGV_CacheMode> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/Nerdbank.GitVersioning.Tasks/buildCrossTargeting/Nerdbank.GitVersioning.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\build\$(MSBuildThisFileName)$(MSBuildThisFileExtension)" /> | ||
</Project> |