onnxruntime/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar.yml
Changming Sun d461ca9dcd
Update onnxruntime binary size checks ci pipeline's docker image (#23405)
1. Update onnxruntime binary size checks ci pipeline's docker image. Use
a different docker image that is not manylinux based. The new one is
smaller.
2. Add flatbuffers tools/ci_build/requirements/pybind/requirements.txt
3. Delete
tools/ci_build/github/azure-pipelines/py-package-build-pipeline.yml. The
pipeline was for generating packages for Olive, but it went unused. And
the content is highly duplicated with our official python packaging
pipeline.
4. A lot of YAML files reference pypa/manylinux git repo but do not use
it. This PR removes the references.
2025-01-17 15:29:17 -08:00

142 lines
4.3 KiB
YAML

parameters:
- name: buildConfig
displayName: Configuration to build
type: string
default: 'Release'
- name: buildSettings
displayName: Path to the build setting file
type: string
default: ''
- name: includedOpsConfig
displayName: Path to the included ops config file
type: string
default: ''
- name: artifactName
displayName: Artifact Name
type: string
default: ''
- name: job_name_suffix
displayName: Job name
type: string
default: ''
- name: publish_executables
# The executables will only be published if the publish_executables is set to "1"
displayName: Publish executables such as onnxruntime_perf_test, ...
type: string
default: '0'
- name: pool_name
displayName: Pool name
type: string
default: 'onnxruntime-Ubuntu2204-AMD-CPU'
- name: packageName
displayName: Package Name
type: string
default: 'onnxruntime-android'
- name: enable_code_sign
displayName: Use GPG to sign the jars
type: boolean
- name: ReleaseVersionSuffix
displayName: Release Version Suffix
type: string
default: ''
- name: QnnSDKVersion
displayName: QNN SDK Version
type: string
default: '2.28.0.241029'
jobs:
- job: Android_Java_API_AAR_Packaging_${{ parameters.job_name_suffix }}
timeoutInMinutes: 120
workspace:
clean: all
pool: ${{parameters.pool_name}}
variables:
artifacts_directory: $(Build.BinariesDirectory)/.artifacts
steps:
- checkout: self
clean: true
submodules: none
- task: CmdLine@2
displayName: Create artifacts directory
inputs:
script: |
# Create a folder for artifacts
mkdir -p $(artifacts_directory)
workingDirectory: $(Build.BinariesDirectory)
- template: get-docker-image-steps.yml
parameters:
Dockerfile: tools/ci_build/github/linux/docker/inference/x86_64/default/cpu/Dockerfile
Context: tools/ci_build/github/linux/docker/inference/x86_64/default/cpu
DockerBuildArgs: "--build-arg BUILD_UID=$( id -u )"
Repository: onnxruntimecpubuildcentos8x64_packaging
- template: set-version-number-variables-step.yml
- template: use-android-ndk.yml
- ${{ if contains(parameters.packageName, 'qnn') }}:
- template: jobs/download_linux_qnn_sdk.yml
parameters:
QnnSDKVersion: '${{parameters.QnnSDKVersion}}'
- task: CmdLine@2
displayName: Build Android AAR Packages
inputs:
script: |
set -e -x
NDK_HOME=$(realpath $ANDROID_NDK_HOME)
mkdir $(Build.BinariesDirectory)/.build_settings
cp ${{parameters.buildSettings}} $(Build.BinariesDirectory)/.build_settings/build_settings.json
[ -f "${{parameters.includedOpsConfig}}" ] && \
cp ${{parameters.includedOpsConfig}} $(Build.BinariesDirectory)/.build_settings/include_ops_and_types.config
# Mount qnn volume if building qnn android package
if [[ ${{ parameters.packageName }} == *qnn* ]]; then
QNN_VOLUME="--volume $(QnnSDKRootDir):/qnn_home"
USE_QNN="1"
else
QNN_VOLUME=""
USE_QNN="0"
fi
docker run --rm \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume $ANDROID_HOME:/android_home \
--volume $NDK_HOME:/ndk_home \
--volume $(artifacts_directory):/home/onnxruntimedev/.artifacts \
--volume $(Build.BinariesDirectory)/.build_settings:/home/onnxruntimedev/.build_settings \
$QNN_VOLUME \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
-e BUILD_CONFIG=${{parameters.buildConfig}} \
-e ORT_VERSION=$(OnnxRuntimeVersion) \
-e PUBLISH_EXECUTABLES=${{parameters.publish_executables}} \
-e PACKAGE_NAME=${{parameters.packageName}} \
-e RELEASE_VERSION_SUFFIX=${{parameters.ReleaseVersionSuffix}} \
onnxruntimecpubuildcentos8x64_packaging \
/bin/bash /onnxruntime_src/tools/ci_build/github/android/build_aar_and_copy_artifacts.sh $USE_QNN
workingDirectory: $(Build.SourcesDirectory)
- ${{ if eq(parameters['enable_code_sign'], 'true') }}:
- template: jar-maven-signing-linux.yml
parameters:
JarFileDirectory: '$(artifacts_directory)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(artifacts_directory)'
artifactName: '${{parameters.artifactName}}'