Skip to content

Commit

Permalink
Fix CoreLib fast up-to-date check
Browse files Browse the repository at this point in the history
Fixes dotnet#68698

CoreLib's fast up-to-date check was broken because the output pdb was
moved into a different folder. Changing this to use a copy task instead
and consolidate the two targets into one.

I couldn't find a publicly exposed property that allows to change the
pdb's output path, hence I decided to copy.
  • Loading branch information
ViktorHofer committed May 12, 2022
1 parent d3af492 commit 7bf7cf9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
44 changes: 17 additions & 27 deletions src/coreclr/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,26 @@
<Import Project="..\..\Directory.Build.targets" />

<ItemGroup>
<BuiltBinary Include="$(TargetPath)" />
<_AllPdbs Include="@(BuiltBinary -> '%(RootDir)%(Directory)%(Filename).pdb')">
<FolderName>$([System.IO.Directory]::GetParent(`%(Identity)`).Name)</FolderName>
</_AllPdbs>
<_DebugSymbolToMove Include="@(DebugSymbolsProjectOutputGroupOutput->Metadata('FinalOutputPath'))"
FolderName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
<_DebugSymbolToMoveToExclude Include="@(_DebugSymbolToMove->WithMetadataValue('FolderName', 'aotsdk'))" />
<_DebugSymbolToMoveToUpdate Include="@(_DebugSymbolToMove)"
Exclude="@(_DebugSymbolToMoveToExclude)" />
<!-- Remove the FolderName metadata for projects that don't reside under an aotsdk folder. -->
<_DebugSymbolToMove Update="@(_DebugSymbolToMoveToUpdate)"
FolderName="" />
<_DebugSymbolToMove Update="@(_DebugSymbolToMove)"
Destination="$(RuntimeBinDir)PDB\%(FolderName)\%(Filename)%(Extension)" />
</ItemGroup>

<!-- Target used to consolidate all PDBs into a single location, except the aotsdk
PDBs, as S.P.C will overwrite the coreclr PDBs -->
<!-- Consolidate all PDBs into a single location, except the aotsdk PDBs, as S.P.C will overwrite the coreclr PDBs. -->
<Target Name="MoveSymbolFiles"
AfterTargets="Build"
Condition="Exists(@(_AllPdbs))"
Inputs="@(_AllPdbs)"
Outputs="@(_AllPdbs -> '$(RuntimeBinDir)PDB/%(Filename).pdb')">

<Move SourceFiles="@(_AllPdbs)"
DestinationFolder="$(RuntimeBinDir)PDB"
Condition="'%(_AllPdbs.FolderName)' != 'aotsdk'" />

</Target>

<Target Name="MoveAotSymbolFiles"
AfterTargets="Build"
Condition="Exists(@(_AllPdbs))"
Inputs="@(_AllPdbs)"
Outputs="@(_AllPdbs -> '$(RuntimeBinDir)PDB/aotsdk/%(Filename).pdb')">

<Move SourceFiles="@(_AllPdbs)"
DestinationFolder="$(RuntimeBinDir)PDB/aotsdk"
Condition="'%(_AllPdbs.FolderName)' == 'aotsdk'" />

AfterTargets="CopyFilesToOutputDirectory"
Inputs="@(_DebugSymbolToMove)"
Outputs="@(_DebugSymbolToMove->Metadata('Destination'))">
<Copy SourceFiles="@(_DebugSymbolToMove)"
DestinationFiles="@(_DebugSymbolToMove->Metadata('Destination'))"
UseHardlinksIfPossible="false" />
</Target>

<!-- Import targets here to have TargetPath and other macros defined. Limit to CoreLib. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>

<!-- Force System.Private.CoreLib.dll into a special IL output directory -->
<OutputPath>$(RuntimeBinDir)/IL/</OutputPath>
<OutputPath>$(RuntimeBinDir)IL\</OutputPath>
<Configurations>Debug;Release;Checked</Configurations>
<Platforms>x64;x86;arm;arm64</Platforms>

Expand Down

0 comments on commit 7bf7cf9

Please sign in to comment.