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