Skip to content

Commit

Permalink
Make InstallRuntimeComponentToFinalDestination use NativeOutputPath f…
Browse files Browse the repository at this point in the history
…or copying to runtime output (#100782)

The InstallRuntimeComponentToFinalDestination target from infrastructure for NativeAOT-ed runtime components (#98565) copies the component and symbol files to the runtime output directory. Make the target use NativeOutputPath for the for the library and symbol path instead of the ones copied to the publish directory. They should be available after LinkNative.

This was working in the runtime repo because the projects under src/native/managed are currently using the ILCompiler package corresponding to the SDK being used to build the repo. That version of the package doesn't have #98342 - the native-library.targets were relying the symbols already being copied before _CopyAotSymbols was run.
  • Loading branch information
elinor-fung authored Apr 9, 2024
1 parent f6f9199 commit a8c2a5e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/native/managed/native-library.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
</Target>

<Target Name="StripLibraryLikeCoreCLRBuild"
DependsOnTargets="SetupOSSpecificProps;CopyNativeBinary;StripLibraryLikeCoreCLRSetupPaths"
DependsOnTargets="SetupOSSpecificProps;LinkNative;StripLibraryLikeCoreCLRSetupPaths"
Condition="'$(IsRuntimeComponent)' == 'true' and '$(TargetsWindows)' != 'true'"
Inputs="$(PublishDir)$(TargetName)$(NativeBinaryExt)"
Inputs="$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)"
Outputs="$(StripSourceFile);$(StripDestinationFile)">
<Error Text="Do not set StripSymbols to true - runtime components stripping is controlled by native-library.targets" Condition="'$(StripSymbols)' == 'true'" />

<Message Importance="Normal" Text="Stripping $(PublishDir)$(TargetName)$(NativeBinaryExt) into $(StripSourceFile) and $(StripDestinationFile)" />
<Message Importance="Normal" Text="Stripping $(NativeOutputPath)$(TargetName)$(NativeBinaryExt) into $(StripSourceFile) and $(StripDestinationFile)" />

<!-- copy from the published/ subfolder to the stripped/ subfolder -->
<Copy SourceFiles="$(PublishDir)$(TargetName)$(NativeBinaryExt)"
<!-- copy from the native/ subfolder to the stripped/ subfolder -->
<Copy SourceFiles="$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)"
DestinationFolder="$(StrippedOutputPath)"
SkipUnchangedFiles="true" />

Expand All @@ -68,8 +68,8 @@
</Target>

<Target Name="InstallRuntimeComponentToFinalDestination"
AfterTargets="CopyNativeBinary"
DependsOnTargets="CopyNativeBinary;StripLibraryLikeCoreCLRBuild" Condition="'$(IsRuntimeComponent)' == 'true'">
AfterTargets="LinkNative"
DependsOnTargets="LinkNative;StripLibraryLikeCoreCLRBuild" Condition="'$(IsRuntimeComponent)' == 'true'">
<Error Text="Set at least one @InstallRuntimeComponentDestination item" Condition="@(InstallRuntimeComponentDestination->Count()) == 0" />

<PropertyGroup>
Expand All @@ -87,8 +87,8 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<CopyFinalFiles Include="$(PublishDir)$(TargetName)$(NativeBinaryExt)" />
<CopyFinalFilesPDB Include="$(PublishDir)$(TargetName).pdb" />
<CopyFinalFiles Include="$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)" />
<CopyFinalFilesPDB Include="$(NativeOutputPath)$(TargetName).pdb" />
</ItemGroup>

<Message Importance="Normal" Text="Installing @(CopyFinalFiles) into %(_NormalizedInstallRuntimeComponentDest.Identity)"/>
Expand Down

0 comments on commit a8c2a5e

Please sign in to comment.