Merge pull request #15018 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     <PackagesPattern Condition="'$(PackagesPattern)' == ''">$(PackagesBinDir)pkg\*.nupkg</PackagesPattern>
12     <TestNativeBinariesPattern Condition="'$(TestNativeBinariesPattern)' == ''">$(OutputPath)\bin\**</TestNativeBinariesPattern>
13     <SymbolsPackagesPattern Condition="'$(SymbolPackagesPattern)' == ''">$(PackagesBinDir)symbolpkg\*.nupkg</SymbolsPackagesPattern>
14     <PublishFlatContainer Condition="'$(PublishFlatContainer)' == ''">true</PublishFlatContainer>
15     <RelativePathWithSlash>$(RelativePath)</RelativePathWithSlash>
16     <RelativePathWithSlash Condition="'$(RelativePathWithSlash)' != '' and !HasTrailingSlash('$(RelativePathWithSlash)')">$(RelativePathWithSlash)/</RelativePathWithSlash>
17   </PropertyGroup>
18
19   <PropertyGroup>
20     <ContainerName>$(ContainerName.Replace(".","-"))</ContainerName>
21     <AccountName>$(CloudDropAccountName)</AccountName>
22     <AccountKey>$(CloudDropAccessToken)</AccountKey>
23   </PropertyGroup>
24
25   <Target Name="PublishPackages" Condition="'$(__PublishPackages)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
26     <PropertyGroup>
27       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
28     </PropertyGroup>
29     <ItemGroup>
30       <ItemsToPush Remove="*.nupkg" />
31       <ItemsToPush Include="$(PackagesPattern)" Exclude="$(SymbolsPackagesPattern)"/>
32       <ItemsToPush>
33         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
34       </ItemsToPush>
35     </ItemGroup>
36
37     <!-- create the container if it doesn't exist -->
38     <CreateAzureContainer AccountKey="$(AccountKey)"
39                           AccountName="$(AccountName)"
40                           ContainerName="$(ContainerName)"
41                           IsPublic="true" />
42
43     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
44                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
45                     AccountKey="$(AccountKey)"
46                     ItemsToPush="@(ItemsToPush)"
47                     Overwrite="$(OverwriteOnPublish)" />
48
49     <!-- now upload the items -->
50     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
51                     AccountKey="$(AccountKey)"
52                     AccountName="$(AccountName)"
53                     ContainerName="$(ContainerName)"
54                     Items="@(ItemsToPush)"
55                     Overwrite="$(OverwriteOnPublish)" />
56   </Target>
57
58   <Target Name="PublishSymbolPackages" Condition="'$(__PublishSymbols)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
59     <PropertyGroup>
60       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
61     </PropertyGroup>
62     <ItemGroup>
63       <ItemsToPush Remove="*.nupkg" />
64       <ItemsToPush Include="$(SymbolsPackagesPattern)"/>
65       <ItemsToPush>
66         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
67       </ItemsToPush>
68     </ItemGroup>
69
70    <!-- create the container if it doesn't exist -->
71     <CreateAzureContainer AccountKey="$(AccountKey)"
72                           AccountName="$(AccountName)"
73                           ContainerName="$(ContainerName)"
74                           IsPublic="true" />
75
76     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
77                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
78                     AccountKey="$(AccountKey)"
79                     ItemsToPush="@(ItemsToPush)"
80                     Overwrite="$(OverwriteOnPublish)" />
81
82     <!-- now upload the items -->
83     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
84                     AccountKey="$(AccountKey)"
85                     AccountName="$(AccountName)"
86                     ContainerName="$(ContainerName)"
87                     Items="@(ItemsToPush)"
88                     Overwrite="$(OverwriteOnPublish)" />
89   </Target>
90
91   <Target Name="PublishTestNativeBinaries" Condition="'$(PublishTestNativeBins)' == 'true' and '$(OfficialPublish)' != 'true'">
92     <PropertyGroup>
93       <RelativePath Condition="'$(RelativePath)' == ''">$(__BuildType)/TestNativeBins</RelativePath>
94       <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePath)/index.json</ExpectedFeedUrl>
95     </PropertyGroup>
96     <ItemGroup>
97       <ItemsToPush Remove="*.nupkg" />
98       <ItemsToPush Include="$(TestNativeBinariesPattern)" />
99       <ItemsToPush>
100         <RelativeBlobPath>$(RelativePath)/$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
101       </ItemsToPush>
102     </ItemGroup>
103
104     <!-- create the container if it doesn't exist -->
105     <CreateAzureContainer AccountKey="$(AccountKey)"
106                           AccountName="$(AccountName)"
107                           ContainerName="$(ContainerName)"
108                           IsPublic="true" />
109
110     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
111                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
112                     AccountKey="$(AccountKey)"
113                     ItemsToPush="@(ItemsToPush)"
114                     Overwrite="$(OverwriteOnPublish)" />
115
116     <!-- now upload the items -->
117     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
118                     AccountKey="$(AccountKey)"
119                     AccountName="$(AccountName)"
120                     ContainerName="$(ContainerName)"
121                     Items="@(ItemsToPush)"
122                     Overwrite="$(OverwriteOnPublish)" />
123   </Target>
124
125   <Target Name="Build" DependsOnTargets="PublishPackages;PublishSymbolPackages;PublishTestNativeBinaries"/>
126 </Project>