summaryrefslogtreecommitdiff
path: root/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.20113.5/tools/SdkTasks/PublishToSymbolServers.proj
blob: eedd1cf480c0fbba50385f80d5d093198dc6e881 (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
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Execute">
  <!--
    This MSBuild file is intended to be used as the body of the default 
    publishing release pipeline. The release pipeline will use this file
    to invoke the PublishSymbols tasks to publish symbols to MSDL and SymWeb.
  
    Parameters:
  
      - PDBArtifactsDirectory   : Full path to directory containing PDB files to be published.
      - BlobBasePath            : Full path containing *.symbols.nupkg packages to be published.
      - DotNetSymbolServerTokenMsdl   : PAT to access MSDL.
      - DotNetSymbolServerTokenSymWeb : PAT to access SymWeb.
      - DotNetSymbolExpirationInDays  : Expiration days for published packages. Default is 3650.
      - SymbolPublishingExclusionsFile : Path to file containing exclusion list to be used by Symbol Uploader.
  -->

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <RestoreSources>
      https://api.nuget.org/v3/index.json;
      https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
      https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json;
      https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json
    </RestoreSources>
  </PropertyGroup>

  <Target Name="Execute">
    <ItemGroup>
      <FilesToPublishToSymbolServer Include="$(PDBArtifactsDirectory)\**\*.pdb"/>
      <PackagesToPublishToSymbolServer Include="$(BlobBasePath)\*.symbols.nupkg"/>

      <!--
        These packages from Arcade-Services include some native libraries that
        our current symbol uploader can't handle. Below is a workaround until
        we get issue: https://github.com/dotnet/arcade/issues/2457 sorted.
      -->
      <PackagesToPublishToSymbolServer Remove="$(BlobBasePath)\Microsoft.DotNet.Darc.*" />
      <PackagesToPublishToSymbolServer Remove="$(BlobBasePath)\Microsoft.DotNet.Maestro.Tasks.*" />
    </ItemGroup>

    <PropertyGroup>
      <DotNetSymbolExpirationInDays Condition="'$(DotNetSymbolExpirationInDays)' == ''">3650</DotNetSymbolExpirationInDays>
      <PublishToSymbolServer>true</PublishToSymbolServer>
      <PublishToSymWeb Condition="'$(PublishToSymWeb)' == ''">true</PublishToSymWeb>
      <PublishToMSDL Condition="'$(PublishToMSDL)' == ''">true</PublishToMSDL>
      <PublishToSymbolServer Condition="'@(FilesToPublishToSymbolServer)' == '' and '@(PackagesToPublishToSymbolServer)' == ''">false</PublishToSymbolServer>
    </PropertyGroup>

    <Message
      Importance="High"
      Text="No symbol file(s) were found to publish."
      Condition="'@(FilesToPublishToSymbolServer)' == ''" />

    <Message
      Importance="High"
      Text="No symbol package(s) were found to publish."
      Condition="'@(PackagesToPublishToSymbolServer)' == ''" />

    <ReadLinesFromFile
      File="$(SymbolPublishingExclusionsFile)"
      Condition="'$(SymbolPublishingExclusionsFile)' != '' and Exists($(SymbolPublishingExclusionsFile))">
      <Output
          TaskParameter="Lines"
          ItemName="PackageExcludeFiles"/>
    </ReadLinesFromFile>

    <Message
      Text="Going to publish this package -> %(PackagesToPublishToSymbolServer.Identity)." />

    <Message
      Text="Going to publish this file -> %(FilesToPublishToSymbolServer.Identity)." />

    <Message
      Text="Going to ignore this file -> %(PackageExcludeFiles.Identity)." />
    
    <!-- Symbol Uploader: MSDL -->
    <Message Importance="High" Text="Publishing symbol packages to MSDL ..." Condition="$(PublishToMSDL)" />
    <PublishSymbols PackagesToPublish="@(PackagesToPublishToSymbolServer)"
                    FilesToPublish="@(FilesToPublishToSymbolServer)"
                    PackageExcludeFiles="@(PackageExcludeFiles)"
                    PersonalAccessToken="$(DotNetSymbolServerTokenMsdl)"
                    SymbolServerPath="https://microsoftpublicsymbols.artifacts.visualstudio.com/DefaultCollection"
                    ExpirationInDays="$(DotNetSymbolExpirationInDays)"
                    VerboseLogging="true"
                    DryRun="false"
                    ConvertPortablePdbsToWindowsPdbs="false"
                    PdbConversionTreatAsWarning=""
                    Condition="$(PublishToSymbolServer) and $(PublishToMSDL)"/>

    <!-- 
      Symbol Uploader: SymWeb 
      Watson, VS insertion testings and the typical internal dev usage require SymWeb.
      Currently we need to call the task twice (https://github.com/dotnet/core-eng/issues/3489).
    -->
    <Message Importance="High" Text="Publishing symbol packages to SymWeb ..." Condition="$(PublishToSymWeb)" />
    <PublishSymbols PackagesToPublish="@(PackagesToPublishToSymbolServer)"
                    FilesToPublish="@(FilesToPublishToSymbolServer)"
                    PackageExcludeFiles="@(PackageExcludeFiles)"
                    PersonalAccessToken="$(DotNetSymbolServerTokenSymWeb)"
                    SymbolServerPath="https://microsoft.artifacts.visualstudio.com/DefaultCollection"
                    ExpirationInDays="$(DotNetSymbolExpirationInDays)"
                    VerboseLogging="true"
                    DryRun="false"
                    ConvertPortablePdbsToWindowsPdbs="false"
                    PdbConversionTreatAsWarning=""
                    Condition="$(PublishToSymbolServer) and $(PublishToSymWeb)"/>
  </Target>

  <ItemGroup>
    <PackageReference Include="Microsoft.SymbolUploader.Build.Task" Version="$(MicrosoftSymbolUploaderBuildTaskVersion)" />
  </ItemGroup>
</Project>