Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable PDB archives for source-build #14015

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
DependsOnTargets="
GetCategorizedIntermediateNupkgContents;
GetSupplementalIntermediateNupkgManifest;
CreateNonShippingNupkgList"
GetSymbolsArchive;
GetNonShippingNupkgList"
BeforeTargets="_GetPackageFiles">
<ItemGroup>
<Content Include="@(IntermediatePackageFile->WithMetadataValue('Category', '$(SupplementalIntermediateNupkgCategory)'))" />
Expand All @@ -79,8 +80,46 @@
</ItemGroup>
</Target>

<!-- Create symbols archive and include it in the "main" intermediate nupkg. -->
<Target Name="GetSymbolsArchive" Condition="'$(SupplementalIntermediateNupkgCategory)' == ''">
MichaelSimons marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<SymbolsRoot>$(CurrentRepoSourceBuildArtifactsDir)</SymbolsRoot>
<!-- Fall back to repo root for source-build-externals or repos that don't have the regular SymbolsRoot as defined above -->
<SymbolsRoot Condition="!Exists('$(SymbolsRoot)') or '$(GitHubRepositoryName)' == 'source-build-externals'">$(RepoRoot)</SymbolsRoot>
<SymbolsArchiveLocation>$(CurrentRepoSourceBuildArtifactsPackagesDir)</SymbolsArchiveLocation>
<SymbolsArchiveLocation Condition="'$(GitHubRepositoryName)' == 'nuget-client'">$(PackageOutputPath)</SymbolsArchiveLocation>
<SymbolsList>$(SymbolsArchiveLocation)\symbols.lst</SymbolsList>
<SymbolsArchivePrefix>Symbols.</SymbolsArchivePrefix>
<SymbolsArchiveSuffix>.$(Version).$(TargetRid)</SymbolsArchiveSuffix>
<SymbolsArchiveName>$(SymbolsArchiveLocation)$(SymbolsArchivePrefix)$(GitHubRepositoryName)$(SymbolsArchiveSuffix).tar.gz</SymbolsArchiveName>
</PropertyGroup>

<ItemGroup>
<AbsoluteSymbolPath Include="$(SymbolsRoot)\**\obj\**\*.pdb" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies if this is a stupid question, but is there any risk of a not-just-built pdb file being available at this path? Is there any support for posioning pdb files to catch potential leaks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obj folder would contain content of just compiled sources. bin folder would also contain dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically seem ItemGroups name in plural form as the are a type of collection. e.g. AbsoluteSymbolPaths

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen both plural and singular in use and can't seem to find any guidance for .NET codebase. It appears that even source-build infra is inconsistent, i.e.

Singular:

<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.nupkg" />

<Content Include="@(IntermediatePackageFile->WithMetadataValue('Category', '$(SupplementalIntermediateNupkgCategory)'))" />

Plural:

<SourceBuildFilesToCopy Include="$(RepoRoot)/**/*" />

<SourceBuiltPackageFiles Include="$(CurrentRepoSourceBuiltNupkgCacheDir)**/*.nupkg" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I acknowledge there are inconsistencies in the code base. I asked to see if you had reasons for using singular. I personally find the plural form can help the readability therefore tend to favor that form as a general rule.

<AbsoluteSymbolPath Update="@(AbsoluteSymbolPath)" Condition="'@(AbsoluteSymbolPath)' != ''">
<RelativePath>$([MSBuild]::MakeRelative($(SymbolsRoot), %(FullPath)))</RelativePath>
</AbsoluteSymbolPath>
</ItemGroup>

<WriteLinesToFile
File="$(SymbolsList)"
Lines="@(AbsoluteSymbolPath->'%(RelativePath)')"
Overwrite="true"
Condition="'@(AbsoluteSymbolPath)' != ''" />

<Exec Command="tar --numeric-owner -czf $(SymbolsArchiveName) --files-from=$(SymbolsList)"
WorkingDirectory="$(SymbolsRoot)" Condition="Exists($(SymbolsList))" />
<Message Importance="High" Text="Packaged symbols to $(SymbolsArchiveName)" Condition="Exists($(SymbolsArchiveName))" />

<ItemGroup Condition="Exists($(SymbolsArchiveName))">
<Content Include="$(SymbolsArchiveName)" PackagePath="artifacts" />
</ItemGroup>

<Delete Files="$(SymbolsList)" Condition="Exists($(SymbolsList))" />
</Target>

<!-- Create a list of non-shipping packages and include it in the intermediate package. -->
<Target Name="CreateNonShippingNupkgList"
<Target Name="GetNonShippingNupkgList"
Condition="'@(IntermediateNonShippingNupkgFile)' != ''">
<PropertyGroup>
<!-- The prefix needs to match what's defined in tarball source-build infra. Consider using a single property, in the future. -->
Expand Down
Loading