-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from dotnet/perfImprovements
Invoke `GetBuildVersion` MSBuild task only once per project (or per repo)
- Loading branch information
Showing
8 changed files
with
208 additions
and
54 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
8 changes: 8 additions & 0 deletions
8
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_NBGV_PlatformSuffix Condition=" '$(_NBGV_PlatformSuffix)' == '' and '$(MSBuildRuntimeType)' == 'Core' ">MSBuildCore/</_NBGV_PlatformSuffix> | ||
<_NBGV_PlatformSuffix Condition=" '$(_NBGV_PlatformSuffix)' == '' ">MSBuildFull/</_NBGV_PlatformSuffix> | ||
<NerdbankGitVersioningTasksPath Condition=" '$(NerdbankGitVersioningTasksPath)' == '' ">$(MSBuildThisFileDirectory)$(_NBGV_PlatformSuffix)</NerdbankGitVersioningTasksPath> | ||
</PropertyGroup> | ||
</Project> |
45 changes: 45 additions & 0 deletions
45
src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.Inner.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,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Import Project="Nerdbank.GitVersioning.Common.targets"/> | ||
|
||
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.GetBuildVersion"/> | ||
|
||
<Target Name="GetBuildVersion_Properties" | ||
DependsOnTargets="GetBuildVersionCore" | ||
Returns="@(NBGV_PropertyItems)" /> | ||
|
||
<Target Name="GetBuildVersion_CloudBuildVersionVars" | ||
DependsOnTargets="GetBuildVersionCore" | ||
Returns="@(CloudBuildVersionVars)" /> | ||
|
||
<Target Name="GetBuildVersionCore"> | ||
<Nerdbank.GitVersioning.Tasks.GetBuildVersion | ||
BuildingRef="$(_NBGV_BuildingRef)" | ||
BuildMetadata="$(BuildMetadata.Replace(',',';'))" | ||
DefaultPublicRelease="$(PublicRelease)" | ||
ProjectDirectory="$(ProjectDirectory)" | ||
GitRepoRoot="$(GitRepoRoot)" | ||
ProjectPathRelativeToGitRepoRoot="$(ProjectPathRelativeToGitRepoRoot)" | ||
OverrideBuildNumberOffset="$(OverrideBuildNumberOffset)" | ||
TargetsPath="$(MSBuildThisFileDirectory)"> | ||
|
||
<!-- All properties and items are to be exported to the calling project through items. --> | ||
<Output TaskParameter="OutputProperties" ItemName="NBGV_PropertyItems"/> | ||
<Output TaskParameter="CloudBuildVersionVars" ItemName="CloudBuildVersionVars" /> | ||
|
||
<!-- Export a couple of properties directly to support our tasks below. --> | ||
<Output TaskParameter="AssemblyInformationalVersion" PropertyName="AssemblyInformationalVersion" /> | ||
<Output TaskParameter="NuGetPackageVersion" PropertyName="NuGetPackageVersion" /> | ||
<Output TaskParameter="Version" PropertyName="BuildVersion" /> | ||
<Output TaskParameter="GitCommitId" PropertyName="GitCommitId" /> | ||
</Nerdbank.GitVersioning.Tasks.GetBuildVersion> | ||
|
||
<Warning Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Unable to determine the git HEAD commit ID to use for informational version number." /> | ||
<Message Condition=" '$(AssemblyInformationalVersion)' != '' " Text="Building version $(BuildVersion) from commit $(GitCommitId)"/> | ||
<Message Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Building version $(BuildVersion)"/> | ||
<Message Importance="low" Text="AssemblyInformationalVersion: $(AssemblyInformationalVersion)" /> | ||
<Message Importance="low" Text="NuGetPackageVersion: $(NuGetPackageVersion)" /> | ||
</Target> | ||
|
||
</Project> |
Oops, something went wrong.