Skip to content

Commit f596ccf

Browse files
PureWeenCopilot
andcommitted
Fix: remove stale maccatalyst CLI workaround, use SDK 0.1.26 native fix
SDK 0.1.26 (PR github/copilot-sdk#485) now natively maps maccatalyst RIDs to osx RIDs for CLI download. Our _FixCopilotRidForMacCatalyst workaround's condition ('$(_CopilotPlatform)' == '') no longer fires since the SDK sets it first, causing _CopilotOriginalRid to never be set, which skipped both the maccatalyst-arm64 runtime copy AND the MonoBundle copy. Clean builds would produce an app with no copilot CLI. Changes: - Remove _FixCopilotRidForMacCatalyst (SDK handles this now) - Update _CopyCopilotCliForMacCatalyst to detect maccatalyst via GetTargetPlatformIdentifier instead of _CopilotOriginalRid - Update _IncludeCopilotCliInBundle with same condition fix - Use $(RuntimeIdentifier) directly for the maccatalyst output path Fixes: github/copilot-sdk#454 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5f5a0b0 commit f596ccf

1 file changed

Lines changed: 10 additions & 23 deletions

File tree

PolyPilot/PolyPilot.csproj

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,16 @@
8787
<TrimmerRootAssembly Include="GitHub.Copilot.SDK" RootMode="All" />
8888
</ItemGroup>
8989

90-
<!-- The SDK only maps standard RIDs (osx-arm64, etc.) to download the copilot CLI.
91-
Mac Catalyst uses maccatalyst-arm64 which the SDK doesn't recognize, so the
92-
download is silently skipped. Map it to the darwin-arm64 npm package. -->
93-
<Target Name="_FixCopilotRidForMacCatalyst" BeforeTargets="_DownloadCopilotCli">
94-
<PropertyGroup Condition="'$(_CopilotPlatform)' == '' And $(_CopilotRid.StartsWith('maccatalyst-arm64'))">
95-
<_CopilotPlatform>darwin-arm64</_CopilotPlatform>
96-
<_CopilotBinary>copilot</_CopilotBinary>
97-
<_CopilotOriginalRid>$(_CopilotRid)</_CopilotOriginalRid>
98-
<_CopilotRid>osx-arm64</_CopilotRid>
99-
</PropertyGroup>
100-
<PropertyGroup Condition="'$(_CopilotPlatform)' == '' And '$(_CopilotRid)' == 'maccatalyst-x64'">
101-
<_CopilotPlatform>darwin-x64</_CopilotPlatform>
102-
<_CopilotBinary>copilot</_CopilotBinary>
103-
<_CopilotOriginalRid>$(_CopilotRid)</_CopilotOriginalRid>
104-
<_CopilotRid>osx-x64</_CopilotRid>
105-
</PropertyGroup>
106-
</Target>
107-
108-
<!-- The SDK at runtime uses RuntimeInformation.RuntimeIdentifier (maccatalyst-arm64)
109-
to locate the binary, so also copy it to that path. -->
110-
<Target Name="_CopyCopilotCliForMacCatalyst" AfterTargets="_CopyCopilotCliToOutput" Condition="'$(_CopilotOriginalRid)' != ''">
90+
<!-- SDK 0.1.26+ natively maps maccatalyst RIDs for CLI download (issue #454).
91+
The _FixCopilotRidForMacCatalyst workaround is no longer needed. -->
92+
93+
<!-- The SDK (0.1.26+) now maps maccatalyst RIDs to osx RIDs for download.
94+
However, at runtime RuntimeInformation.RuntimeIdentifier returns maccatalyst-arm64,
95+
so the SDK looks for runtimes/maccatalyst-arm64/native/copilot. We still need to
96+
copy the binary to that path AND into the .app bundle's MonoBundle. -->
97+
<Target Name="_CopyCopilotCliForMacCatalyst" AfterTargets="_CopyCopilotCliToOutput" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''">
11198
<PropertyGroup>
112-
<_CopilotMacCatalystOutputDir>$(OutDir)runtimes/$(_CopilotOriginalRid)/native</_CopilotMacCatalystOutputDir>
99+
<_CopilotMacCatalystOutputDir>$(OutDir)runtimes/$(RuntimeIdentifier)/native</_CopilotMacCatalystOutputDir>
113100
<_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir>
114101
</PropertyGroup>
115102
<MakeDir Directories="$(_CopilotMacCatalystOutputDir)" />
@@ -142,7 +129,7 @@
142129
<!-- Ensure the copilot CLI binary is included in the Mac Catalyst .app bundle.
143130
MAUI flattens everything into MonoBundle, so runtimes/ paths don't work.
144131
Copy the binary directly into the .app bundle's MonoBundle. -->
145-
<Target Name="_IncludeCopilotCliInBundle" AfterTargets="Build" Condition="'$(_CopilotOriginalRid)' != ''">
132+
<Target Name="_IncludeCopilotCliInBundle" AfterTargets="Build" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''">
146133
<PropertyGroup>
147134
<_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir>
148135
<_AppBundleMonoBundle>$(OutDir)PolyPilot.app/Contents/MonoBundle</_AppBundleMonoBundle>

0 commit comments

Comments
 (0)