Merge pull request #15706 from dotnet-bot/from-tfs
[platform/upstream/coreclr.git] / src / publish.proj
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4
5   <Import Project="$(PackagesDir)/$(FeedTasksPackage.ToLower())/$(FeedTasksPackageVersion)/build/$(FeedTasksPackage).targets" />
6
7   <UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
8   <UsingTask TaskName="UploadToAzure" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
9
10   <PropertyGroup>
11     <PackagesPatternDir Condition="'$(PackagesPatternDir)' == ''">$(PackagesBinDir)</PackagesPatternDir>
12     <PackagesPattern Condition="'$(PackagesPattern)' == ''">$(PackagesPatternDir)pkg\*.nupkg</PackagesPattern>
13     <TransportPackagesPattern Condition="'$(TransportPackagesPattern)' == ''">$(PackagesPatternDir)pkg\transport.*.nupkg</TransportPackagesPattern>
14     <TestNativeBinariesPattern Condition="'$(TestNativeBinariesPattern)' == ''">$(OutputPath)\bin\**</TestNativeBinariesPattern>
15     <SymbolsPackagesPattern Condition="'$(SymbolPackagesPattern)' == ''">$(PackagesPatternDir)symbolpkg\*.nupkg</SymbolsPackagesPattern>
16     <PublishFlatContainer Condition="'$(PublishFlatContainer)' == ''">true</PublishFlatContainer>
17     <RelativePathWithSlash>$(RelativePath)</RelativePathWithSlash>
18     <RelativePathWithSlash Condition="'$(RelativePathWithSlash)' != '' and !HasTrailingSlash('$(RelativePathWithSlash)')">$(RelativePathWithSlash)/</RelativePathWithSlash>
19   </PropertyGroup>
20
21   <PropertyGroup>
22     <ContainerName>$(ContainerName.Replace(".","-"))</ContainerName>
23     <AccountName>$(CloudDropAccountName)</AccountName>
24     <AccountKey>$(CloudDropAccessToken)</AccountKey>
25   </PropertyGroup>
26
27   <Target Name="PublishPackages" Condition="'$(__PublishPackages)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
28     <PropertyGroup>
29       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
30     </PropertyGroup>
31     <ItemGroup>
32       <ItemsToPush Remove="*.nupkg" />
33       <ItemsToPush Include="$(TransportPackagesPattern)">
34         <ManifestArtifactData>NonShipping=true</ManifestArtifactData>
35       </ItemsToPush>
36       <ItemsToPush Include="$(PackagesPattern)" Exclude="@(ItemsToPush);$(SymbolsPackagesPattern)" />
37       <ItemsToPush>
38         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
39       </ItemsToPush>
40     </ItemGroup>
41
42     <!-- create the container if it doesn't exist -->
43     <CreateAzureContainer AccountKey="$(AccountKey)"
44                           AccountName="$(AccountName)"
45                           ContainerName="$(ContainerName)"
46                           IsPublic="true" />
47
48     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
49                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
50                     AccountKey="$(AccountKey)"
51                     ItemsToPush="@(ItemsToPush)"
52                     Overwrite="$(OverwriteOnPublish)"
53                     ManifestName="$(GitHubRepositoryName)"
54                     ManifestBuildId="$(ManifestBuildId)"
55                     ManifestBranch="$(ManifestBranch)"
56                     ManifestCommit="$(ManifestCommit)" />
57
58     <!-- now upload the items -->
59     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
60                     AccountKey="$(AccountKey)"
61                     AccountName="$(AccountName)"
62                     ContainerName="$(ContainerName)"
63                     Items="@(ItemsToPush)"
64                     Overwrite="$(OverwriteOnPublish)" />
65   </Target>
66
67   <Target Name="PublishSymbolPackages" Condition="'$(__PublishSymbols)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
68     <PropertyGroup>
69       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
70     </PropertyGroup>
71     <ItemGroup>
72       <ItemsToPush Remove="*.nupkg" />
73       <ItemsToPush Include="$(SymbolsPackagesPattern)"/>
74       <ItemsToPush>
75         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
76       </ItemsToPush>
77     </ItemGroup>
78
79    <!-- create the container if it doesn't exist -->
80     <CreateAzureContainer AccountKey="$(AccountKey)"
81                           AccountName="$(AccountName)"
82                           ContainerName="$(ContainerName)"
83                           IsPublic="true" />
84
85     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
86                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
87                     AccountKey="$(AccountKey)"
88                     ItemsToPush="@(ItemsToPush)"
89                     Overwrite="$(OverwriteOnPublish)"
90                     ManifestName="$(GitHubRepositoryName)"
91                     ManifestBuildId="$(ManifestBuildId)"
92                     ManifestBranch="$(ManifestBranch)"
93                     ManifestCommit="$(ManifestCommit)" />
94
95     <!-- now upload the items -->
96     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
97                     AccountKey="$(AccountKey)"
98                     AccountName="$(AccountName)"
99                     ContainerName="$(ContainerName)"
100                     Items="@(ItemsToPush)"
101                     Overwrite="$(OverwriteOnPublish)" />
102   </Target>
103
104   <Target Name="PublishTestNativeBinaries" Condition="'$(PublishTestNativeBins)' == 'true' and '$(OfficialPublish)' != 'true'">
105     <PropertyGroup>
106       <RelativePath Condition="'$(RelativePath)' == ''">$(__BuildType)/TestNativeBins</RelativePath>
107       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePath)/index.json</ExpectedFeedUrl>
108     </PropertyGroup>
109     <ItemGroup>
110       <ItemsToPush Remove="*.nupkg" />
111       <ItemsToPush Include="$(TestNativeBinariesPattern)" />
112       <ItemsToPush>
113         <RelativeBlobPath>$(RelativePath)/$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
114       </ItemsToPush>
115     </ItemGroup>
116
117     <!-- create the container if it doesn't exist -->
118     <CreateAzureContainer AccountKey="$(AccountKey)"
119                           AccountName="$(AccountName)"
120                           ContainerName="$(ContainerName)"
121                           IsPublic="true" />
122
123     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
124                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
125                     AccountKey="$(AccountKey)"
126                     ItemsToPush="@(ItemsToPush)"
127                     Overwrite="$(OverwriteOnPublish)" />
128
129     <!-- now upload the items -->
130     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
131                     AccountKey="$(AccountKey)"
132                     AccountName="$(AccountName)"
133                     ContainerName="$(ContainerName)"
134                     Items="@(ItemsToPush)"
135                     Overwrite="$(OverwriteOnPublish)" />
136   </Target>
137
138   <Target Name="Build" DependsOnTargets="PublishPackages;PublishSymbolPackages;PublishTestNativeBinaries"/>
139 </Project>