-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add updates from ORT android emulator handling (#588)
* Update JDK version to 17 in ci.yml * Update com.diffplug.spotless to 6.22.0. * Copy updated scripts to start/stop the emulator from ORT from microsoft/onnxruntime#17903. Minimize the time the emulator is running as well. * Fix includes * Update to JDK 17 in packaging pipelines. * Fix pool name. --------- Co-authored-by: Edward Chen <[email protected]>
- Loading branch information
1 parent
5fd6bcf
commit e951e72
Showing
6 changed files
with
207 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Android Emulator helpers | ||
# Copied from https://github.com/microsoft/onnxruntime/blob/main/tools/ci_build/github/azure-pipelines/templates/use-android-emulator.yml | ||
parameters: | ||
- name: create | ||
type: boolean | ||
default: false | ||
|
||
- name: start | ||
type: boolean | ||
default: false | ||
|
||
- name: stop | ||
type: boolean | ||
default: false | ||
|
||
steps: | ||
- ${{ if eq(parameters.create, true) }}: | ||
- script: | | ||
set -e -x | ||
python3 tools/android/run_android_emulator.py \ | ||
--android-sdk-root $(ANDROID_SDK_ROOT) \ | ||
--create-avd --system-image "system-images;android-31;default;x86_64" | ||
displayName: Create Android Emulator | ||
- ${{ if eq(parameters.start, true) }}: | ||
- script: | | ||
if test -f $(Build.BinariesDirectory)/emulator.pid; then | ||
echo "Emulator PID file was not expected to exist but does and has pid:" \ | ||
`cat $(Build.BinariesDirectory)/emulator.pid` | ||
exit 1 | ||
fi | ||
displayName: Check emulator.pid does not exist | ||
# Add -verbose to --emulator-extra-args to enable additional logging. | ||
- script: | | ||
set -e -x | ||
python3 tools/android/run_android_emulator.py \ | ||
--android-sdk-root $(ANDROID_SDK_ROOT) \ | ||
--start --emulator-extra-args="-partition-size 2047" \ | ||
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid | ||
echo "Emulator PID:"`cat $(Build.BinariesDirectory)/emulator.pid` | ||
displayName: Start Android Emulator | ||
- ${{ if eq(parameters.stop, true) }}: | ||
- script: | | ||
set -e -x | ||
python3 -m pip install psutil | ||
displayName: Install psutil for emulator shutdown by run_android_emulator.py | ||
condition: always() | ||
- script: | | ||
set -e -x | ||
if test -f $(Build.BinariesDirectory)/emulator.pid; then | ||
echo "Emulator PID:"`cat $(Build.BinariesDirectory)/emulator.pid` | ||
python3 tools/android/run_android_emulator.py \ | ||
--android-sdk-root $(ANDROID_SDK_ROOT) \ | ||
--stop \ | ||
--emulator-pid-file $(Build.BinariesDirectory)/emulator.pid | ||
rm $(Build.BinariesDirectory)/emulator.pid | ||
else | ||
echo "Emulator PID file was expected to exist but does not." | ||
fi | ||
displayName: Stop Android Emulator | ||
condition: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.