|
25 | 25 | <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> |
26 | 26 | </PropertyGroup> |
27 | 27 |
|
28 | | - <Import Project="Nerdbank.GitVersioning.Common.targets"/> |
| 28 | + <Import Project="Nerdbank.GitVersioning.Common.targets" /> |
29 | 29 |
|
30 | 30 | <UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.AssemblyVersionInfo"/> |
31 | 31 | <UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.NativeVersionInfo"/> |
|
37 | 37 | <PropertyGroup> |
38 | 38 | <!-- $(TargetExt) isn't set at evaluation time for us when built in wpftmp.csproj with manual imports --> |
39 | 39 | <!-- Suppress assembly version info generation if not obviously compiling an assembly. --> |
40 | | - <GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe'">false</GenerateAssemblyVersionInfo> |
| 40 | + <GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe' ">false</GenerateAssemblyVersionInfo> |
41 | 41 |
|
42 | 42 | <!-- Workaround the property stomping that msbuild does (see https://github.com/microsoft/msbuild/pull/4922) with manual imports. --> |
43 | 43 | <PrepareForBuildDependsOn> |
|
64 | 64 | <_NBGV_BuildingRef Condition=" '$(_NBGV_BuildingRef)' == '' ">$(_NBGV_BuildingBranch)</_NBGV_BuildingRef> |
65 | 65 |
|
66 | 66 | <GitVersionBaseDirectory Condition=" '$(GitVersionBaseDirectory)' == '' ">$(MSBuildProjectDirectory)</GitVersionBaseDirectory> |
67 | | - <NBGV_InnerGlobalProperties Condition=" '$(GitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)GitRepoRoot=$(GitRepoRoot);</NBGV_InnerGlobalProperties> |
68 | | - <NBGV_InnerGlobalProperties Condition=" '$(PublicRelease)' != '' ">$(NBGV_InnerGlobalProperties)PublicRelease=$(PublicRelease);</NBGV_InnerGlobalProperties> |
69 | | - <NBGV_InnerGlobalProperties Condition=" '$(_NBGV_BuildingRef)' != '' ">$(NBGV_InnerGlobalProperties)_NBGV_BuildingRef=$(_NBGV_BuildingRef);</NBGV_InnerGlobalProperties> |
70 | | - <NBGV_InnerGlobalProperties Condition=" '$(ProjectPathRelativeToGitRepoRoot)' != '' ">$(NBGV_InnerGlobalProperties)ProjectPathRelativeToGitRepoRoot=$(ProjectPathRelativeToGitRepoRoot);</NBGV_InnerGlobalProperties> |
71 | | - <NBGV_InnerGlobalProperties Condition=" '$(GitVersionBaseDirectory)' != '' ">$(NBGV_InnerGlobalProperties)ProjectDirectory=$(GitVersionBaseDirectory);</NBGV_InnerGlobalProperties> |
72 | | - <NBGV_InnerGlobalProperties Condition=" '$(OverrideBuildNumberOffset)' != '' ">$(NBGV_InnerGlobalProperties)OverrideBuildNumberOffset=$(OverrideBuildNumberOffset);</NBGV_InnerGlobalProperties> |
73 | | - <NBGV_CoreTargets>$(MSBuildThisFileDirectory)Nerdbank.GitVersioning.Inner.targets</NBGV_CoreTargets> |
74 | 67 | </PropertyGroup> |
75 | 68 |
|
76 | | - <!-- Compile a list of global properties that may vary when a project builds but that would never influence the result of the GetBuildVersion task. --> |
77 | | - <ItemGroup> |
78 | | - <NBGV_GlobalPropertiesToRemove Include="TargetFramework" /> |
79 | | - <NBGV_GlobalPropertiesToRemove Include="RuntimeIdentifier" /> |
80 | | - <NBGV_GlobalPropertiesToRemove Include="Configuration" /> |
81 | | - <NBGV_GlobalPropertiesToRemove Include="Platform" /> |
82 | | - |
83 | | - <_BuildMetadataSnapped Include="@(BuildMetadata)" /> |
84 | | - </ItemGroup> |
85 | | - |
86 | | - <ItemGroup> |
87 | | - <!-- Declare a P2P so that "msbuild -graph -isolate" doesn't complain when we use the MSBuild task to invoke our inner shared project. --> |
88 | | - <ProjectReference Include="$(NBGV_CoreTargets)"> |
89 | | - <Targets>GetBuildVersion_Properties;GetBuildVersion_CloudBuildVersionVars</Targets> |
90 | | - <Properties>$(NBGV_InnerGlobalProperties)BuildMetadata=@(BuildMetadata, ',');</Properties> |
91 | | - <GlobalPropertiesToRemove>@(NBGV_GlobalPropertiesToRemove)</GlobalPropertiesToRemove> |
92 | | - |
93 | | - <!-- 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. --> |
94 | | - <BuildReference>false</BuildReference> |
95 | | - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
96 | | - <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> |
97 | | - <Visible>false</Visible> |
98 | | - <NBGV_InnerProject>true</NBGV_InnerProject> |
99 | | - </ProjectReference> |
100 | | - </ItemGroup> |
101 | | - |
102 | | - <Target Name="GetBuildVersion" Returns="$(BuildVersion)"> |
103 | | - <Error Text="BuildMetadata items changed after a copy was made. Add all BuildMetadata items before importing this file." Condition=" '@(BuildMetadata)' != '@(_BuildMetadataSnapped)' " /> |
104 | | - |
105 | | - <!-- Calculate version by invoking another "project" with global properties that will serve as a key |
106 | | - into an msbuild cache to ensure we only invoke the GetBuildVersion task as many times as will produce a unique value. --> |
107 | | - <MSBuild Projects="@(ProjectReference)" |
108 | | - Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' " |
109 | | - Properties="%(ProjectReference.Properties)" |
110 | | - RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)" |
111 | | - Targets="GetBuildVersion_Properties"> |
112 | | - <Output TaskParameter="TargetOutputs" ItemName="NBGV_PropertyItems" /> |
113 | | - </MSBuild> |
114 | | - |
| 69 | + <Target Name="GetBuildVersion" Returns="$(BuildVersion)" DependsOnTargets="InvokeGetBuildVersionTask"> |
115 | 70 | <!-- Convert each task item into a bona fide MSBuild property. --> |
116 | 71 | <CreateProperty |
117 | 72 | Value="%(NBGV_PropertyItems.Value)" |
|
123 | 78 | <PropertyGroup> |
124 | 79 | <CloudBuildNumber Condition=" '$(CloudBuildNumber)' == '' and %(NBGV_PropertyItems.Identity) == 'CloudBuildNumber' ">%(Value)</CloudBuildNumber> |
125 | 80 | </PropertyGroup> |
126 | | - |
127 | | - <!-- Also get other items. --> |
128 | | - <MSBuild Projects="@(ProjectReference)" |
129 | | - Condition=" '%(ProjectReference.NBGV_InnerProject)' == 'true' " |
130 | | - Properties="%(ProjectReference.Properties)" |
131 | | - RemoveProperties="%(ProjectReference.GlobalPropertiesToRemove)" |
132 | | - Targets="GetBuildVersion_CloudBuildVersionVars"> |
133 | | - <Output TaskParameter="TargetOutputs" ItemName="CloudBuildVersionVars" /> |
134 | | - </MSBuild> |
135 | 81 | </Target> |
136 | 82 |
|
| 83 | + <Import Project="InProjectVersionComputation.targets" Condition=" '$(NBGV_CacheMode)' != 'MSBuildTargetCaching' "/> |
| 84 | + <Import Project="MSBuildTargetCaching.targets" Condition=" '$(NBGV_CacheMode)' == 'MSBuildTargetCaching' "/> |
| 85 | + |
137 | 86 | <Target Name="SetCloudBuildVersionVars" |
138 | 87 | DependsOnTargets="GetBuildVersion" |
139 | 88 | AfterTargets="GetBuildVersion" |
|
0 commit comments