0dd3ff77c7
Otherwise we run into a publishing check that ensures that there are no duplicates. Also don't push if the packages itemgroup is empty
189 lines
12 KiB
XML
189 lines
12 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
|
|
<Project>
|
|
<PropertyGroup>
|
|
<Product>Sdk</Product>
|
|
<BlobStoragePartialRelativePath>$(Product)</BlobStoragePartialRelativePath>
|
|
<BlobStoragePartialRelativePath Condition="'$(IsNotOrchestratedPublish)' == 'false'">assets/$(Product)</BlobStoragePartialRelativePath>
|
|
<ChecksumsFeedUrl>$(DotnetPublishChecksumsBlobFeedUrl)</ChecksumsFeedUrl>
|
|
<SdkAssetsFeedUrl>$(DotnetPublishSdkAssetsBlobFeedUrl)</SdkAssetsFeedUrl>
|
|
|
|
<PublishSdkAssetsAndChecksumsToBlob>false</PublishSdkAssetsAndChecksumsToBlob>
|
|
<PublishSdkAssetsAndChecksumsToBlob Condition=" '$(ChecksumsFeedUrl)' != '' and '$(SdkAssetsFeedUrl)' != '' ">true</PublishSdkAssetsAndChecksumsToBlob>
|
|
|
|
<PublishBinariesAndBadge Condition=" '$(PublishBinariesAndBadge)' == '' ">true</PublishBinariesAndBadge>
|
|
</PropertyGroup>
|
|
|
|
<!-- Pulled from arcade's publish.proj see https://github.com/dotnet/arcade/issues/5790 for
|
|
issue on making this common in arcade so it doesn't have to be duplicated here -->
|
|
<PropertyGroup>
|
|
<CollectionUri>$(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)</CollectionUri>
|
|
|
|
<!-- When we have dev.azure.com/<account>/ -->
|
|
<AzureDevOpsAccount Condition="$(CollectionUri.IndexOf('dev.azure.com')) >= 0">$(CollectionUri.Split('/')[3])</AzureDevOpsAccount>
|
|
|
|
<!-- When we have <account>.visualstudio.com -->
|
|
<AzureDevOpsAccount Condition="$(CollectionUri.IndexOf('visualstudio.com')) >= 0">$(CollectionUri.Split('.')[0].Split('/')[2])</AzureDevOpsAccount>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
The new Maestro/BAR build model keeps separate Azure DevOps and GitHub build information.
|
|
The GitHub information will be extracted based on the Azure DevOps repository.
|
|
-->
|
|
<ItemGroup>
|
|
<ManifestBuildData Include="InitialAssetsLocation=$(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$(SYSTEM_TEAMPROJECT)/_apis/build/builds/$(BUILD_BUILDID)/artifacts" />
|
|
<ManifestBuildData Include="AzureDevOpsBuildId=$(BUILD_BUILDID)" />
|
|
<ManifestBuildData Include="AzureDevOpsBuildDefinitionId=$(SYSTEM_DEFINITIONID)" />
|
|
<ManifestBuildData Include="AzureDevOpsAccount=$(AzureDevOpsAccount)" />
|
|
<ManifestBuildData Include="AzureDevOpsProject=$(SYSTEM_TEAMPROJECT)" />
|
|
<ManifestBuildData Include="AzureDevOpsBuildNumber=$(BUILD_BUILDNUMBER)" />
|
|
<ManifestBuildData Include="AzureDevOpsRepository=$(BUILD_REPOSITORY_URI)" />
|
|
<ManifestBuildData Include="AzureDevOpsBranch=$(BUILD_SOURCEBRANCH)" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<!-- Because we may be building in a container, we should use an asset manifest file path
|
|
that exists in the container. Disambiguate the manifests via available properties.
|
|
AGENT_OS and AGENT_JOBNAME are present on Azure DevOps agents -->
|
|
<AssetManifestFileName Condition="'$(AGENT_OS)' != ''">$(AGENT_OS)</AssetManifestFileName>
|
|
<AssetManifestFileName Condition="'$(AGENT_OS)' == ''">$(OS)</AssetManifestFileName>
|
|
<AssetManifestFileName Condition="'$(AGENT_JOBNAME)' != ''">$(AssetManifestFileName)-$(AGENT_JOBNAME)</AssetManifestFileName>
|
|
<AssetManifestFileName Condition="'$(AGENT_JOBNAME)' == '' and '$(Architecture)' != ''">$(AssetManifestFileName)-$(Architecture)</AssetManifestFileName>
|
|
<ChecksumsAssetManifestFileName>$(AssetManifestFileName)-checksums</ChecksumsAssetManifestFileName>
|
|
<PackagesManifestFileName>$(AssetManifestFileName)-packages</PackagesManifestFileName>
|
|
<!-- Property AssetManifestFilePath will be reassigned by the Arcade SDK, so use a different name (DotNetAssetManifestFilePath) -->
|
|
<DotNetAssetManifestFilePath>$(ArtifactsLogDir)AssetManifest\$(AssetManifestFileName).xml</DotNetAssetManifestFilePath>
|
|
<ChecksumsAssetManifestFilePath>$(ArtifactsLogDir)AssetManifest\$(ChecksumsAssetManifestFileName).xml</ChecksumsAssetManifestFilePath>
|
|
<PackagesManifestFilePath>$(ArtifactsLogDir)AssetManifest\$(PackagesManifestFileName).xml</PackagesManifestFilePath>
|
|
|
|
<DotnetTempWorkingDirectory>$(ArtifactsDir)..\DotnetAssetsTmpDir\$([System.Guid]::NewGuid())</DotnetTempWorkingDirectory>
|
|
<ChecksumTempWorkingDirectory>$(ArtifactsDir)..\ChecksumAssetsTmpDir\$([System.Guid]::NewGuid())</ChecksumTempWorkingDirectory>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.zip" Condition=" '$(PublishBinariesAndBadge)' == 'true' " />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.tar.gz" Condition=" '$(PublishBinariesAndBadge)' == 'true' " />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.pkg" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.exe" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.deb" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.rpm" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.msi" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.nupkg" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.cab" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)*.svg" Condition=" '$(PublishBinariesAndBadge)' == 'true' " />
|
|
<!-- Only publish this file from windows x64 so that we don't end up with duplicates -->
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)productVersion.txt"
|
|
Condition=" '$(PublishBinariesAndBadge)' == 'true' and '$(OS)' == 'Windows_NT' and '$(Architecture)' == 'x64'" />
|
|
<SdkAssetsToPublish Include="$(ArtifactsShippingPackagesDir)productCommit-*.txt" Condition=" '$(PublishBinariesAndBadge)' == 'true' " />
|
|
<SdkNonShippingAssetsToPublish Include="$(ArtifactsNonShippingPackagesDir)*.nupkg" />
|
|
<SdkNonShippingAssetsToPublish Remove="$(ArtifactsNonShippingPackagesDir)Microsoft.Dotnet.Sdk.Internal.*.nupkg" />
|
|
<SdkNonShippingAssetsToPublish Include="$(ArtifactsNonShippingPackagesDir)*.swr" />
|
|
<SdkNonShippingAssetsToPublish Include="$(ArtifactsNonShippingPackagesDir)*.msi" />
|
|
<SdkNonShippingAssetsToPublish Condition="'$(PublishBinariesAndBadge)' != 'false'" Include="$(ArtifactsNonShippingPackagesDir)*.tar.gz" />
|
|
<SdkNonShippingAssetsToPublish Condition="'$(PublishBinariesAndBadge)' != 'false'" Include="$(ArtifactsNonShippingPackagesDir)*.zip" />
|
|
<SdkNonShippingAssetsToPublish Include="$(ArtifactsNonShippingPackagesDir)*.pkg" />
|
|
<CheckSumsToPublish Include="$(ArtifactsShippingPackagesDir)*.sha" />
|
|
<CheckSumsToPublish Remove="$(ArtifactsShippingPackagesDir)productCommit-*.txt.sha" Condition=" '$(PublishBinariesAndBadge)' == 'false'" />
|
|
<CheckSumsToPublish Remove="$(ArtifactsShippingPackagesDir)productVersion.txt.sha" Condition=" '$(OS)' != 'Windows_NT' or '$(Architecture)' != 'x64'" />
|
|
<CheckSumsToPublish Remove="$(ArtifactsShippingPackagesDir)*.zip.sha" Condition=" '$(PublishBinariesAndBadge)' == 'false' "/>
|
|
<CheckSumsToPublish Remove="$(ArtifactsShippingPackagesDir)*.tar.gz.sha" Condition=" '$(PublishBinariesAndBadge)' == 'false' "/>
|
|
<SdkNonShippingPackagesToPublish Include="$(ArtifactsNonShippingPackagesDir)Microsoft.Dotnet.Sdk.Internal.*.nupkg" Condition="'$(OS)' == 'Windows_NT' and '$(Architecture)' == 'x64'" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="PublishSdkAssetsAndChecksums"
|
|
BeforeTargets="Publish"
|
|
Condition=" '$(PublishSdkAssetsAndChecksumsToBlob)' == 'true' ">
|
|
|
|
<ReadLinesFromFile File="$(ArtifactsTmpDir)FullNugetVersion.version">
|
|
<Output
|
|
TaskParameter="Lines"
|
|
PropertyName="FullNugetVersion"/>
|
|
</ReadLinesFromFile>
|
|
|
|
<!-- If the sdk version is stabilized, then we should double publish the binaries to suffixed file names.
|
|
To do this, create new copies of the blobs, replacing the SdkVersion string in the file name with the
|
|
FullNugetVersion, except if the FullNuGetVersion is already in the file name (which would end up
|
|
publishing the same exact file name twice). -->
|
|
<ItemGroup Condition="'$(DotNetFinalVersionKind)'== 'release'">
|
|
<SdkAssetsToCopyWithSuffix Include="@(SdkAssetsToPublish)" Condition="'$([System.String]::Copy(`%(Filename)`).Contains(`$(Version)`))' == 'true'">
|
|
<SuffixedPath>$(ArtifactsShippingPackagesDir)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('$(Version)' ,'$(FullNuGetVersion)'))</SuffixedPath>
|
|
</SdkAssetsToCopyWithSuffix>
|
|
<CheckSumsToCopyWithSuffix Include="@(CheckSumsToPublish)" Condition="'$([System.String]::Copy(`%(Filename)`).Contains(`$(Version)`))' == 'true'">
|
|
<SuffixedPath>$(ArtifactsShippingPackagesDir)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('$(Version)' ,'$(FullNuGetVersion)'))</SuffixedPath>
|
|
</CheckSumsToCopyWithSuffix>
|
|
</ItemGroup>
|
|
|
|
<Copy
|
|
SourceFiles="@(SdkAssetsToCopyWithSuffix -> '%(Identity)')"
|
|
DestinationFiles="@(SdkAssetsToCopyWithSuffix -> '%(SuffixedPath)')">
|
|
<Output TaskParameter="CopiedFiles" ItemName="SdkAssetsToPublishWithSuffix" />
|
|
</Copy>
|
|
<Copy
|
|
SourceFiles="@(CheckSumsToCopyWithSuffix -> '%(Identity)')"
|
|
DestinationFiles="@(CheckSumsToCopyWithSuffix -> '%(SuffixedPath)')">
|
|
<Output TaskParameter="CopiedFiles" ItemName="CheckSumsToPublishWithSuffix" />
|
|
</Copy>
|
|
|
|
<ItemGroup>
|
|
<!-- Always publish blobs to a suffixed directory. -->
|
|
<SdkAssetsToPushToBlobFeed Include="@(SdkAssetsToPublish)">
|
|
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)'))</RelativeBlobPath>
|
|
</SdkAssetsToPushToBlobFeed>
|
|
|
|
<SdkAssetsToPushToBlobFeed Include="@(SdkNonShippingAssetsToPublish)">
|
|
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)'))</RelativeBlobPath>
|
|
<ManifestArtifactData>NonShipping=true</ManifestArtifactData>
|
|
</SdkAssetsToPushToBlobFeed>
|
|
|
|
<SdkPackagesToPush Include="@(SdkNonShippingPackagesToPublish)">
|
|
<ManifestArtifactData>NonShipping=true</ManifestArtifactData>
|
|
</SdkPackagesToPush>
|
|
|
|
<ChecksumsToPushToBlobFeed Include="@(CheckSumsToPublish)">
|
|
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)'))</RelativeBlobPath>
|
|
</ChecksumsToPushToBlobFeed>
|
|
|
|
<SdkAssetsWithSuffixToPushToBlobFeed Include="@(SdkAssetsToPublishWithSuffix)">
|
|
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)'))</RelativeBlobPath>
|
|
<ManifestArtifactData>NonShipping=true</ManifestArtifactData>
|
|
</SdkAssetsWithSuffixToPushToBlobFeed>
|
|
|
|
<ChecksumsWithSuffixToPushToBlobFeed Include="@(CheckSumsToPublishWithSuffix)" Condition="'$(DotNetFinalVersionKind)'== 'release'">
|
|
<RelativeBlobPath>$(BlobStoragePartialRelativePath)/$(FullNugetVersion)/$([System.String]::Copy('%(Filename)%(Extension)'))</RelativeBlobPath>
|
|
<ManifestArtifactData>NonShipping=true</ManifestArtifactData>
|
|
</ChecksumsWithSuffixToPushToBlobFeed>
|
|
</ItemGroup>
|
|
|
|
<PushToAzureDevOpsArtifacts
|
|
ItemsToPush="@(SdkAssetsToPushToBlobFeed);@(SdkAssetsWithSuffixToPushToBlobFeed)"
|
|
ManifestBuildData="@(ManifestBuildData)"
|
|
ManifestRepoUri="$(BUILD_REPOSITORY_URI)"
|
|
ManifestBranch="$(BUILD_SOURCEBRANCH)"
|
|
ManifestBuildId="$(BUILD_BUILDNUMBER)"
|
|
ManifestCommit="$(BUILD_SOURCEVERSION)"
|
|
AssetManifestPath="$(DotNetAssetManifestFilePath)"
|
|
PublishFlatContainer="true" />
|
|
|
|
<PushToAzureDevOpsArtifacts
|
|
ItemsToPush="@(ChecksumsToPushToBlobFeed);@(ChecksumsWithSuffixToPushToBlobFeed)"
|
|
ManifestBuildData="@(ManifestBuildData)"
|
|
ManifestRepoUri="$(BUILD_REPOSITORY_URI)"
|
|
ManifestBranch="$(BUILD_SOURCEBRANCH)"
|
|
ManifestBuildId="$(BUILD_BUILDNUMBER)"
|
|
ManifestCommit="$(BUILD_SOURCEVERSION)"
|
|
AssetManifestPath="$(ChecksumsAssetManifestFilePath)"
|
|
PublishFlatContainer="true" />
|
|
|
|
<!-- Push the sdk internal sentinel package -->
|
|
<PushToAzureDevOpsArtifacts
|
|
ItemsToPush="@(SdkPackagesToPush)"
|
|
ManifestBuildData="@(ManifestBuildData)"
|
|
ManifestRepoUri="$(BUILD_REPOSITORY_URI)"
|
|
ManifestBranch="$(BUILD_SOURCEBRANCH)"
|
|
ManifestBuildId="$(BUILD_BUILDNUMBER)"
|
|
ManifestCommit="$(BUILD_SOURCEVERSION)"
|
|
AssetManifestPath="$(PackagesManifestFilePath)"
|
|
PublishFlatContainer="false"
|
|
Condition="'@(SdkPackagesToPush)' != ''" />
|
|
</Target>
|
|
</Project>
|