mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Use zipped xcframework in nuget package (#21663)
### Description <!-- Describe your changes. --> The xcframework now uses symlinks to have the correct structure according to Apple requirements. Symlinks are not supported by nuget on Windows. In order to work around that we can store a zip of the xcframeworks in the nuget package. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Fix nuget packaging build break
This commit is contained in:
parent
a46e49b439
commit
410ae94e9e
4 changed files with 28 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Condition="('$(OutputType)'!='Library' OR '$(IsAppExtension)'=='True')">
|
||||
<NativeReference Include="$(MSBuildThisFileDirectory)..\..\runtimes\ios\native\onnxruntime.xcframework">
|
||||
<NativeReference Include="$(MSBuildThisFileDirectory)..\..\runtimes\ios\native\onnxruntime.xcframework.zip">
|
||||
<Kind>Static</Kind>
|
||||
<IsCxx>True</IsCxx>
|
||||
<SmartLink>True</SmartLink>
|
||||
|
|
@ -10,4 +10,4 @@
|
|||
<WeakFrameworks>CoreML</WeakFrameworks>
|
||||
</NativeReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -107,12 +107,9 @@ stages:
|
|||
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
|
||||
tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
|
||||
mkdir $(Build.BinariesDirectory)/artifacts
|
||||
mkdir -p $(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
||||
cp -R $(Build.BinariesDirectory)/ios_framework/framework_out/onnxruntime.xcframework \
|
||||
$(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
||||
pushd $(Build.BinariesDirectory)/artifacts_staging
|
||||
zip -vry $(Build.BinariesDirectory)/artifacts/onnxruntime_xcframework.zip \
|
||||
onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
||||
pushd $(Build.BinariesDirectory)/ios_framework/framework_out
|
||||
zip -vry $(Build.BinariesDirectory)/artifacts/onnxruntime_ios_xcframework.$(OnnxRuntimeVersion).zip \
|
||||
onnxruntime.xcframework
|
||||
popd
|
||||
displayName: "Build Apple xcframework"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ New-Item -Path $nuget_artifacts_dir -ItemType directory
|
|||
|
||||
## .zip files
|
||||
# unzip directly
|
||||
Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\nuget-artifact -Filter *.zip |
|
||||
# exclude the iOS xcframework as we need to leave that zipped up to preserve symlinks
|
||||
Get-ChildItem -Path $Env:BUILD_BINARIESDIRECTORY\nuget-artifact\* -Include *.zip -Exclude onnxruntime_ios_xcframework.*.zip |
|
||||
Foreach-Object {
|
||||
$cmd = "7z.exe x $($_.FullName) -y -o$nuget_artifacts_dir"
|
||||
Write-Output $cmd
|
||||
|
|
@ -34,6 +35,23 @@ Foreach-Object {
|
|||
Invoke-Expression -Command $cmd
|
||||
}
|
||||
|
||||
# process iOS xcframework
|
||||
$xcframeworks = Get-ChildItem $Env:BUILD_BINARIESDIRECTORY\nuget-artifact -Filter onnxruntime_ios_xcframework.*.zip
|
||||
if ($xcframeworks.Count -eq 1) {
|
||||
$xcframework = $xcframeworks[0]
|
||||
$target_dir = "$nuget_artifacts_dir\onnxruntime-ios-xcframework"
|
||||
# remove version info from filename and use required filename format
|
||||
$target_file = "$target_dir\onnxruntime.xcframework.zip"
|
||||
New-Item -Path $target_dir -ItemType directory
|
||||
|
||||
Write-Output "Copy-Item $($xcframework.FullName) $target_file"
|
||||
Copy-Item $xcframework.FullName $target_file
|
||||
}
|
||||
elseif ($xcframeworks.Count -gt 1) {
|
||||
Write-Error "Expected at most one onnxruntime_ios_xcframework*.zip file but got: [$xcframeworks]"
|
||||
}
|
||||
|
||||
|
||||
# copy android AAR.
|
||||
# for full build of onnxruntime Android AAR, there should only be one .aar file
|
||||
# called onnxruntime-android-x.y.z.aar or onnxruntime-training-android-x.y.z.aar but sanity check that
|
||||
|
|
|
|||
|
|
@ -105,8 +105,10 @@ def generate_file_list_for_ep(nuget_artifacts_dir, ep, files_list, include_pdbs,
|
|||
if child_file.suffix in [".aar"]:
|
||||
files_list.append('<file src="' + str(child_file) + '" target="runtimes/android/native"/>')
|
||||
|
||||
if child.name == "onnxruntime-ios-xcframework":
|
||||
files_list.append('<file src="' + str(child) + "\\**" '" target="runtimes/ios/native"/>') # noqa: ISC001
|
||||
if child.name == "onnxruntime-ios":
|
||||
for child_file in child.iterdir():
|
||||
if child_file.suffix in [".zip"]:
|
||||
files_list.append('<file src="' + str(child_file) + '" target="runtimes/ios/native"/>')
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
|
|
|
|||
Loading…
Reference in a new issue