|
137 | 137 | shared-library name next to the CLI binary. --> |
138 | 138 | <_CopilotRuntimeNodePath>$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\runtime.node</_CopilotRuntimeNodePath> |
139 | 139 | <_CopilotRuntimeWrapperPath Condition="'$(_CopilotRuntimeWrapperPath)' == ''">$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\$(_CopilotRuntimeWrapper)</_CopilotRuntimeWrapperPath> |
| 140 | + <_CopilotRuntimeAssetManifest>$(_CopilotOutputDir)\.copilot-runtime-assets</_CopilotRuntimeAssetManifest> |
140 | 141 | </PropertyGroup> |
141 | 142 | <Error Condition="!Exists('$(_CopilotCliBinaryPath)')" Text="Copilot CLI binary not found at '$(_CopilotCliBinaryPath)'. Set CopilotCliBinaryPath to an existing CLI binary for the current RID, or remove CopilotSkipCliDownload=true to let the SDK download it." /> |
| 143 | + <Error Condition="Exists('$(_CopilotRuntimeWrapperPath)') != Exists('$(_CopilotRuntimeNodePath)')" Text="Incomplete Copilot runtime bundle in '$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)': $(_CopilotRuntimeWrapper) and runtime.node are both required." /> |
| 144 | + <ReadLinesFromFile File="$(_CopilotRuntimeAssetManifest)" Condition="Exists('$(_CopilotRuntimeAssetManifest)')"> |
| 145 | + <Output TaskParameter="Lines" ItemName="_CopilotPreviousRuntimeAsset" /> |
| 146 | + </ReadLinesFromFile> |
| 147 | + <ItemGroup> |
| 148 | + <_CopilotSafePreviousRuntimeAsset Include="@(_CopilotPreviousRuntimeAsset)" |
| 149 | + Condition="!$([System.IO.Path]::IsPathRooted('%(Identity)')) And !$([System.String]::Copy('%(Identity)').Contains('..'))" /> |
| 150 | + </ItemGroup> |
| 151 | + <Delete Files="@(_CopilotSafePreviousRuntimeAsset->'$(_CopilotOutputDir)\%(Identity)')" /> |
| 152 | + <Delete Files="$(_CopilotRuntimeAssetManifest)" /> |
| 153 | + <ItemGroup Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')"> |
| 154 | + <_CopilotRuntimeRootAsset Include="$(_CopilotCacheDir)\**\*" |
| 155 | + Exclude="$(_CopilotCacheDir)\app.js;$(_CopilotCacheDir)\assets\**\*;$(_CopilotCacheDir)\changelog.json;$(_CopilotCacheDir)\copilot;$(_CopilotCacheDir)\copilot.exe;$(_CopilotCacheDir)\copilot-sdk\**\*;$(_CopilotCacheDir)\copilot.tgz;$(_CopilotCacheDir)\foundry-local-sdk\**\*;$(_CopilotCacheDir)\index.js;$(_CopilotCacheDir)\napi-oop-runtime\**\*;$(_CopilotCacheDir)\npm-loader.js;$(_CopilotCacheDir)\package.json;$(_CopilotCacheDir)\prebuilds\**\*;$(_CopilotCacheDir)\preloads\**\*;$(_CopilotCacheDir)\pvrecorder\**\*;$(_CopilotCacheDir)\queries\**\*;$(_CopilotCacheDir)\sdk\**\*;$(_CopilotCacheDir)\sea-loader.js;$(_CopilotCacheDir)\tree-sitter*.wasm;$(_CopilotCacheDir)\voice-*.js;$(_CopilotCacheDir)\webview\**\*" /> |
| 156 | + <_CopilotRuntimePrebuildAsset Include="$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\**\*" |
| 157 | + Exclude="$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\cli-native.node;$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\mediaremote-adapter\**\*;$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\copilot-runtime-bin*" /> |
| 158 | + </ItemGroup> |
142 | 159 | <MakeDir Directories="$(_CopilotOutputDir)" /> |
143 | 160 | <Copy SourceFiles="$(_CopilotCliBinaryPath)" DestinationFiles="$(_CopilotOutputDir)\$(_CopilotBinary)" SkipUnchangedFiles="true" /> |
144 | 161 | <Copy SourceFiles="$(_CopilotRuntimeNodePath)" DestinationFiles="$(_CopilotOutputDir)\$(_CopilotRuntimeLib)" SkipUnchangedFiles="true" Condition="Exists('$(_CopilotRuntimeNodePath)')" /> |
145 | | - <Delete Files="$(_CopilotOutputDir)\runtime.node;$(_CopilotOutputDir)\$(_CopilotRuntimeWrapper)" |
146 | | - Condition="!Exists('$(_CopilotRuntimeWrapperPath)') Or !Exists('$(_CopilotRuntimeNodePath)')" /> |
147 | | - <Copy SourceFiles="$(_CopilotRuntimeNodePath)" DestinationFiles="$(_CopilotOutputDir)\runtime.node" SkipUnchangedFiles="true" Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
148 | | - <Copy SourceFiles="$(_CopilotRuntimeWrapperPath)" DestinationFiles="$(_CopilotOutputDir)\$(_CopilotRuntimeWrapper)" SkipUnchangedFiles="true" Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
| 162 | + <Copy SourceFiles="@(_CopilotRuntimeRootAsset)" |
| 163 | + DestinationFiles="@(_CopilotRuntimeRootAsset->'$(_CopilotOutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" |
| 164 | + SkipUnchangedFiles="true" /> |
| 165 | + <Copy SourceFiles="@(_CopilotRuntimePrebuildAsset)" |
| 166 | + DestinationFiles="@(_CopilotRuntimePrebuildAsset->'$(_CopilotOutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" |
| 167 | + SkipUnchangedFiles="true" /> |
| 168 | + <WriteLinesToFile File="$(_CopilotRuntimeAssetManifest)" |
| 169 | + Lines="@(_CopilotRuntimeRootAsset->'%(RecursiveDir)%(Filename)%(Extension)');@(_CopilotRuntimePrebuildAsset->'%(RecursiveDir)%(Filename)%(Extension)')" |
| 170 | + Overwrite="true" |
| 171 | + Condition="'@(_CopilotRuntimeRootAsset)' != '' Or '@(_CopilotRuntimePrebuildAsset)' != ''" /> |
| 172 | + <Delete Files="$(_CopilotOutputDir)\$(_CopilotRuntimeLib)" Condition="!Exists('$(_CopilotRuntimeNodePath)')" /> |
149 | 173 | </Target> |
150 | 174 |
|
151 | 175 | <!-- Register CLI binary as content so it flows through project references. |
|
158 | 182 | <_CopilotRuntimeWrapperPath Condition="'$(_CopilotRuntimeWrapperPath)' == ''">$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\$(_CopilotRuntimeWrapper)</_CopilotRuntimeWrapperPath> |
159 | 183 | </PropertyGroup> |
160 | 184 | <Error Condition="!Exists('$(_CopilotCliBinaryPath)')" Text="Copilot CLI binary not found at '$(_CopilotCliBinaryPath)'. Set CopilotCliBinaryPath to an existing CLI binary for the current RID, or remove CopilotSkipCliDownload=true to let the SDK download it." /> |
| 185 | + <Error Condition="Exists('$(_CopilotRuntimeWrapperPath)') != Exists('$(_CopilotRuntimeNodePath)')" Text="Incomplete Copilot runtime bundle in '$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)': $(_CopilotRuntimeWrapper) and runtime.node are both required." /> |
161 | 186 | <ItemGroup> |
| 187 | + <_CopilotRuntimeRootAsset Include="$(_CopilotCacheDir)\**\*" |
| 188 | + Exclude="$(_CopilotCacheDir)\app.js;$(_CopilotCacheDir)\assets\**\*;$(_CopilotCacheDir)\changelog.json;$(_CopilotCacheDir)\copilot;$(_CopilotCacheDir)\copilot.exe;$(_CopilotCacheDir)\copilot-sdk\**\*;$(_CopilotCacheDir)\copilot.tgz;$(_CopilotCacheDir)\foundry-local-sdk\**\*;$(_CopilotCacheDir)\index.js;$(_CopilotCacheDir)\napi-oop-runtime\**\*;$(_CopilotCacheDir)\npm-loader.js;$(_CopilotCacheDir)\package.json;$(_CopilotCacheDir)\prebuilds\**\*;$(_CopilotCacheDir)\preloads\**\*;$(_CopilotCacheDir)\pvrecorder\**\*;$(_CopilotCacheDir)\queries\**\*;$(_CopilotCacheDir)\sdk\**\*;$(_CopilotCacheDir)\sea-loader.js;$(_CopilotCacheDir)\tree-sitter*.wasm;$(_CopilotCacheDir)\voice-*.js;$(_CopilotCacheDir)\webview\**\*" |
| 189 | + Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
| 190 | + <_CopilotRuntimePrebuildAsset Include="$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\**\*" |
| 191 | + Exclude="$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\cli-native.node;$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\mediaremote-adapter\**\*;$(_CopilotCacheDir)\prebuilds\$(_CopilotPlatform)\copilot-runtime-bin*" |
| 192 | + Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
162 | 193 | <ContentWithTargetPath Include="$(_CopilotCliBinaryPath)" |
163 | 194 | TargetPath="runtimes\$(_CopilotRid)\native\$(_CopilotBinary)" |
164 | 195 | CopyToOutputDirectory="PreserveNewest" /> |
|
167 | 198 | TargetPath="runtimes\$(_CopilotRid)\native\$(_CopilotRuntimeLib)" |
168 | 199 | CopyToOutputDirectory="PreserveNewest" |
169 | 200 | Condition="Exists('$(_CopilotRuntimeNodePath)')" /> |
170 | | - <ContentWithTargetPath Include="$(_CopilotRuntimeNodePath)" |
171 | | - TargetPath="runtimes\$(_CopilotRid)\native\runtime.node" |
172 | | - CopyToOutputDirectory="PreserveNewest" |
173 | | - Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
174 | | - <ContentWithTargetPath Include="$(_CopilotRuntimeWrapperPath)" |
175 | | - TargetPath="runtimes\$(_CopilotRid)\native\$(_CopilotRuntimeWrapper)" |
176 | | - CopyToOutputDirectory="PreserveNewest" |
177 | | - Condition="Exists('$(_CopilotRuntimeWrapperPath)') And Exists('$(_CopilotRuntimeNodePath)')" /> |
| 201 | + <ContentWithTargetPath Include="@(_CopilotRuntimeRootAsset)" |
| 202 | + TargetPath="runtimes\$(_CopilotRid)\native\%(RecursiveDir)%(Filename)%(Extension)" |
| 203 | + CopyToOutputDirectory="PreserveNewest" /> |
| 204 | + <ContentWithTargetPath Include="@(_CopilotRuntimePrebuildAsset)" |
| 205 | + TargetPath="runtimes\$(_CopilotRid)\native\%(RecursiveDir)%(Filename)%(Extension)" |
| 206 | + CopyToOutputDirectory="PreserveNewest" /> |
178 | 207 | </ItemGroup> |
179 | 208 | </Target> |
180 | 209 | </Project> |
0 commit comments