Resolve portable pdbs from symbols packages

This commit is contained in:
John Luo 2018-02-12 19:55:19 -08:00
parent a8dc9ca37d
commit 23c1fed2e4
5 changed files with 90 additions and 15 deletions

View File

@ -11,7 +11,7 @@
<_DebToolDir>$(MSBuildThisFileDirectory)tools\dotnet-deb-tool-consumer\</_DebToolDir> <_DebToolDir>$(MSBuildThisFileDirectory)tools\dotnet-deb-tool-consumer\</_DebToolDir>
<_SharedFxSourceDir>$(RepositoryRoot).deps\Signed\SharedFx\</_SharedFxSourceDir> <_SharedFxSourceDir>$(RepositoryRoot).deps\Signed\SharedFx\</_SharedFxSourceDir>
<_InstallerSourceDir>$(RepositoryRoot).deps\Installers\</_InstallerSourceDir> <_InstallerSourceDir>$(RepositoryRoot).deps\Installers\</_InstallerSourceDir>
<_SymbolsSourceDir>$(RepositoryRoot).deps\Symbols\</_SymbolsSourceDir> <_SymbolsSourceDir>$(RepositoryRoot).deps\symbols\</_SymbolsSourceDir>
<_DockerRootDir>/opt/code/</_DockerRootDir> <_DockerRootDir>/opt/code/</_DockerRootDir>
<_InstallersOutputDir>$(ArtifactsDir)installers\</_InstallersOutputDir> <_InstallersOutputDir>$(ArtifactsDir)installers\</_InstallersOutputDir>
<!-- 3B = semicolon in ASCII --> <!-- 3B = semicolon in ASCII -->

View File

@ -284,16 +284,25 @@
<ItemGroup> <ItemGroup>
<IgnoredAssemblies Include="@(AppPublishAssemblies);@(AllPublishAssemblies)" Condition="'%(AssetType)' == 'native' OR '%(AssetType)' == 'resources'" /> <IgnoredAssemblies Include="@(AppPublishAssemblies);@(AllPublishAssemblies)" Condition="'%(AssetType)' == 'native' OR '%(AssetType)' == 'resources'" />
<AppRuntimeAssemblies Include="@(AppPublishAssemblies)" Condition="'%(AssetType)' == 'runtime'"> <_AppRuntimeAssemblies Include="@(AppPublishAssemblies)" Condition="'%(AssetType)' == 'runtime'">
<SymbolsPackageFilename>%(PackageName).%(PackageVersion).symbols.nupkg</SymbolsPackageFilename>
<PortablePDB>%(RootDir)%(Directory)%(Filename).pdb</PortablePDB> <PortablePDB>%(RootDir)%(Directory)%(Filename).pdb</PortablePDB>
</AppRuntimeAssemblies> </_AppRuntimeAssemblies>
<AllRuntimeAssemblies Include="@(AllPublishAssemblies)" Exclude="@(AppRuntimeAssemblies)" Condition="'%(AssetType)' == 'runtime'"> <_AllRuntimeAssemblies Include="@(AllPublishAssemblies)" Exclude="@(_AppRuntimeAssemblies)" Condition="'%(AssetType)' == 'runtime'">
<SymbolsPackageFilename>%(PackageName).%(PackageVersion).symbols.nupkg</SymbolsPackageFilename>
<PortablePDB>%(RootDir)%(Directory)%(Filename).pdb</PortablePDB> <PortablePDB>%(RootDir)%(Directory)%(Filename).pdb</PortablePDB>
</AllRuntimeAssemblies> </_AllRuntimeAssemblies>
<OtherAssemblies Include="@(AppPublishAssemblies);@(AllPublishAssemblies)" Exclude="@(IgnoredAssemblies);@(AppRuntimeAssemblies);@(AllRuntimeAssemblies)" /> <OtherAssemblies Include="@(AppPublishAssemblies);@(AllPublishAssemblies)" Exclude="@(IgnoredAssemblies);@(_AppRuntimeAssemblies);@(_AllRuntimeAssemblies)" />
<_AssembliesToCrossgen Include="$(SharedFxIntermediateOutputPath)**\*.dll" /> <_AssembliesToCrossgen Include="$(SharedFxIntermediateOutputPath)**\*.dll" />
</ItemGroup> </ItemGroup>
<RepoTasks.ResolveSymbolsRecursivePath Symbols="@(_AppRuntimeAssemblies)">
<Output TaskParameter="Symbols" ItemName="AppRuntimeAssemblies" />
</RepoTasks.ResolveSymbolsRecursivePath>
<RepoTasks.ResolveSymbolsRecursivePath Symbols="@(_AllRuntimeAssemblies)">
<Output TaskParameter="Symbols" ItemName="AllRuntimeAssemblies" />
</RepoTasks.ResolveSymbolsRecursivePath>
<Error Text="Unaccounted shared framework assemblies found: @(OtherAssemblies). Assemblies must be included as runtime assemblies or marked as ignored." Condition="'@(OtherAssemblies)' != ''" /> <Error Text="Unaccounted shared framework assemblies found: @(OtherAssemblies). Assemblies must be included as runtime assemblies or marked as ignored." Condition="'@(OtherAssemblies)' != ''" />
<!-- Compute the intersection of crossgen candidates and native/resources assemblies as the set of assemblies to skip crossgen --> <!-- Compute the intersection of crossgen candidates and native/resources assemblies as the set of assemblies to skip crossgen -->
@ -373,7 +382,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<_SymbolFiles Include="$(SymbolsWorkDir)**\*.pdb;$(SymbolsWorkDir)**\*.map" /> <_SymbolFiles Include="$(SymbolsWorkDir)**\*.pdb;$(SymbolsWorkDir)**\*.map;$(SymbolsWorkDir)**\*.dll" />
<SymbolFiles Include="@(_SymbolFiles)"> <SymbolFiles Include="@(_SymbolFiles)">
<PackagePath>%(RecursiveDir)%(Filename)%(Extension)</PackagePath> <PackagePath>%(RecursiveDir)%(Filename)%(Extension)</PackagePath>
</SymbolFiles> </SymbolFiles>
@ -396,17 +405,40 @@
<Target Name="PackSharedFx" DependsOnTargets="DefineSharedFxPrerequisites" > <Target Name="PackSharedFx" DependsOnTargets="DefineSharedFxPrerequisites" >
<PropertyGroup> <PropertyGroup>
<AppSharedFxCrossgenDirectory>$(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.App\$(PackageVersion)\</AppSharedFxCrossgenDirectory>
<AllSharedFxCrossgenDirectory>$(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.All\$(PackageVersion)\</AllSharedFxCrossgenDirectory>
<AppSharedFxSymbolsDirectory>$(_WorkRoot)Symbols\Microsoft.AspNetCore.App\</AppSharedFxSymbolsDirectory> <AppSharedFxSymbolsDirectory>$(_WorkRoot)Symbols\Microsoft.AspNetCore.App\</AppSharedFxSymbolsDirectory>
<AllSharedFxSymbolsDirectory>$(_WorkRoot)Symbols\Microsoft.AspNetCore.All\</AllSharedFxSymbolsDirectory> <AllSharedFxSymbolsDirectory>$(_WorkRoot)Symbols\Microsoft.AspNetCore.All\</AllSharedFxSymbolsDirectory>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<CrossGenOutput Include="$(SharedFxCrossGenDirectory)**\*.dll" /> <AppCrossGenOutput Include="$(AppSharedFxCrossgenDirectory)**\*.dll" />
<AppCrossGenSymbols Include="$(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.App\$(PackageVersion)\**\*" Exclude="@(CrossGenOutput)" /> <AllCrossGenOutput Include="$(AllSharedFxCrossgenDirectory)**\*.dll" />
<AllCrossGenSymbols Include="$(SharedFxCrossGenDirectory)shared\Microsoft.AspNetCore.All\$(PackageVersion)\**\*" Exclude="@(CrossGenOutput)" /> <AppCrossGenSymbols Include="$(AppSharedFxCrossgenDirectory)**\*" Exclude="@(AppCrossGenOutput)" />
<AllCrossGenSymbols Include="$(AllSharedFxCrossgenDirectory)**\*" Exclude="@(AllCrossGenOutput)" />
</ItemGroup> </ItemGroup>
<!-- Copy over PDBs --> <!-- Extract symbols package and copy over PDBs -->
<UnzipArchive
File="$(_SymbolsSourceDir)%(AppPortablePDBsToPublish.SymbolsPackageFilename)"
Destination="$(_WorkRoot)SymbolsPackages\%(AppPortablePDBsToPublish.SymbolsPackageFilename)"
Condition="Exists('$(_SymbolsSourceDir)%(AppPortablePDBsToPublish.SymbolsPackageFilename)')" />
<UnzipArchive
File="$(_SymbolsSourceDir)%(AllPortablePDBsToPublish.SymbolsPackageFilename)"
Destination="$(_WorkRoot)SymbolsPackages\%(AllPortablePDBsToPublish.SymbolsPackageFilename)"
Condition="Exists('$(_SymbolsSourceDir)%(AllPortablePDBsToPublish.SymbolsPackageFilename)')" />
<Copy
SourceFiles="$(_WorkRoot)SymbolsPackages\%(AppPortablePDBsToPublish.SymbolsPackageFilename)%(AppPortablePDBsToPublish.SymbolsRecursivePath)"
DestinationFolder="$(AppSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
OverwriteReadOnlyFiles="True"
Condition="Exists('$(_WorkRoot)SymbolsPackages\%(AppPortablePDBsToPublish.SymbolsPackageFilename)\%(AppPortablePDBsToPublish.SymbolsRecursivePath)')" />
<Copy
SourceFiles="$(_WorkRoot)SymbolsPackages\%(AllPortablePDBsToPublish.SymbolsPackageFilename)%(AllPortablePDBsToPublish.SymbolsRecursivePath)"
DestinationFolder="$(AllSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
OverwriteReadOnlyFiles="True"
Condition="Exists('$(_WorkRoot)SymbolsPackages\%(AllPortablePDBsToPublish.SymbolsPackageFilename)\%(AllPortablePDBsToPublish.SymbolsRecursivePath)')" />
<!-- Copy over DLLs and PDBs -->
<Copy <Copy
SourceFiles="%(AppPortablePDBsToPublish.PortablePDB)" SourceFiles="%(AppPortablePDBsToPublish.PortablePDB)"
DestinationFolder="$(AppSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1" DestinationFolder="$(AppSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
@ -425,6 +457,14 @@
SourceFiles="@(AllCrossGenSymbols)" SourceFiles="@(AllCrossGenSymbols)"
DestinationFolder="$(AllSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1" DestinationFolder="$(AllSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
OverwriteReadOnlyFiles="True" /> OverwriteReadOnlyFiles="True" />
<Copy
SourceFiles="$(AppSharedFxCrossgenDirectory)%(AppCrossGenOutput.RecursiveDir)%(AppCrossGenOutput.FileName)%(AppCrossGenOutput.Extension)"
DestinationFolder="$(AppSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
OverwriteReadOnlyFiles="True" />
<Copy
SourceFiles="$(AllSharedFxCrossgenDirectory)%(AllCrossGenOutput.RecursiveDir)%(AllCrossGenOutput.FileName)%(AllCrossGenOutput.Extension)"
DestinationFolder="$(AllSharedFxSymbolsDirectory)runtimes\$(SharedFxRID)\lib\netcoreapp2.1"
OverwriteReadOnlyFiles="True" />
<!-- Create symbols nupkg --> <!-- Create symbols nupkg -->
<PropertyGroup> <PropertyGroup>
@ -440,10 +480,14 @@
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildSharedFxSymbols" Properties="$(AllSymbolsArguments)" /> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildSharedFxSymbols" Properties="$(AllSymbolsArguments)" />
<!-- Replace assemblies with crossgen output --> <!-- Replace assemblies with crossgen output -->
<Copy <!-- <Copy
SourceFiles="$(SharedFxCrossGenDirectory)%(CrossGenOutput.RecursiveDir)%(CrossGenOutput.FileName)%(CrossGenOutput.Extension)" SourceFiles="$(AppSharedFxCrossgenDirectory)%(AppCrossGenOutput.RecursiveDir)%(AppCrossGenOutput.FileName)%(AppCrossGenOutput.Extension)"
DestinationFiles="$(SharedFxIntermediateOutputPath)%(CrossGenOutput.RecursiveDir)%(CrossGenOutput.FileName)%(CrossGenOutput.Extension)" DestinationFiles="$(SharedFxIntermediateOutputPath)%(AppCrossGenOutput.RecursiveDir)%(AppCrossGenOutput.FileName)%(AppCrossGenOutput.Extension)"
OverwriteReadOnlyFiles="True" /> OverwriteReadOnlyFiles="True" />
<Copy
SourceFiles="$(AllSharedFxCrossgenDirectory)%(AllCrossGenOutput.RecursiveDir)%(AllCrossGenOutput.FileName)%(AllCrossGenOutput.Extension)"
DestinationFiles="$(SharedFxIntermediateOutputPath)%(AllCrossGenOutput.RecursiveDir)%(AllCrossGenOutput.FileName)%(AllCrossGenOutput.Extension)"
OverwriteReadOnlyFiles="True" /> -->
<ItemGroup> <ItemGroup>
<OutputZipFiles Include="$(SharedFxIntermediateOutputPath)**\*" /> <OutputZipFiles Include="$(SharedFxIntermediateOutputPath)**\*" />

View File

@ -21,6 +21,7 @@
<UsingTask TaskName="RepoTasks.ResolveHostingStartupPackages" AssemblyFile="$(_RepoTaskAssembly)" /> <UsingTask TaskName="RepoTasks.ResolveHostingStartupPackages" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.TrimDeps" AssemblyFile="$(_RepoTaskAssembly)" /> <UsingTask TaskName="RepoTasks.TrimDeps" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.VerifyCoherentVersions" AssemblyFile="$(_RepoTaskAssembly)" /> <UsingTask TaskName="RepoTasks.VerifyCoherentVersions" AssemblyFile="$(_RepoTaskAssembly)" />
<UsingTask TaskName="RepoTasks.ResolveSymbolsRecursivePath" AssemblyFile="$(_RepoTaskAssembly)" />
<!-- tools from dotnet-buildtools --> <!-- tools from dotnet-buildtools -->
<PropertyGroup> <PropertyGroup>

View File

@ -0,0 +1,29 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using RepoTasks.Utilities;
namespace RepoTasks
{
public class ResolveSymbolsRecursivePath : Task
{
[Required]
[Output]
public ITaskItem[] Symbols { get; set; }
public override bool Execute()
{
foreach (var symbol in Symbols)
{
var fullPath = symbol.GetMetadata("PortablePDB");
symbol.SetMetadata("SymbolsRecursivePath", fullPath.Substring(fullPath.IndexOf($"{Path.DirectorySeparatorChar}lib{Path.DirectorySeparatorChar}")));
}
return true;
}
}
}

View File

@ -15,7 +15,8 @@
<tags>aspnetcore</tags> <tags>aspnetcore</tags>
</metadata> </metadata>
<files> <files>
<file src="**\*.pdb" target="" /> <file src="**\*.dll" target="" />
<file src="**\*.map" target="" /> <file src="**\*.map" target="" />
<file src="**\*.pdb" target="" />
</files> </files>
</package> </package>