diff --git a/android-commandlinetools.hcl b/android-commandlinetools.hcl new file mode 100644 index 00000000..e35ae930 --- /dev/null +++ b/android-commandlinetools.hcl @@ -0,0 +1,61 @@ +description = "Android SDK Command-line Tools" +homepage = "https://developer.android.com/tools#tools-sdk" +test = "sdkmanager --version" +binaries = [ + "bin/apkanalyzer", + "bin/avdmanager", + "bin/lint", + "bin/retrace", + "bin/sdkmanager", +] +strip = 1 + +// avdmanager respects com.android.sdkmanager.toolsdir +// sdkmanager respects com.android.sdklib.toolsdir +// ANDROID_SDK_ROOT is deprecated. Don't even try it. +// ... and everyone respects ANDROID_HOME +env = { + "AVDMANAGER_OPTS": "'-Dcom.android.sdkmanager.toolsdir=${ANDROID_HOME}/cmdline-tools/${version}'", + "SDKMANAGER_OPTS": "'-Dcom.android.sdklib.toolsdir=${ANDROID_HOME}/cmdline-tools/${version}'", + "ANDROID_HOME": "${HERMIT_ENV}/.hermit/android", +} + +// Symlink files and not the directory because avdmanager walks up the path! +// TODO(ssr): this *really* should be 'on "exec"' or, worse, 'on "activate"', +// but symlink isn't idempotent +on "unpack" { + mkdir { + dir = "${HERMIT_ENV}/.hermit/android/cmdline-tools/${version}" + } + + symlink { + from = "${root}/NOTICE.txt" + to = "${HERMIT_ENV}/.hermit/android/cmdline-tools/${version}/NOTICE.txt" + } + + symlink { + from = "${root}/bin" + to = "${HERMIT_ENV}/.hermit/android/cmdline-tools/${version}/bin" + } + + symlink { + from = "${root}/lib" + to = "${HERMIT_ENV}/.hermit/android/cmdline-tools/${version}/lib" + } + + symlink { + from = "${root}/source.properties" + to = "${HERMIT_ENV}/.hermit/android/cmdline-tools/${version}/source.properties" + } +} + +// Version comes from sdkmanager --list +version "9.0" { + darwin { + source = "https://dl.google.com/android/repository/commandlinetools-mac-9477386_latest.zip" + } + + linux { + source = "https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip" + } +}