+android.com/cmdline-tools (#5853)

* new file:   projects/android.com/cmdline-tools/package.yml

* add runtime env

* better test

* use ANDROID_HOME var in test

* maybe version 31 will work with linux arm

* sdkmanager --install "tools"

* just install android platform and check version
This commit is contained in:
Andrew 2024-04-10 17:06:20 +03:00 committed by GitHub
parent 576d004ab1
commit 690b3b7329
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,62 @@
distributable: ~
versions:
url: https://developer.android.com/studio
match: /commandlinetools-mac-\d+_latest\.zip/
strip:
- /^commandlinetools-mac-/
- /_latest\.zip/
warnings:
- vendored
dependencies:
openjdk.org: '>=17'
runtime:
env:
ANDROID_HOME: ${{prefix}}/libexec
PATH: $PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/emulator
build:
dependencies:
info-zip.org/unzip: '*'
curl.se: '*'
script:
- curl -L "$DIST_URL" -o android-commandlinetools.zip
- unzip android-commandlinetools.zip
# we need to use `cmdline-tools/latest` path to avoid:
# Error: Either specify it explicitly with --sdk_root=
- run: mkdir -p libexec/cmdline-tools/latest
working-directory: ${{prefix}}
- run: cp -r * {{prefix}}/libexec/cmdline-tools/latest/
working-directory: cmdline-tools
- run: |
ln -s ../libexec/cmdline-tools/latest/bin/apkanalyzer apkanalyzer
ln -s ../libexec/cmdline-tools/latest/bin/avdmanager avdmanager
ln -s ../libexec/cmdline-tools/latest/bin/lint lint
ln -s ../libexec/cmdline-tools/latest/bin/profgen profgen
ln -s ../libexec/cmdline-tools/latest/bin/resourceshrinker resourceshrinker
ln -s ../libexec/cmdline-tools/latest/bin/retrace retrace
ln -s ../libexec/cmdline-tools/latest/bin/screenshot2 screenshot2
ln -s ../libexec/cmdline-tools/latest/bin/sdkmanager sdkmanager
working-directory: ${{prefix}}/bin
env:
linux:
DIST_URL: https://dl.google.com/android/repository/commandlinetools-linux-{{version.raw}}_latest.zip
darwin:
DIST_URL: https://dl.google.com/android/repository/commandlinetools-mac-{{version.raw}}_latest.zip
provides:
- bin/apkanalyzer
- bin/avdmanager
- bin/lint
- bin/profgen
- bin/resourceshrinker
- bin/retrace
- bin/screenshot2
- bin/sdkmanager
test:
- echo y | sdkmanager --install "platforms;android-30"
- cat $ANDROID_HOME/platforms/android-30/source.properties | grep "AndroidVersion.ApiLevel=30"