summaryrefslogtreecommitdiff
path: root/src/.nuget/dir.targets
blob: 49e550a4b769e2fb14c7a10fe3b805d03288a7c8 (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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">


  <Target Name="VerifyVCRedist" BeforeTargets="GetSymbolPackageFiles" Condition="'$(_runtimeOSFamily)' == 'win'">
    <Error Condition="'$(UniversalCRTSDKDir)' == ''" Text="Unable to find VC Redist binaries - check that UniversalCRTSDKDir environment variable is set" />
  </Target>
  <!--
    Finds symbol files and injects them into the package build.
  -->
  <Target Name="GetSymbolPackageFiles" BeforeTargets="GetPackageFiles">
    <ItemGroup Condition="'$(SymbolFileExtension)' != ''">
      <AdditionalLibPackageExcludes Include="%2A%2A\%2A$(SymbolFileExtension)"/>
    </ItemGroup>

    <ItemGroup>
      <AdditionalLibPackageExcludes Include="@(LongNameFile -> '%(TargetPath)')" />
    </ItemGroup>

    <ItemGroup>
      <NativeWithSymbolFile Include="@(NativeBinary)">
        <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
      </NativeWithSymbolFile>
      <!-- Using lib/netstandard1.0 here.  There is no TFM for this since it is a runtime itself. -->
      <NativeWithSymbolFile Include="@(ArchitectureSpecificLibFile)">
        <TargetPath>runtimes/$(PackageTargetRuntime)/lib/netstandard1.0</TargetPath>
      </NativeWithSymbolFile>
      <NativeWithSymbolFile Include="@(ArchitectureSpecificToolFile)">
        <TargetPath>tools</TargetPath>
      </NativeWithSymbolFile>
    </ItemGroup>

    <ItemGroup Condition="'$(HasCrossTargetComponents)'=='true'">
      <NativeWithSymbolFile Include="@(CrossArchitectureSpecificNativeFileAndSymbol)">
        <TargetPath>runtimes/$(CrossTargetComponentFolder)_$(PackagePlatform)/native</TargetPath>
      </NativeWithSymbolFile>
      <NativeWithSymbolFile Include="@(CrossArchitectureSpecificToolFile)">
        <TargetPath>tools/$(CrossTargetComponentFolder)_$(PackagePlatform)</TargetPath>
      </NativeWithSymbolFile>
    </ItemGroup>

    <ItemGroup>
      <File Include="@(NativeWithSymbolFile)" />
      <File Include="@(LongNameFile)">
        <IsSymbolFile>true</IsSymbolFile>
      </File>
    </ItemGroup>

    <ItemGroup>
      <!-- On Windows, trim ".dll" before adding ".pdb". -->
      <WindowsNativeFile Include="@(NativeWithSymbolFile)"
                         Condition="'%(NativeWithSymbolFile.Extension)'=='.dll' OR '%(NativeWithSymbolFile.Extension)'=='.exe'" />
      <WindowsSymbolFile Include="@(WindowsNativeFile -> '%(RootDir)%(Directory)PDB\%(Filename).pdb')" />

      <!--
        Search for all xplat symbol file extensions on every xplat native binary. Some binaries have
        no ".so" or ".dylib" extension, so we can't tell which convention its symbol files would
        use. On xplat, the symbol extension is simply appended. 
      -->
      <NonWindowsNativeFile Include="@(NativeWithSymbolFile)"
                            Exclude="@(WindowsNativeFile)" />

      <NonWindowsSymbolFile Include="@(NonWindowsNativeFile -> '%(Identity)$(SymbolFileExtension)')" />

      <ExistingWindowsSymbolFile Include="@(WindowsSymbolFile)" Condition="Exists('%(Identity)')" />
      <ExistingNonWindowsSymbolFile Include="@(NonWindowsSymbolFile)" Condition="Exists('%(Identity)') AND '$(SkipPackagingXplatSymbols)'!='true'" />

      <!-- Include all found symbols. -->
      <File Include="@(ExistingWindowsSymbolFile);@(ExistingNonWindowsSymbolFile)">
        <IsSymbolFile>true</IsSymbolFile>
      </File>
    </ItemGroup>

    <PropertyGroup>
      <NeedsPlaceholderPdb Condition="'@(ExistingNonWindowsSymbolFile)'!='' AND '@(ExistingWindowsSymbolFile)'==''">true</NeedsPlaceholderPdb>
    </PropertyGroup>

    <ItemGroup>
      <File Include="$(MSBuildThisFileDirectory)\_.pdb"
            Condition="'$(NeedsPlaceholderPdb)'=='true' AND '$(PackageTargetRuntime)'!=''">
        <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
        <IsSymbolFile>true</IsSymbolFile>
      </File>
    </ItemGroup>
  </Target>

  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)\.., dir.targets))\dir.targets" />
</Project>