mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-31 23:27:43 +00:00
Fix iOS artifacts issue in Microsoft.ML.OnnxRuntime Nuget Package (#19311)
### Description <!-- Describe your changes. --> Updates to only include ios archs framework in artifacts included in 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. --> Related issue: https://github.com/microsoft/onnxruntime/issues/19295#issuecomment-1914143256 --------- Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net> Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This commit is contained in:
parent
a92802f940
commit
3e17ca3dab
4 changed files with 58 additions and 14 deletions
|
|
@ -1,6 +1,10 @@
|
|||
def include_macos_target
|
||||
if '@C_POD_NAME@' != 'onnxruntime-mobile-c'
|
||||
return true
|
||||
if ENV['SKIP_MACOS_TEST'] != 'true'
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"build_osx_archs": {
|
||||
"iphoneos": [
|
||||
"arm64"
|
||||
],
|
||||
"iphonesimulator": [
|
||||
"arm64",
|
||||
"x86_64"
|
||||
]
|
||||
},
|
||||
"build_params": {
|
||||
"base": [
|
||||
"--parallel",
|
||||
"--use_xcode",
|
||||
"--build_apple_framework",
|
||||
"--use_coreml",
|
||||
"--use_xnnpack",
|
||||
"--skip_tests",
|
||||
"--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF"
|
||||
],
|
||||
"iphoneos": [
|
||||
"--ios",
|
||||
"--apple_deploy_target=12.0"
|
||||
],
|
||||
"iphonesimulator": [
|
||||
"--ios",
|
||||
"--apple_deploy_target=12.0"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -112,7 +112,10 @@ def _test_apple_packages(args):
|
|||
subprocess.run(["pod", "cache", "clean", "--all"], shell=False, check=True, cwd=target_proj_path)
|
||||
|
||||
# install pods
|
||||
subprocess.run(["pod", "install"], shell=False, check=True, cwd=target_proj_path)
|
||||
# set env to skip macos test targets accordingly
|
||||
env = os.environ.copy()
|
||||
env["SKIP_MACOS_TEST"] = "true" if args.skip_macos_test else "false"
|
||||
subprocess.run(["pod", "install"], shell=False, check=True, cwd=target_proj_path, env=env)
|
||||
|
||||
# run the tests
|
||||
if not args.prepare_test_project_only:
|
||||
|
|
@ -144,7 +147,7 @@ def _test_apple_packages(args):
|
|||
cwd=target_proj_path,
|
||||
)
|
||||
|
||||
if PackageVariant[args.variant] != PackageVariant.Mobile:
|
||||
if PackageVariant[args.variant] != PackageVariant.Mobile and not args.skip_macos_test:
|
||||
subprocess.run(
|
||||
[
|
||||
"xcrun",
|
||||
|
|
@ -206,6 +209,12 @@ def parse_args():
|
|||
help="Prepare the test project only, without running the tests",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--skip_macos_test",
|
||||
action="store_true",
|
||||
help="Skip macos platform tests. Specify this argument when build targets only contain ios archs. ",
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -119,31 +119,32 @@ stages:
|
|||
- script: |
|
||||
set -e -x
|
||||
python3 tools/ci_build/github/apple/build_apple_framework.py \
|
||||
--build_dir "$(Build.BinariesDirectory)/apple_framework" \
|
||||
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
|
||||
--path_to_protoc_exe $(Build.BinariesDirectory)/protobuf_install/bin/protoc \
|
||||
tools/ci_build/github/apple/default_full_apple_framework_build_settings.json
|
||||
tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
|
||||
mkdir $(Build.BinariesDirectory)/artifacts
|
||||
mkdir -p $(Build.BinariesDirectory)/artifacts_staging/onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
|
||||
cp -R $(Build.BinariesDirectory)/apple_framework/framework_out/onnxruntime.xcframework \
|
||||
$(Build.BinariesDirectory)/artifacts_staging/onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
|
||||
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 -vr $(Build.BinariesDirectory)/artifacts/onnxruntime_xcframework.zip \
|
||||
onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
|
||||
onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
|
||||
popd
|
||||
displayName: "Build Apple xcframework"
|
||||
|
||||
- script: |
|
||||
python3 tools/ci_build/github/apple/test_apple_packages.py \
|
||||
--fail_if_cocoapods_missing \
|
||||
--framework_info_file "$(Build.BinariesDirectory)/apple_framework/xcframework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/apple_framework/framework_out" \
|
||||
--variant Full
|
||||
--framework_info_file "$(Build.BinariesDirectory)/ios_framework/xcframework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" \
|
||||
--variant Full \
|
||||
--skip_macos_test
|
||||
displayName: "Test Apple framework"
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
pathtoPublish: '$(Build.BinariesDirectory)/artifacts'
|
||||
artifactName: 'onnxruntime-apple-full-xcframework'
|
||||
artifactName: 'onnxruntime-ios-full-xcframework'
|
||||
|
||||
- template: component-governance-component-detection-steps.yml
|
||||
parameters:
|
||||
|
|
@ -350,7 +351,7 @@ stages:
|
|||
- template: flex-downloadPipelineArtifact.yml
|
||||
parameters:
|
||||
StepName: 'Download iOS Pipeline Artifact'
|
||||
ArtifactName: 'onnxruntime-apple-full-xcframework'
|
||||
ArtifactName: 'onnxruntime-ios-full-xcframework'
|
||||
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue