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