Merge pull request #14899 from mikedn/rc-fix
[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>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
42     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
43                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
44                     AccountKey="$(AccountKey)"
45                     ItemsToPush="@(ItemsToPush)"
46                     Overwrite="$(OverwriteOnPublish)" />
47
48     <!-- now upload the items -->
49     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
50                     AccountKey="$(AccountKey)"
51                     AccountName="$(AccountName)"
52                     ContainerName="$(ContainerName)"
53                     Items="@(ItemsToPush)"
54                     Overwrite="$(OverwriteOnPublish)" />
55   </Target>
56
57   <Target Name="PublishSymbolPackages" Condition="'$(__PublishSymbols)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
58     <PropertyGroup>
59       <ExpectedFeedUrl>https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
60     </PropertyGroup>
61     <ItemGroup>
62       <ItemsToPush Remove="*.nupkg" />
63       <ItemsToPush Include="$(SymbolsPackagesPattern)"/>
64       <ItemsToPush>
65         <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
66       </ItemsToPush>
67     </ItemGroup>
68
69    <!-- create the container if it doesn't exist -->
70     <CreateAzureContainer AccountKey="$(AccountKey)"
71                           AccountName="$(AccountName)"
72                           ContainerName="$(ContainerName)" />
73
74     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
75                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
76                     AccountKey="$(AccountKey)"
77                     ItemsToPush="@(ItemsToPush)"
78                     Overwrite="$(OverwriteOnPublish)" />
79
80     <!-- now upload the items -->
81     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
82                     AccountKey="$(AccountKey)"
83                     AccountName="$(AccountName)"
84                     ContainerName="$(ContainerName)"
85                     Items="@(ItemsToPush)"
86                     Overwrite="$(OverwriteOnPublish)" />
87   </Target>
88
89   <Target Name="PublishTestNativeBinaries" Condition="'$(PublishTestNativeBins)' == 'true' and '$(OfficialPublish)' != 'true'">
90     <PropertyGroup>
91       <RelativePath Condition="'$(RelativePath)' == ''">$(__BuildType)/TestNativeBins</RelativePath>
92       <ExpectedFeedUrl>https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePath)/index.json</ExpectedFeedUrl>
93     </PropertyGroup>
94     <ItemGroup>
95       <ItemsToPush Remove="*.nupkg" />
96       <ItemsToPush Include="$(TestNativeBinariesPattern)" />
97       <ItemsToPush>
98         <RelativeBlobPath>$(RelativePath)/$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
99       </ItemsToPush>
100     </ItemGroup>
101
102     <!-- create the container if it doesn't exist -->
103     <CreateAzureContainer AccountKey="$(AccountKey)"
104                           AccountName="$(AccountName)"
105                           ContainerName="$(ContainerName)" />
106
107     <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
108                     ExpectedFeedUrl="$(ExpectedFeedUrl)"
109                     AccountKey="$(AccountKey)"
110                     ItemsToPush="@(ItemsToPush)"
111                     Overwrite="$(OverwriteOnPublish)" />
112
113     <!-- now upload the items -->
114     <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
115                     AccountKey="$(AccountKey)"
116                     AccountName="$(AccountName)"
117                     ContainerName="$(ContainerName)"
118                     Items="@(ItemsToPush)"
119                     Overwrite="$(OverwriteOnPublish)" />
120   </Target>
121
122   <Target Name="Build" DependsOnTargets="PublishPackages;PublishSymbolPackages;PublishTestNativeBinaries"/>
123 </Project>