summaryrefslogtreecommitdiff
path: root/src/publishwitharcade.proj
blob: a90570c0f5b5eb4217554882d58dd371df5a38af (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
<Project DefaultTargets="PublishPackages">

  <!-- TODO: move properties imported from here into a common props file -->
  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

  <!-- Use an explicit SDK import so that arcade uses the build
       configuration computed in dir.common.props. -->
  <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

  <Import Project="$(NuGetPackageRoot)microsoft.dotnet.build.tasks.feed\$(MicrosoftDotNetBuildTasksFeedVersion)\build\Microsoft.DotNet.Build.Tasks.Feed.targets" />

  <PropertyGroup>
    <!-- Set the TargetFramework just to make the SDK happy -->
    <TargetFramework>net462</TargetFramework>
  </PropertyGroup>

  <Target Name="PublishPackages">

    <ItemGroup>
      <PackagesToPublish Include="$(PackagesBinDir)pkg\*.nupkg" IsShipping="true" />
    </ItemGroup>

    <!-- Managed-only packages are built on each windows leg, but we
         only want to upload them once. Let's arbitrarily upload these
         only from the x64 leg. -->
    <ItemGroup Condition=" '$(BuildArch)' != 'x64' ">
      <PackagesToPublish Remove="$(PackagesBinDir)pkg\Microsoft.NET.Sdk.IL*.nupkg" />
      <PackagesToPublish Remove="$(PackagesBinDir)pkg\Microsoft.TargetingPack.Private.CoreCLR*.nupkg" />
    </ItemGroup>

    <!-- TODO: Investigate whether we can get rid of the transport
         packages entirely. For now, just exclude them from
         publishing. -->
    <ItemGroup>
      <PackagesToPublish Remove="$(PackagesBinDir)pkg\transport*.nupkg" />
    </ItemGroup>

    <ItemGroup>
      <ItemsToPushToBlobFeed Include="@(PackagesToPublish)">
        <ManifestArtifactData Condition="!%(IsShipping)">NonShipping=true</ManifestArtifactData> <!-- TODO: how is this metadata used? -->
      </ItemsToPushToBlobFeed>
    </ItemGroup>

    <Error Condition=" '$(AzureFeedUrl)' == '' " Text="AzureFeedUrl must be set" />
    <Error Condition=" '$(AzureAccountKey)' == '' " Text="AzureAccountKey must be set" />
    <Error Condition=" '$(BUILD_REPOSITORY_URI)' == '' " Text="BUILD_REPOSITORY_URI must be set" />
    <Error Condition=" '$(BUILD_SOURCEBRANCH)' == '' " Text="BUILD_SOURCEBRANCH must be set" />
    <Error Condition=" '$(BUILD_BUILDNUMBER)' == '' " Text="BUILD_BUILDNUMBER must be set" />
    <Error Condition=" '$(BUILD_SOURCEVERSION)' == '' " Text="BUILD_SOURCEVERSION must be set" />


    <PropertyGroup>
      <AssetManifestFilePath>$(ArtifactsLogDir)AssetManifest\$(OSIdentifier)-$(BuildArch)</AssetManifestFilePath>
      <!-- Work around an issue where the repo URI is different on
           OSX, causing the manifests to have different headers, which
           makes publishing to BAR fail later when it tries to merge
           the manifests. -->
      <_TemporaryBuildRepositoryUri>$(BUILD_REPOSITORY_URI)</_TemporaryBuildRepositoryUri>
      <_TemporaryBuildRepositoryUri Condition="'$(BUILD_REPOSITORY_URI)' == 'https://dnceng.visualstudio.com/internal/_git/dotnet-coreclr'" >https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-coreclr</_TemporaryBuildRepositoryUri>
    </PropertyGroup>

    <Message Importance="High" Text="BUILD_REPOSITORY_URI: $(BUILD_REPOSITORY_URI)" />
    <Message Importance="High" Text="_TemporaryBuildRepositoryUri: $(_TemporaryBuildRepositoryUri)" />

    <PushToBlobFeed ExpectedFeedUrl="$(AzureFeedUrl)"
                    AccountKey="$(AzureAccountKey)"
                    ItemsToPush="@(ItemsToPushToBlobFeed)"
                    ManifestBuildData="Location=$(AzureFeedUrl)"
                    ManifestRepoUri="$(_TemporaryBuildRepositoryUri)"
                    ManifestBranch="$(BUILD_SOURCEBRANCH)"
                    ManifestBuildId="$(BUILD_BUILDNUMBER)"
                    ManifestCommit="$(BUILD_SOURCEVERSION)"
                    AssetManifestPath="$(AssetManifestFilePath)" />
  </Target>

</Project>