Build the SourceBuilt tarball in the publish job and include the merged vertical manifest in it. (#19433)
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
This commit is contained in:
parent
5776243be6
commit
eed5184764
5 changed files with 83 additions and 70 deletions
|
@ -191,4 +191,8 @@
|
|||
<PoisonUsageReportFile>$(PackageReportDir)poison-usage.xml</PoisonUsageReportFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<MergedAssetManifestOutputPath>$(ArtifactsDir)VerticalManifest.xml</MergedAssetManifestOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
<Project Sdk="Microsoft.Build.NoTargets">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Need to set to false to calculate RepositoryCommit. -->
|
||||
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
|
||||
<TargetFramework>$(NetCurrent)</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.UnifiedBuild.Tasks\Microsoft.DotNet.UnifiedBuild.Tasks.csproj" />
|
||||
<ProjectReference Include="$(TasksDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj" />
|
||||
<ProjectReference Include="$(RepositoryEngineeringDir)publish.proj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- After building, generate a prebuilt usage report. -->
|
||||
|
@ -172,4 +175,79 @@
|
|||
<Error Text="@(PrebuiltFile->Count()) Prebuilts Exist" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
|
||||
DependsOnTargets="DetermineSourceBuiltSdkVersion;ResolveProjectReferences">
|
||||
<!-- Inputs: Packages to include in the tarball -->
|
||||
<ItemGroup>
|
||||
<ArtifactsPackageToBundle Include="$(ArtifactsShippingPackagesDir)**;
|
||||
$(ArtifactsNonShippingPackagesDir)**"
|
||||
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
|
||||
<ReferencePackageToBundle Include="$(ReferencePackagesDir)**"
|
||||
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
|
||||
<MergedAssetManifest Include="$(MergedAssetManifestOutputPath)" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Create a layout directory for the files that are to be included in the artifacts tarball. -->
|
||||
<SourceBuiltLayoutDir>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', 'artifacts-layout'))</SourceBuiltLayoutDir>
|
||||
|
||||
<!-- Outputs -->
|
||||
<SourceBuiltTarballName>$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
|
||||
<SourceBuiltVersionName>$(SourceBuiltLayoutDir).version</SourceBuiltVersionName>
|
||||
<AllPackageVersionsPropsName>$(SourceBuiltLayoutDir)PackageVersions.props</AllPackageVersionsPropsName>
|
||||
<SourceBuiltMergedAssetManifestName>$(SourceBuiltLayoutDir)%(MergedAssetManifest.Filename)%(MergedAssetManifest.Extension)</SourceBuiltMergedAssetManifestName>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<!-- Create the SourceBuilt.Private.Artifacts archive when building source-only. -->
|
||||
<UsingTask TaskName="Microsoft.DotNet.UnifiedBuild.Tasks.WritePackageVersionsProps" AssemblyFile="$(MicrosoftDotNetUnifiedBuildTasksAssembly)" TaskFactory="TaskHostFactory" />
|
||||
<Target Name="CreatePrivateSourceBuiltArtifactsArchive"
|
||||
AfterTargets="Build"
|
||||
DependsOnTargets="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
|
||||
Inputs="@(ArtifactsPackageToBundle);@(ReferencePackageToBundle);@(MergedAssetManifest)"
|
||||
Outputs="$(SourceBuiltTarballName);$(SourceBuiltVersionName);$(AllPackageVersionsPropsName);$(SourceBuiltMergedAssetManifestName)">
|
||||
<!-- Copy packages to layout directory. Since there are a large number of files,
|
||||
this will use symlinks instead of copying files to make this execute quickly. -->
|
||||
<Copy SourceFiles="@(ArtifactsPackageToBundle)"
|
||||
DestinationFolder="$(SourceBuiltLayoutDir)"
|
||||
UseSymbolicLinksIfPossible="true" />
|
||||
<Copy SourceFiles="@(ReferencePackageToBundle)"
|
||||
DestinationFolder="$(SourceBuiltLayoutDir)SourceBuildReferencePackages"
|
||||
UseSymbolicLinksIfPossible="true" />
|
||||
|
||||
<!-- Content of the .version file to include in the tarball -->
|
||||
<ItemGroup>
|
||||
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<WriteLinesToFile File="$(SourceBuiltVersionName)"
|
||||
Lines="@(VersionFileContent)"
|
||||
Overwrite="true" />
|
||||
|
||||
<!-- Copy the merged asset manifest into the tarball -->
|
||||
<Copy SourceFiles="$(MergedAssetManifestOutputPath)"
|
||||
DestinationFolder="$(SourceBuiltLayoutDir)"
|
||||
UseSymbolicLinksIfPossible="true" />
|
||||
|
||||
<!-- non-rid-specific versions of RID-specific version variables to use for bootstrapping -->
|
||||
<ItemGroup>
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimeVersion" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppHostPackageVersion" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimeVersion" Version="%24(MicrosoftAspNetCoreAppRefPackageVersion)" />
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppCrossgen2Version" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Create a PackageVersions.props file that includes entries for all packages. -->
|
||||
<WritePackageVersionsProps NuGetPackages="@(ArtifactsPackageToBundle)"
|
||||
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
|
||||
VersionPropsFlowType="AllPackages"
|
||||
OutputPath="$(AllPackageVersionsPropsName)" />
|
||||
|
||||
<Exec Command="tar --numeric-owner -czhf $(SourceBuiltTarballName) $([System.IO.Path]::GetFileName('$(SourceBuiltVersionName)')) *"
|
||||
WorkingDirectory="$(SourceBuiltLayoutDir)" />
|
||||
|
||||
<Message Importance="High" Text="Packaged source-built artifacts to $(SourceBuiltTarballName)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
<!-- Create a merge manifest from the individual repository manifest files. -->
|
||||
<UsingTask TaskName="Microsoft.DotNet.UnifiedBuild.Tasks.MergeAssetManifests" AssemblyFile="$(MicrosoftDotNetUnifiedBuildTasksAssembly)" TaskFactory="TaskHostFactory" />
|
||||
<Target Name="MergeAssetManifests" AfterTargets="Build">
|
||||
<PropertyGroup>
|
||||
<MergedAssetManifestOutputPath>$(ArtifactsDir)VerticalManifest.xml</MergedAssetManifestOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<RepoAssetManifest Include="$(AssetManifestsIntermediateDir)\**\*.xml" />
|
||||
|
@ -26,4 +23,4 @@
|
|||
VmrBuildNumber="$(BUILD_BUILDNUMBER)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -246,10 +246,6 @@
|
|||
|
||||
<!-- Used by sdk to determine msbuild version for fsharp -->
|
||||
<ExtraPackageVersionPropsPackageInfo Include="FSharpBuildVersion" Version="%24(MicrosoftBuildPackageVersion)" />
|
||||
|
||||
<!-- non-rid-specific versions of RID-specific version variables to use for bootstrapping -->
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimeVersion" Version="%24(MicrosoftAspNetCoreAppRefPackageVersion)" />
|
||||
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppCrossgen2Version" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<Project Sdk="Microsoft.Build.NoTargets">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Need to set to false to calculate RepositoryCommit. -->
|
||||
<EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries>
|
||||
|
||||
<!-- Use the repo root build script -->
|
||||
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
|
||||
|
||||
|
@ -78,65 +75,6 @@
|
|||
<EnvironmentVariables Include="PublishWindowsPdb=false" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
|
||||
DependsOnTargets="DetermineSourceBuiltSdkVersion">
|
||||
<!-- Inputs: Packages to include in the tarball -->
|
||||
<ItemGroup>
|
||||
<ArtifactsPackageToBundle Include="$(ArtifactsShippingPackagesDir)**;
|
||||
$(ArtifactsNonShippingPackagesDir)**"
|
||||
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
|
||||
<ReferencePackageToBundle Include="$(ReferencePackagesDir)**"
|
||||
Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Create a layout directory for the files that are to be included in the artifacts tarball. -->
|
||||
<SourceBuiltLayoutDir>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', 'artifacts-layout'))</SourceBuiltLayoutDir>
|
||||
|
||||
<!-- Outputs -->
|
||||
<SourceBuiltTarballName>$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
|
||||
<SourceBuiltVersionName>$(SourceBuiltLayoutDir).version</SourceBuiltVersionName>
|
||||
<AllPackageVersionsPropsName>$(SourceBuiltLayoutDir)PackageVersions.props</AllPackageVersionsPropsName>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<!-- Create the SourceBuilt.Private.Artifacts archive when building source-only. -->
|
||||
<Target Name="CreatePrivateSourceBuiltArtifactsArchive"
|
||||
AfterTargets="Build"
|
||||
DependsOnTargets="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
|
||||
Inputs="@(ArtifactsPackageToBundle);@(ReferencePackageToBundle)"
|
||||
Outputs="$(SourceBuiltTarballName);$(SourceBuiltVersionName);$(AllPackageVersionsPropsName)"
|
||||
Condition="'$(DotNetBuildSourceOnly)' == 'true'">
|
||||
<!-- Copy packages to layout directory. Since there are a large number of files,
|
||||
this will use symlinks instead of copying files to make this execute quickly. -->
|
||||
<Copy SourceFiles="@(ArtifactsPackageToBundle)"
|
||||
DestinationFolder="$(SourceBuiltLayoutDir)"
|
||||
UseSymbolicLinksIfPossible="true" />
|
||||
<Copy SourceFiles="@(ReferencePackageToBundle)"
|
||||
DestinationFolder="$(SourceBuiltLayoutDir)SourceBuildReferencePackages"
|
||||
UseSymbolicLinksIfPossible="true" />
|
||||
|
||||
<!-- Content of the .version file to include in the tarball -->
|
||||
<ItemGroup>
|
||||
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<WriteLinesToFile File="$(SourceBuiltVersionName)"
|
||||
Lines="@(VersionFileContent)"
|
||||
Overwrite="true" />
|
||||
|
||||
<!-- Create a PackageVersions.props file that includes entries for all packages. -->
|
||||
<WritePackageVersionsProps NuGetPackages="@(ArtifactsPackageToBundle)"
|
||||
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
|
||||
VersionPropsFlowType="AllPackages"
|
||||
OutputPath="$(AllPackageVersionsPropsName)" />
|
||||
|
||||
<Exec Command="tar --numeric-owner -czhf $(SourceBuiltTarballName) $([System.IO.Path]::GetFileName('$(SourceBuiltVersionName)')) *"
|
||||
WorkingDirectory="$(SourceBuiltLayoutDir)" />
|
||||
|
||||
<Message Importance="High" Text="Packaged source-built artifacts to $(SourceBuiltTarballName)" />
|
||||
</Target>
|
||||
|
||||
<!-- Copy SDK archive to assets root. -->
|
||||
<Target Name="CopySdkArchive"
|
||||
AfterTargets="Build"
|
||||
|
|
Loading…
Reference in a new issue