|
87 | 87 | <TrimmerRootAssembly Include="GitHub.Copilot.SDK" RootMode="All" /> |
88 | 88 | </ItemGroup> |
89 | 89 |
|
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)' != ''"> |
98 | | - <PropertyGroup> |
99 | | - <_CopilotMacCatalystOutputDir>$(OutDir)runtimes/$(RuntimeIdentifier)/native</_CopilotMacCatalystOutputDir> |
100 | | - <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir> |
101 | | - </PropertyGroup> |
102 | | - <MakeDir Directories="$(_CopilotMacCatalystOutputDir)" /> |
103 | | - <Copy SourceFiles="$(_CopilotCacheDir)/$(_CopilotBinary)" DestinationFolder="$(_CopilotMacCatalystOutputDir)" SkipUnchangedFiles="true" /> |
104 | | - </Target> |
105 | | - |
106 | | - <!-- The SDK registers the intermediate copilot binary as ContentWithTargetPath. |
107 | | - On Mac Catalyst this surfaces as a publish metadata warning; we already copy |
108 | | - the binary explicitly via custom targets above. --> |
109 | | - <Target Name="_ExcludeCopilotCliIntermediateFromMacCatalystPublish" AfterTargets="_RegisterCopilotCliForCopy" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''"> |
| 90 | + <!-- The SDK registers the copilot CLI as ContentWithTargetPath but doesn't set |
| 91 | + PublishFolderType, so MAUI skips it when building the .app bundle. |
| 92 | + Re-register with PublishFolderType=Assembly so it lands in MonoBundle |
| 93 | + (where ResolveBundledCliPath finds it). --> |
| 94 | + <Target Name="_FixCopilotCliBundling" AfterTargets="_RegisterCopilotCliForCopy" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''"> |
110 | 95 | <PropertyGroup> |
111 | 96 | <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir> |
112 | 97 | </PropertyGroup> |
113 | 98 | <ItemGroup> |
114 | 99 | <ContentWithTargetPath Remove="$(_CopilotCacheDir)/$(_CopilotBinary)" /> |
115 | 100 | <ContentWithTargetPath Remove="$(_CopilotCacheDir)\$(_CopilotBinary)" /> |
| 101 | + <ContentWithTargetPath Include="$(_CopilotCacheDir)/$(_CopilotBinary)" |
| 102 | + TargetPath="copilot" |
| 103 | + CopyToOutputDirectory="PreserveNewest" |
| 104 | + PublishFolderType="Assembly" /> |
116 | 105 | </ItemGroup> |
117 | 106 | </Target> |
118 | 107 |
|
119 | | - <Target Name="_ExcludeCopilotCliFromResolvedPublishForMacCatalyst" BeforeTargets="_ComputePublishLocation" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''"> |
120 | | - <PropertyGroup> |
121 | | - <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir> |
122 | | - </PropertyGroup> |
123 | | - <ItemGroup> |
124 | | - <ResolvedFileToPublish Remove="$(_CopilotCacheDir)/$(_CopilotBinary)" /> |
125 | | - <ResolvedFileToPublish Remove="$(_CopilotCacheDir)\$(_CopilotBinary)" /> |
126 | | - </ItemGroup> |
127 | | - </Target> |
128 | | - |
129 | | - <!-- Ensure the copilot CLI binary is included in the Mac Catalyst .app bundle. |
130 | | - MAUI flattens everything into MonoBundle, so runtimes/ paths don't work. |
131 | | - Copy the binary directly into the .app bundle's MonoBundle. --> |
132 | | - <Target Name="_IncludeCopilotCliInBundle" AfterTargets="Build" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst' And '$(_CopilotPlatform)' != ''"> |
133 | | - <PropertyGroup> |
134 | | - <_CopilotCacheDir>$(IntermediateOutputPath)copilot-cli/$(CopilotCliVersion)/$(_CopilotPlatform)</_CopilotCacheDir> |
135 | | - <_AppBundleMonoBundle>$(OutDir)PolyPilot.app/Contents/MonoBundle</_AppBundleMonoBundle> |
136 | | - </PropertyGroup> |
137 | | - <Copy SourceFiles="$(_CopilotCacheDir)/$(_CopilotBinary)" DestinationFolder="$(_AppBundleMonoBundle)" SkipUnchangedFiles="true" Condition="Exists('$(_AppBundleMonoBundle)')" /> |
138 | | - <Message Importance="high" Text="Copied copilot CLI binary to app bundle MonoBundle" Condition="Exists('$(_AppBundleMonoBundle)')" /> |
139 | | - </Target> |
140 | | - |
141 | 108 | </Project> |
0 commit comments