|
166 | 166 |
|
167 | 167 | <Target Name="CreateBuildOutputProps"
|
168 | 168 | BeforeTargets="Build">
|
| 169 | + <PropertyGroup> |
| 170 | + <_PackageVersionPropsBackupPath>$(PackageVersionPropsPath).pre.$(RepositoryName).xml</_PackageVersionPropsBackupPath> |
| 171 | + </PropertyGroup> |
| 172 | + |
169 | 173 | <ItemGroup>
|
170 |
| - <_PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg" |
| 174 | + <PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg" |
171 | 175 | Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
|
172 | 176 | </ItemGroup>
|
173 |
| - <WriteBuildOutputProps NuGetPackages="@(_PreviouslySourceBuiltPackages)" |
| 177 | + |
| 178 | + <WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)" |
174 | 179 | ExtraPackageInfo="@(ExtraPackageVersionPropsPackageInfo)"
|
175 | 180 | OutputPath="$(PackageVersionPropsPath)" />
|
176 | 181 |
|
177 |
| - <WriteBuildOutputProps NuGetPackages="@(_PreviouslySourceBuiltPackages)" |
| 182 | + <WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)" |
178 | 183 | IncludeCreationTimeProperty="true"
|
179 |
| - OutputPath="$(PackageVersionPropsPath).pre.$(RepositoryName).xml" /> |
180 |
| - |
181 |
| - <ReadLinesFromFile File="$(PackageVersionPropsPath)"> |
182 |
| - <Output TaskParameter="Lines" ItemName="VersionProperties" /> |
183 |
| - </ReadLinesFromFile> |
| 184 | + OutputPath="$(_PackageVersionPropsBackupPath)" /> |
184 | 185 |
|
185 |
| - <Message Importance="High" Text="$(RepositoryName) is using versions $(PackageVersionPropsPath)" /> |
186 |
| - <Message Importance="High" Text="%(VersionProperties.Identity)" /> |
| 186 | + <Message Importance="High" Text="$(RepositoryName) using package version properties saved at $(_PackageVersionPropsBackupPath) " /> |
187 | 187 |
|
188 |
| - <ReadNuGetPackageInfos PackagePaths="@(_PreviouslySourceBuiltPackages)"> |
| 188 | + <ReadNuGetPackageInfos PackagePaths="@(PreviouslySourceBuiltPackages)"> |
189 | 189 | <Output TaskParameter="PackageInfoItems" ItemName="_PreviouslySourceBuiltPackageInfos" />
|
190 | 190 | </ReadNuGetPackageInfos>
|
191 | 191 |
|
|
322 | 322 | OverwriteDestination="true" />
|
323 | 323 | </Target>
|
324 | 324 |
|
| 325 | + <Target Name="EnsurePackagesCreated" |
| 326 | + AfterTargets="CopyPackage" |
| 327 | + Condition="'$(SkipEnsurePackagesCreated)' != 'true'"> |
| 328 | + <ItemGroup> |
| 329 | + <JustSourceBuiltPackages |
| 330 | + Include="$(SourceBuiltPackagesPath)*.nupkg" |
| 331 | + Exclude=" |
| 332 | + $(SourceBuiltPackagesPath)*.symbols.nupkg; |
| 333 | + @(PreviouslySourceBuiltPackages)" /> |
| 334 | + </ItemGroup> |
| 335 | + |
| 336 | + <ItemGroup> |
| 337 | + <_PackagesNotCreatedReason Include="^ There may have been a silent failure in the submodule build. To confirm, check the build log file for undetected errors that may have prevented package creation: $(RepoConsoleLogFile)" /> |
| 338 | + <_PackagesNotCreatedReason Include="^ This error might be a false positive if $(RepositoryName) intentionally builds no nuget packages. If so, set the SkipEnsurePackagesCreated property to true in $(MSBuildProjectFullPath)" /> |
| 339 | + <_PackagesNotCreatedReason Include="^ The 'bin' directory might be dirty from a previous build and the package files already existed. If so, perform a clean build, or check which packages were already in 'bin' by opening $(_PackageVersionPropsBackupPath)" /> |
| 340 | + </ItemGroup> |
| 341 | + |
| 342 | + <Error Condition="'@(JustSourceBuiltPackages)' == ''" |
| 343 | + Text="$(RepositoryName) produced no new source-built package identities. Known possible causes:%0A@(_PackagesNotCreatedReason, '%0A')" /> |
| 344 | + |
| 345 | + <ReadNuGetPackageInfos PackagePaths="@(JustSourceBuiltPackages)"> |
| 346 | + <Output TaskParameter="PackageInfoItems" ItemName="_JustSourceBuiltPackageInfos" /> |
| 347 | + </ReadNuGetPackageInfos> |
| 348 | + |
| 349 | + <Message Importance="High" Text="New NuGet package(s) after building $(RepositoryName):" /> |
| 350 | + <Message Importance="High" Text=" -> %(_JustSourceBuiltPackageInfos.PackageId) %(_JustSourceBuiltPackageInfos.PackageVersion)" /> |
| 351 | + </Target> |
| 352 | + |
325 | 353 | <Target Name="Clean" Condition="'$(CleanCommand)' != ''" >
|
326 | 354 | <Exec Command="$(CleanCommand) $(RedirectRepoOutputToLog)"
|
327 | 355 | WorkingDirectory="$(ProjectDirectory)"
|
|
0 commit comments