Merge commit 'master' into release/2.1
[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   <Import Project="$(PackagesDir)/$(PublishSymbolsPackage.ToLower())/$(PublishSymbolsPackageVersion)/build/PublishSymbols.targets" />
7
8   <UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
9   <UsingTask TaskName="UploadToAzure" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
10
11   <PropertyGroup>
12     <PackagesPatternDir Condition="'$(PackagesPatternDir)' == ''">$(PackagesBinDir)</PackagesPatternDir>
13     <PackagesPattern Condition="'$(PackagesPattern)' == ''">$(PackagesPatternDir)pkg\*.nupkg</PackagesPattern>
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="$(PackagesPattern)" Exclude="$(SymbolsPackagesPattern)">
34         <ManifestArtifactData>NonShipping=true</ManifestArtifactData>
35       </ItemsToPush>
36       <ItemsToPush>
37         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
38       </ItemsToPush>
39     </ItemGroup>
40
41     <!-- create the container if it doesn't exist -->
42     <CreateAzureContainer AccountKey="$(AccountKey)"
43                           AccountName="$(AccountName)"
44                           ContainerName="$(ContainerName)"
45                           IsPublic="true" />
46
47     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
48                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
49                     AccountKey="$(AccountKey)"
50                     ItemsToPush="@(ItemsToPush)"
51                     Overwrite="$(OverwriteOnPublish)"
52                     ManifestName="$(GitHubRepositoryName)"
53                     ManifestBuildId="$(ManifestBuildId)"
54                     ManifestBranch="$(ManifestBranch)"
55                     ManifestCommit="$(ManifestCommit)" />
56
57     <!-- now upload the items -->
58     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
59                     AccountKey="$(AccountKey)"
60                     AccountName="$(AccountName)"
61                     ContainerName="$(ContainerName)"
62                     Items="@(ItemsToPush)"
63                     Overwrite="$(OverwriteOnPublish)" />
64   </Target>
65
66   <Target Name="PublishSymbolPackages" Condition="'$(__PublishSymbols)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
67     <PropertyGroup>
68       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
69     </PropertyGroup>
70     <ItemGroup>
71       <ItemsToPush Remove="*.nupkg" />
72       <ItemsToPush Include="$(SymbolsPackagesPattern)"/>
73       <ItemsToPush>
74         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
75       </ItemsToPush>
76     </ItemGroup>
77
78    <!-- create the container if it doesn't exist -->
79     <CreateAzureContainer AccountKey="$(AccountKey)"
80                           AccountName="$(AccountName)"
81                           ContainerName="$(ContainerName)"
82                           IsPublic="true" />
83
84     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
85                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
86                     AccountKey="$(AccountKey)"
87                     ItemsToPush="@(ItemsToPush)"
88                     Overwrite="$(OverwriteOnPublish)"
89                     ManifestName="$(GitHubRepositoryName)"
90                     ManifestBuildId="$(ManifestBuildId)"
91                     ManifestBranch="$(ManifestBranch)"
92                     ManifestCommit="$(ManifestCommit)" />
93
94     <!-- now upload the items -->
95     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
96                     AccountKey="$(AccountKey)"
97                     AccountName="$(AccountName)"
98                     ContainerName="$(ContainerName)"
99                     Items="@(ItemsToPush)"
100                     Overwrite="$(OverwriteOnPublish)" />
101   </Target>
102
103   <Target Name="PublishTestNativeBinaries" Condition="'$(PublishTestNativeBins)' == 'true' and '$(OfficialPublish)' != 'true'">
104     <PropertyGroup>
105       <RelativePath Condition="'$(RelativePath)' == ''">$(__BuildType)/TestNativeBins</RelativePath>
106       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePath)/index.json</ExpectedFeedUrl>
107     </PropertyGroup>
108     <ItemGroup>
109       <ItemsToPush Remove="*.nupkg" />
110       <ItemsToPush Include="$(TestNativeBinariesPattern)" />
111       <ItemsToPush>
112         <RelativeBlobPath>$(RelativePath)/$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
113       </ItemsToPush>
114     </ItemGroup>
115
116     <!-- create the container if it doesn't exist -->
117     <CreateAzureContainer AccountKey="$(AccountKey)"
118                           AccountName="$(AccountName)"
119                           ContainerName="$(ContainerName)"
120                           IsPublic="true" />
121
122     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
123                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
124                     AccountKey="$(AccountKey)"
125                     ItemsToPush="@(ItemsToPush)"
126                     Overwrite="$(OverwriteOnPublish)" />
127
128     <!-- now upload the items -->
129     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
130                     AccountKey="$(AccountKey)"
131                     AccountName="$(AccountName)"
132                     ContainerName="$(ContainerName)"
133                     Items="@(ItemsToPush)"
134                     Overwrite="$(OverwriteOnPublish)" />
135   </Target>
136
137   <Target Name="PublishAllSymbols" 
138           DependsOnTargets="SetupPublishSymbols;PublishSymbols" />
139
140   <Target Name="SetupPublishSymbols">
141     <PropertyGroup>
142       <ConvertPortablePdbsToWindowsPdbs Condition="'$(ConvertPortablePdbsToWindowsPdbs)'==''">true</ConvertPortablePdbsToWindowsPdbs>
143       <SymbolVerboseLogging>true</SymbolVerboseLogging>
144     </PropertyGroup>
145     <ItemGroup>
146       <SymbolPackagesToPublish Include="$(SymbolsPackagesPattern)" />
147     </ItemGroup>
148     <Error Condition="'$(SymbolServerPath)'==''" Text="Missing property SymbolServerPath" />
149     <Error Condition="'$(SymbolServerPAT)'==''" Text="Missing property SymbolServerPAT" />
150     <Message Importance="High" Text="Publishing @(SymbolPackagesToPublish) to $(SymbolServerPath)"/>
151   </Target>
152
153   <Target Name="Build" DependsOnTargets="PublishPackages;PublishSymbolPackages;PublishTestNativeBinaries"/>
154 </Project>