1 <Project ToolsVersion="12.0" DefaultTargets="PublishOutputLeg" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 PublishPackagesToBlobFeed
9 ExpectedFeedUrl - This is the full URL to the index.json file for the blob feed.
10 AccountKey - This is the access token used to gain write access to the blob feed.
14 PushToBlobFeed_Overwrite - Set to true if you want to allow overrriting of existing files or packages. Defaults to 'false'.
15 PushToBlobFeed_MaxClients - Number of clients to push in parallel.
17 FileRelativePathBase - The base relative path from the blob feed root for any files uploaded. Defaults to 'assets'.
19 Selecting packages for publish:
21 PackagesToPublishPattern - Property to declare a file glob for selecting the packages to be pushed. (eg. $(PackageOutput)*.nupkg)
22 PackagesToPublish - Item group that contains a list of packages to be pushed, if glob isn't enough.
24 Selecting files for publish:
26 FilesToPublishPattern - Property to declare a file glob for selecting the files to be pushed. (eg. $(OutputPath)*.zip)
27 FilesToPublish - Item group that contains a list of files to be pushed, if glob isn't enough.
28 %(RelativeBlobPath) - Metadata that can be put on file items to control the relative path where the file
29 goes underneath the blob feed. If not specfied it is default based on the FileRelativePathBase
31 Specifying build output manifest values:
33 ManifestName - The repository name, listed inside the manifest and used to name the file.
34 If $(GitHubRepositoryName) is defined, its value is used. Default: "anonymous"
35 ManifestBuildId - Build ID listed in the manifest. Default: "no build id provided"
36 ManifestBranch - Branch listed in the manifest. Default: none
37 ManifestCommit - Commit listed in the manifest. Default: none
38 SkipCreateManifest - If 'true', no manifest is written even if the blob feed allows them.
43 <_MicrosoftDotNetBuildTasksFeedTaskDir>$(MSBuildThisFileDirectory)net46/</_MicrosoftDotNetBuildTasksFeedTaskDir>
44 <_MicrosoftDotNetBuildTasksFeedTaskDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)netstandard1.5/</_MicrosoftDotNetBuildTasksFeedTaskDir>
46 <UsingTask TaskName="ConfigureInputFeeds" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
47 <UsingTask TaskName="CopyBlobDirectory" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
48 <UsingTask TaskName="FetchOrchestratedBuildManifestInfo" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
49 <UsingTask TaskName="GetBlobFeedPackageList" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
50 <UsingTask TaskName="ParseBlobUrl" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
51 <UsingTask TaskName="PushOrchestratedBuildManifest" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
52 <UsingTask TaskName="PushToBlobFeed" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
53 <UsingTask TaskName="UpdateOrchestratedBuildManifest" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
54 <UsingTask TaskName="WriteOrchestratedBuildManifestToFile" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
55 <UsingTask TaskName="WriteOrchestratedBuildManifestSummaryToFile" AssemblyFile="$(_MicrosoftDotNetBuildTasksFeedTaskDir)Microsoft.DotNet.Build.Tasks.Feed.dll"/>
58 <PushToBlobFeed_Overwrite Condition="'$(PushToBlobFeed_Overwrite)' == ''">false</PushToBlobFeed_Overwrite>
59 <PushToBlobFeed_MaxClients Condition="'$(PushToBlobFeed_MaxClients)' == ''">8</PushToBlobFeed_MaxClients>
60 <FileRelativePathBase Condition="'$(FileRelativePathBase)' == ''">assets</FileRelativePathBase>
61 <FileRelativePathBase Condition="!HasTrailingSlash('$(FileRelativePathBase)')">$(FileRelativePathBase)/</FileRelativePathBase>
62 <ManifestName Condition="'$(ManifestName)' == ''">$(GitHubRepositoryName)</ManifestName>
65 <Target Name="PublishPackagesToBlobFeed" DependsOnTargets="@(PublishPackagesToBlobFeedDependsOn)" >
66 <Error Text="The ExpectedFeedUrl property must be set on the command line."
67 Condition="'$(ExpectedFeedUrl)' == ''" />
68 <Error Text="The AccountKey property must be set on the command line."
69 Condition="'$(AccountKey)' == ''" />
72 <_ItemsToPush Remove="@(_ItemsToPush)" />
73 <_ItemsToPush Condition="'$(PackagesToPublishPattern)' != ''" Include="$(PackagesToPublishPattern)" />
74 <_ItemsToPush Include="@(PackagesToPublish)" />
77 <Error Condition="'@(_ItemsToPush)' == ''" Text="No packages to push." />
79 <PushToBlobFeed ExpectedFeedUrl="$(ExpectedFeedUrl)"
80 AccountKey="$(AccountKey)"
81 ItemsToPush="@(_ItemsToPush)"
82 Overwrite="$(PushToBlobFeed_Overwrite)"
83 MaxClients="$(PushToBlobFeed_MaxClients)"
84 ManifestName="$(ManifestName)"
85 ManifestBuildId="$(ManifestBuildId)"
86 ManifestBranch="$(ManifestBranch)"
87 ManifestCommit="$(ManifestCommit)"
88 ManifestBuildData="$(ManifestBuildData)"
89 SkipCreateManifest="$(SkipCreateManifest)" />
92 <Target Name="PublishFilesToBlobFeed">
93 <Error Text="The ExpectedFeedUrl property must be set on the command line."
94 Condition="'$(ExpectedFeedUrl)' == ''" />
95 <Error Text="The AccountKey property must be set on the command line."
96 Condition="'$(AccountKey)' == ''" />
99 <_ItemsToPush Remove="@(_ItemsToPush)" />
100 <_ItemsToPush Condition="'$(FilesToPublishPattern)' != ''" Include="$(FilesToPublishPattern)" />
101 <_ItemsToPush Include="@(FilesToPublish)" />
103 <RelativeBlobPath Condition="'%(_ItemsToPush.RelativeBlobPath)' == ''">$(FileRelativePathBase)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
107 <Error Condition="'@(_ItemsToPush)' == ''" Text="No files to push." />
109 <PushToBlobFeed ExpectedFeedUrl="$(ExpectedFeedUrl)"
110 AccountKey="$(AccountKey)"
111 ItemsToPush="@(_ItemsToPush)"
112 PublishFlatContainer="true"
113 Overwrite="$(PushToBlobFeed_Overwrite)"
114 MaxClients="$(PushToBlobFeed_MaxClients)"
115 ManifestName="$(ManifestName)"
116 ManifestBuildId="$(ManifestBuildId)"
117 ManifestBranch="$(ManifestBranch)"
118 ManifestCommit="$(ManifestCommit)"
119 ManifestBuildData="$(ManifestBuildData)"
120 SkipCreateManifest="$(SkipCreateManifest)" />
125 Create an orchestrated build manifest based on the build output manifests uploaded to a feed.
127 <Target Name="CreateFeedOrchestratedBuildManifest">
128 <Error Text="The ExpectedFeedUrl property must be set." Condition="'$(ExpectedFeedUrl)' == ''" />
129 <Error Text="The AccountKey property must be set." Condition="'$(AccountKey)' == ''" />
130 <Error Text="The ManifestName property must be set." Condition="'$(ManifestName)' == ''" />
131 <Error Text="The ManifestBuildId property must be set." Condition="'$(ManifestBuildId)' == ''" />
134 <ManifestTempDir Condition="'$(ManifestTempDir)' == ''">$(BaseIntermediateOutputPath)manifest-temp/</ManifestTempDir>
135 <ManifestDownloadDir Condition="'$(ManifestDownloadDir)' == ''">$(ManifestTempDir)downloads/</ManifestDownloadDir>
136 <ManifestFile Condition="'$(ManifestFile)' == ''">$(ManifestTempDir)build.xml</ManifestFile>
137 <ManifestSummaryFile Condition="'$(ManifestSummaryFile)' == ''">$(ManifestTempDir)README.md</ManifestSummaryFile>
140 <ParseBlobUrl BlobUrl="$(ExpectedFeedUrl.Replace('/index.json', ''))">
141 <Output TaskParameter="BlobElements" ItemName="ParsedFeedUrl" />
144 <DownloadFromAzure AccountName="%(ParsedFeedUrl.AccountName)"
145 AccountKey="$(AccountKey)"
146 ContainerName="%(ParsedFeedUrl.ContainerName)"
147 BlobNameExtension=".xml"
148 BlobNamePrefix="%(ParsedFeedUrl.BlobPath)/assets/orchestration-metadata/manifests/"
149 DownloadDirectory="$(ManifestDownloadDir)"
150 DownloadFlatFiles="true" />
153 <BuildManifests Include="$(ManifestDownloadDir)*.xml" />
156 <WriteOrchestratedBuildManifestToFile File="$(ManifestFile)"
157 BlobFeedUrl="$(ExpectedFeedUrl)"
158 BuildManifestFiles="@(BuildManifests)"
159 ManifestName="$(ManifestName)"
160 ManifestBuildId="$(ManifestBuildId)" />
162 <WriteOrchestratedBuildManifestSummaryToFile File="$(ManifestSummaryFile)"
163 ManifestFile="$(ManifestFile)"
164 SdkTableTemplateFile="$(SdkTableTemplateFile)"
165 DotNetRuntimeTableTemplateFile="$(DotNetRuntimeTableTemplateFile)"
166 AspNetCoreRuntimeTableTemplateFile="$(AspNetCoreRuntimeTableTemplateFile)" />
169 <SupplementaryFiles Include="$(ManifestSummaryFile)" />
174 Push the orchestrated build manifest for a certain feed to a versions repo.
176 <Target Name="PushFeedOrchestratedBuildManifest"
177 DependsOnTargets="CreateVersionsRepoDefaults;
178 CreateFeedOrchestratedBuildManifest">
179 <Error Text="The VersionsRepoPath property must be set." Condition="'$(VersionsRepoPath)' == ''" />
180 <Error Text="The GitHubAuthToken property must be set." Condition="'$(GitHubAuthToken)' == ''" />
181 <Error Text="The GitHubUser property must be set." Condition="'$(GitHubUser)' == ''" />
182 <Error Text="The GitHubEmail property must be set." Condition="'$(GitHubEmail)' == ''" />
184 <PushOrchestratedBuildManifest ManifestFile="$(ManifestFile)"
185 VersionsRepoPath="$(VersionsRepoPath)"
186 GitHubAuthToken="$(GitHubAuthToken)"
187 GitHubUser="$(GitHubUser)"
188 GitHubEmail="$(GitHubEmail)"
189 VersionsRepo="$(VersionsRepo)"
190 VersionsRepoOwner="$(VersionsRepoOwner)"
191 VersionsRepoBranch="$(VersionsRepoBranch)"
192 CommitMessage="$(CommitMessage)"
193 SupplementaryFiles="@(SupplementaryFiles)" />
197 <Target Name="CreateVersionsRepoDefaults">
199 <VersionsRepo Condition="'$(VersionsRepo)' == ''">versions</VersionsRepo>
200 <VersionsRepoOwner Condition="'$(VersionsRepoOwner)' == ''">dotnet</VersionsRepoOwner>
201 <VersionsRepoBranch Condition="'$(VersionsRepoBranch)' == ''">master</VersionsRepoBranch>
206 Fetch an orchestrated build manifest from the versions repo and extract its information into
207 items and properties.
210 $(VersionsRepoPath): The root folder inside the target versions repo where the manifest is
211 located. Doesn't include a trailing '/'.
213 $(GitHubAuthToken): Auth token used when calling GitHub APIs. If this isn't provided,
214 anonymous access is used. Provide an auth token to avoid rate limit errors.
215 $(GitHubUser): The GitHub user associated with GitHubAuthToken.
216 $(GitHubEmail): The email associated with GitHubAuthToken.
217 $(VersionsRepo): The GitHub repo name. Default: 'versions'
218 $(VersionsRepoOwner): The GitHub repo owner. Default: 'dotnet'
219 $(VersionsRepoRef): The git ref to fetch from. If not specified, uses VersionsRepoBranch.
220 $(VersionsRepoBranch): The branch to fetch from. Default: 'master'
223 $(OrchestratedBuildId): The orchestrated build manifest's build id attribute value.
224 $(OrchestratedIdentitySummary): Human-readable full identity of the orchestrated build manifest.
225 @(OrchestratedBuild): A single item describing the root manifest element.
226 %(Identity): The name of the build.
227 %(Xml): The raw XML string representing the build in the manifest.
228 %(...): Metadata is created for each attribute on the element.
229 @(OrchestratedBlobFeed): A single item for the orchestrated blob feed Endpoint.
230 %(...): Metadata is created for each attribute on the element.
231 @(ParsedOrchestratedBlobFeed): The result of parsing the OrchestratedBlobFeed url.
232 %(BlobPath): The root of the blob feed, without '/index.json'. Use this to construct artifact
234 %(AccountName) %(ContainerName) %(Endpoint)
235 @(OrchestratedBlobFeedArtifacts): An item for each artifact in the orchestrated blob feed.
236 %(Identity): 'Package' or 'Blob', matching manifest element name.
237 %(Xml): The raw XML string representing the artifact in the manifest.
238 %(...): Metadata is created for each attribute on the element.
239 @(OrchestratedBuildConstituents): An item for each Build in the orchestrated build manifest.
240 %(Identity): The name of the build.
241 %(Xml): The raw XML string representing the build in the manifest.
242 %(...): Metadata is created for each attribute on the element.
244 <Target Name="FetchOrchestratedBuildManifestInfo"
245 DependsOnTargets="CreateVersionsRepoDefaults">
246 <Error Text="The VersionsRepoPath property must be set." Condition="'$(VersionsRepoPath)' == ''" />
249 <VersionsRepoRef Condition="'$(VersionsRepoRef)' == ''">heads/$(VersionsRepoBranch)</VersionsRepoRef>
251 <Error Text="The VersionsRepoRef property must be set." Condition="'$(VersionsRepoRef)' == ''" />
253 <FetchOrchestratedBuildManifestInfo VersionsRepoPath="$(VersionsRepoPath)"
254 GitHubAuthToken="$(GitHubAuthToken)"
255 GitHubUser="$(GitHubUser)"
256 GitHubEmail="$(GitHubEmail)"
257 VersionsRepo="$(VersionsRepo)"
258 VersionsRepoOwner="$(VersionsRepoOwner)"
259 VersionsRepoRef="$(VersionsRepoRef)">
260 <Output TaskParameter="OrchestratedBuild" ItemName="OrchestratedBuild" />
261 <Output TaskParameter="OrchestratedBlobFeed" ItemName="OrchestratedBlobFeed" />
262 <Output TaskParameter="OrchestratedBlobFeedArtifacts" ItemName="OrchestratedBlobFeedArtifacts" />
263 <Output TaskParameter="OrchestratedBuildConstituents" ItemName="OrchestratedBuildConstituents" />
264 </FetchOrchestratedBuildManifestInfo>
267 <OrchestratedBuildId>%(OrchestratedBuild.BuildId)</OrchestratedBuildId>
268 <OrchestratedIdentitySummary>%(OrchestratedBuild.IdentitySummary)</OrchestratedIdentitySummary>
269 <OrchestratedBlobFeedUrl>%(OrchestratedBlobFeed.Url)</OrchestratedBlobFeedUrl>
272 <ParseBlobUrl BlobUrl="$(OrchestratedBlobFeedUrl.Replace('/index.json', ''))">
273 <Output TaskParameter="BlobElements" ItemName="ParsedOrchestratedBlobFeed" />
278 Download packages from an orchestrated feed given their identities and versions.
281 $(AccountKey): A key to use when accessing the blob feed's blob storage.
282 @(OrchestratedBlobFeedArtifacts): The artifacts to download. All items with identity 'Package'
283 are downloaded. Expected to have this from FetchOrchestratedBuildManifestInfo.
284 %(Id): NuGet package identity.
285 %(Version): NuGet package version.
286 @(ParsedOrchestratedBlobFeed): The parsed feed to access. Output from
287 FetchOrchestratedBuildManifestInfo is expected.
289 $(FinalDownloadDirectory): Custom directory to place downloaded nupkg files. This directory will
290 be removed and recreated to ensure no stale bits are included.
293 @(DownloadedOrchestratedFeedPackages): Each nupkg file downloaded.
294 @(FinalPackages): The downloaded subset of OrchestratedBlobFeedArtifacts. Metadata is preserved.
296 <Target Name="DownloadOrchestratedFeedPackages">
297 <Error Text="The AccountKey property must be set." Condition="'$(AccountKey)' == ''" />
298 <Error Text="A ParsedOrchestratedBlobFeed item must be set." Condition="'@(ParsedOrchestratedBlobFeed)' == ''" />
301 <FinalDownloadDirectory Condition="'$(FinalDownloadDirectory)' == ''">$(BaseIntermediateOutputPath)final-package-download\</FinalDownloadDirectory>
302 <BlobNamePrefix>%(ParsedOrchestratedBlobFeed.BlobPath)/flatcontainer/</BlobNamePrefix>
306 <FinalPackages Include="@(OrchestratedBlobFeedArtifacts)"
307 Condition="'%(Identity)' == 'Package'">
308 <LowercaseId>$([System.String]::Copy('%(OrchestratedBlobFeedArtifacts.Id)').ToLowerInvariant())</LowercaseId>
309 <LowercaseVersion>$([System.String]::Copy('%(OrchestratedBlobFeedArtifacts.Version)').ToLowerInvariant())</LowercaseVersion>
313 <NupkgFile>%(LowercaseId).%(LowercaseVersion).nupkg</NupkgFile>
317 <DownloadFullPath>$(FinalDownloadDirectory)%(NupkgFile)</DownloadFullPath>
320 <PackageBlobNames Include="$(BlobNamePrefix)%(FinalPackages.LowercaseId)/%(FinalPackages.LowercaseVersion)/%(FinalPackages.NupkgFile)" />
323 <!-- Ensure no stale packages are on disk. -->
324 <RemoveDir Directories="$(FinalDownloadDirectory)" />
326 <DownloadFromAzure AccountName="%(ParsedOrchestratedBlobFeed.AccountName)"
327 AccountKey="$(AccountKey)"
328 ContainerName="%(ParsedOrchestratedBlobFeed.ContainerName)"
329 BlobNames="@(PackageBlobNames)"
330 DownloadDirectory="$(FinalDownloadDirectory)"
331 DownloadFlatFiles="true" />
334 <DownloadedOrchestratedFeedPackages Include="$(FinalDownloadDirectory)*.nupkg" />
339 Create/update a semaphore in the versions repo. This indicates some action is complete.
342 $(VersionsRepoPath): The root folder inside the target versions repo where the manifest is
343 located. Doesn't include a trailing '/'.
344 $(GitHubAuthToken): Auth token used when calling GitHub APIs.
345 $(GitHubUser): The GitHub user associated with GitHubAuthToken.
346 $(GitHubEmail): The email associated with GitHubAuthToken.
347 $(OrchestratedBuildId): The orchestrated build id. Passing this along ensures that we aren't
348 trying to pass stale data to the versions repo. This value is expected to come from the
349 FetchOrchestratedBuildManifestInfo target. It prevents stale data from being uploaded to a
350 newer manifest, instead emitting a warning.
351 @(SemaphoreNames): Semaphores to update. Usually a single item, like 'packages.semaphore'.
353 @(ManifestUpdates): Updates to perform on the manifest. These help convey information to
354 downstream steps, but aren't required. For item requirements and behavior, see
355 'UpdateOrchestratedBuildManifest.cs' in dotnet/buildtools.
356 $(VersionsRepo): The GitHub repo name. Default: 'versions'
357 $(VersionsRepoOwner): The GitHub repo owner. Default: 'dotnet'
358 $(VersionsRepoBranch): The branch to fetch from. Default: 'master'
359 $(OrchestratedIdentitySummary): Human-readable identity of the orchestrated build, used to
360 generate a concise commit message. This is expected to come from
361 FetchOrchestratedBuildManifestInfo.
362 Default: the full VersionsRepoPath is used in the commit message.
363 $(CommitMessage): Overrides the generated commit message.
364 @(SupplementaryFiles): Uploads supplementary files to the versions repo as part of the update.
365 For item requirements and behavior, see 'UpdateOrchestratedBuildManifest.cs' in
368 <Target Name="UpdateOrchestratedBuildManifest"
369 DependsOnTargets="CreateVersionsRepoDefaults">
370 <Error Text="The VersionsRepoPath property must be set." Condition="'$(VersionsRepoPath)' == ''" />
371 <Error Text="The GitHubAuthToken property must be set." Condition="'$(GitHubAuthToken)' == ''" />
372 <Error Text="The GitHubUser property must be set." Condition="'$(GitHubUser)' == ''" />
373 <Error Text="The GitHubEmail property must be set." Condition="'$(GitHubEmail)' == ''" />
375 <Error Text="A SemaphoreNames item must be set." Condition="'@(SemaphoreNames)' == ''" />
377 <UpdateOrchestratedBuildManifest ManifestUpdates="@(ManifestUpdates)"
378 VersionsRepoPath="$(VersionsRepoPath)"
379 SemaphoreNames="@(SemaphoreNames)"
380 OrchestratedBuildId="$(OrchestratedBuildId)"
381 GitHubAuthToken="$(GitHubAuthToken)"
382 GitHubUser="$(GitHubUser)"
383 GitHubEmail="$(GitHubEmail)"
384 VersionsRepo="$(VersionsRepo)"
385 VersionsRepoOwner="$(VersionsRepoOwner)"
386 VersionsRepoBranch="$(VersionsRepoBranch)"
387 CommitMessage="$(CommitMessage)"
388 OrchestratedIdentitySummary="$(OrchestratedIdentitySummary)"
389 SupplementaryFiles="@(SupplementaryFiles)"
390 JoinSemaphoreGroups="@(JoinSemaphoreGroups)" />