summaryrefslogtreecommitdiff
path: root/src/publish.proj
blob: 42a98e48b451a25f6b09f12493f39dcbb1471569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

  <Import Project="$(PackagesDir)/$(FeedTasksPackage.ToLower())/$(FeedTasksPackageVersion)/build/$(FeedTasksPackage).targets" />

  <UsingTask TaskName="CreateAzureContainer" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>
  <UsingTask TaskName="UploadToAzure" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll"/>

  <PropertyGroup>
    <PackagesPatternDir Condition="'$(PackagesPatternDir)' == ''">$(PackagesBinDir)</PackagesPatternDir>
    <PackagesPattern Condition="'$(PackagesPattern)' == ''">$(PackagesPatternDir)pkg\*.nupkg</PackagesPattern>
    <TestNativeBinariesPattern Condition="'$(TestNativeBinariesPattern)' == ''">$(OutputPath)\bin\**</TestNativeBinariesPattern>
    <SymbolsPackagesPattern Condition="'$(SymbolPackagesPattern)' == ''">$(PackagesPatternDir)symbolpkg\*.nupkg</SymbolsPackagesPattern>
    <PublishFlatContainer Condition="'$(PublishFlatContainer)' == ''">true</PublishFlatContainer>
    <RelativePathWithSlash>$(RelativePath)</RelativePathWithSlash>
    <RelativePathWithSlash Condition="'$(RelativePathWithSlash)' != '' and !HasTrailingSlash('$(RelativePathWithSlash)')">$(RelativePathWithSlash)/</RelativePathWithSlash>
  </PropertyGroup>

  <PropertyGroup>
    <ContainerName>$(ContainerName.Replace(".","-"))</ContainerName>
    <AccountName>$(CloudDropAccountName)</AccountName>
    <AccountKey>$(CloudDropAccessToken)</AccountKey>
  </PropertyGroup>

  <Target Name="PublishPackages" Condition="'$(__PublishPackages)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
    <PropertyGroup>
      <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
    </PropertyGroup>
    <ItemGroup>
      <ItemsToPush Remove="*.nupkg" />
      <ItemsToPush Include="$(PackagesPattern)" Exclude="$(SymbolsPackagesPattern)">
        <ManifestArtifactData>NonShipping=true</ManifestArtifactData>
      </ItemsToPush>
      <ItemsToPush>
        <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
      </ItemsToPush>
    </ItemGroup>

    <!-- create the container if it doesn't exist -->
    <CreateAzureContainer AccountKey="$(AccountKey)"
                          AccountName="$(AccountName)"
                          ContainerName="$(ContainerName)"
                          IsPublic="true" />

    <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
                    ExpectedFeedUrl="$(ExpectedFeedUrl)"
                    AccountKey="$(AccountKey)"
                    ItemsToPush="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)"
                    ManifestName="$(GitHubRepositoryName)"
                    ManifestBuildId="$(ManifestBuildId)"
                    ManifestBranch="$(ManifestBranch)"
                    ManifestCommit="$(ManifestCommit)" />

    <!-- now upload the items -->
    <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
                    AccountKey="$(AccountKey)"
                    AccountName="$(AccountName)"
                    ContainerName="$(ContainerName)"
                    Items="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)" />
  </Target>

  <Target Name="PublishSymbolPackages" Condition="'$(__PublishSymbols)' == 'true' and ('$(OfficialPublish)' != 'true' or '$(__BuildType)' == 'Release')">
    <PropertyGroup>
      <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePathWithSlash)index.json</ExpectedFeedUrl>
    </PropertyGroup>
    <ItemGroup>
      <ItemsToPush Remove="*.nupkg" />
      <ItemsToPush Include="$(SymbolsPackagesPattern)"/>
      <ItemsToPush>
        <RelativeBlobPath>$(RelativePathWithSlash)$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
      </ItemsToPush>
    </ItemGroup>

   <!-- create the container if it doesn't exist -->
    <CreateAzureContainer AccountKey="$(AccountKey)"
                          AccountName="$(AccountName)"
                          ContainerName="$(ContainerName)"
                          IsPublic="true" />

    <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
                    ExpectedFeedUrl="$(ExpectedFeedUrl)"
                    AccountKey="$(AccountKey)"
                    ItemsToPush="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)"
                    ManifestName="$(GitHubRepositoryName)"
                    ManifestBuildId="$(ManifestBuildId)"
                    ManifestBranch="$(ManifestBranch)"
                    ManifestCommit="$(ManifestCommit)" />

    <!-- now upload the items -->
    <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
                    AccountKey="$(AccountKey)"
                    AccountName="$(AccountName)"
                    ContainerName="$(ContainerName)"
                    Items="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)" />
  </Target>

  <Target Name="PublishTestNativeBinaries" Condition="'$(PublishTestNativeBins)' == 'true' and '$(OfficialPublish)' != 'true'">
    <PropertyGroup>
      <RelativePath Condition="'$(RelativePath)' == ''">$(__BuildType)/TestNativeBins</RelativePath>
      <ExpectedFeedUrl Condition="'$(ExpectedFeedUrl)' == ''">https://$(AccountName).blob.core.windows.net/$(ContainerName)/$(RelativePath)/index.json</ExpectedFeedUrl>
    </PropertyGroup>
    <ItemGroup>
      <ItemsToPush Remove="*.nupkg" />
      <ItemsToPush Include="$(TestNativeBinariesPattern)" />
      <ItemsToPush>
        <RelativeBlobPath>$(RelativePath)/$([System.String]::Copy('%(RecursiveDir)%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
      </ItemsToPush>
    </ItemGroup>

    <!-- create the container if it doesn't exist -->
    <CreateAzureContainer AccountKey="$(AccountKey)"
                          AccountName="$(AccountName)"
                          ContainerName="$(ContainerName)"
                          IsPublic="true" />

    <PushToBlobFeed Condition="'$(PublishFlatContainer)' == 'false'"
                    ExpectedFeedUrl="$(ExpectedFeedUrl)"
                    AccountKey="$(AccountKey)"
                    ItemsToPush="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)" />

    <!-- now upload the items -->
    <UploadToAzure  Condition="'$(PublishFlatContainer)' == 'true'"
                    AccountKey="$(AccountKey)"
                    AccountName="$(AccountName)"
                    ContainerName="$(ContainerName)"
                    Items="@(ItemsToPush)"
                    Overwrite="$(OverwriteOnPublish)" />
  </Target>

  <Target Name="Build" DependsOnTargets="PublishPackages;PublishSymbolPackages;PublishTestNativeBinaries"/>
</Project>