Skip to content

Commit

Permalink
[d17-2] [msbuild] Use the full path to the symbols list file. Fixes #…
Browse files Browse the repository at this point in the history
…15046. (#15307)

Give the full path to the symbols list file in the extension project to the
main project, so that strip can find it.

When building a solution remotely from Windows, we can't compute a relative
path between projects, because they're laid out differently on disk. This
means that we have to use full paths when passing paths between projects (such
as the path to the symbol list file).

Fixes #15046.

Backport of #15105

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
  • Loading branch information
1 parent 4c048da commit 50bab4c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,17 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<Output TaskParameter="Items" ItemName="_WatchAppPostProcessingItems" />
</ReadItemsFromFile>

<!--
For App Extensions, we delay running dsymutil & strip until it has been copied into the main app bundle.
This means that we need the path to the symbols list in the main app's project, and it needs to be a full path when executing remotely from Windows,
because the projects are not in the same position relative to eachother when building remotely (so a relative path doesn't work).
This needs to be executed in a task (and not here inside the target) so the execution always occur on the mac, even when the build is done from Windows.
Ref: https://github.com/xamarin/xamarin-macios/issues/15046
-->
<GetFullPath SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" RelativePath="$(_MtouchSymbolsList)">
<Output TaskParameter="FullPath" PropertyName="_SymbolsListFullPath" />
</GetFullPath>

<ItemGroup>
<!-- add frameworks, with the path relative to the app bundle -->
<_PostProcessingItem Include="@(_ResolvedNativeReference->'$(_AppBundleName)$(AppBundleExtension/$(_AppFrameworksRelativePath)%(Filename).framework/%(Filename)')" Condition="'%(_ResolvedNativeReference.Kind' == 'Framework'">
Expand All @@ -2384,7 +2395,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<DSymName>%(_ResolvedNativeReference.Filename)%(_ResolvedNativeReference.Extension).dSYM</DSymName>
</_PostProcessingItem>
<_PostProcessingItem Include="$([System.IO.Path]::GetFileName('$(AppBundleDir)'))/$(_NativeExecutableRelativePath)" Condition="'$(IsWatchApp)' != 'true'">
<SymbolFile>$(_MtouchSymbolsList)</SymbolFile>
<SymbolFile>$(_SymbolsListFullPath)</SymbolFile>
<DSymName>$(_AppBundleName)$(AppBundleExtension).dSYM</DSymName>
</_PostProcessingItem>

Expand All @@ -2400,10 +2411,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
</_PostProcessingItem>

<!-- Add any items from app extensions -->
<!-- We must update metadata with paths relative to the root of the contained app bundle to be relative to the root of the current app bundle -->
<_PostProcessingItem Include="@(_AppExtensionPostProcessingItems -> '$(_AppBundleName)$(AppBundleExtension)\$(_AppPlugInsRelativePath)%(Identity)')" Condition="@(_AppExtensionPostProcessingItems->Count()) &gt; 0"> <!-- The condition here shouldn't be necessary, but https://github.com/dotnet/msbuild/issues/4056 -->
<SymbolFile>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)','%(_AppExtensionPostProcessingItems.SourceProjectPath)/%(_AppExtensionPostProcessingItems.SymbolFile)'))</SymbolFile>
</_PostProcessingItem>
<_PostProcessingItem Include="@(_AppExtensionPostProcessingItems -> '$(_AppBundleName)$(AppBundleExtension)\$(_AppPlugInsRelativePath)%(Identity)')" Condition="@(_AppExtensionPostProcessingItems->Count()) &gt; 0" /> <!-- The condition here shouldn't be necessary, but https://github.com/dotnet/msbuild/issues/4056 -->

<!-- Add any items from watch app -->
<!-- We must update metadata with paths relative to the root of the app bundle to be relative to the root of the current app bundle -->
Expand Down

1 comment on commit 50bab4c

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔥 Build failed 🔥

Build failed for the job 'Build packages'

Pipeline on Agent
[d17-2] [msbuild] Use the full path to the symbols list file. Fixes #15046. (#15307)

Please sign in to comment.