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