Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+android-commandlinetools-9477386 #359

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions android-commandlinetools.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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
runtime-dependencies = ["openjdk@stable"]
// ANDROID_SDK_ROOT is deprecated. Don't even try it.
env = {
"ANDROID_HOME": "${HERMIT_ENV}/.hermit/android",
"APKANALYZER_OPTS": "'-Dcom.android.sdklib.toolsdir=${ANDROID_HOME}/cmdline-tools/${version}'",
"AVDMANAGER_OPTS": "'-Dcom.android.sdkmanager.toolsdir=${ANDROID_HOME}/cmdline-tools/${version}'",
"LINT_OPTS": "'-Dcom.android.tools.lint.bindir=${ANDROID_HOME}/cmdline-tools/${version}'",
"SDKMANAGER_OPTS": "'-Dcom.android.sdklib.toolsdir=${ANDROID_HOME}/cmdline-tools/${version}'",
}

// 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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't really work as you hope: if the package is already unpacked, and a new env is cloned with this package, these hooks will not execute in that new env.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. 😭 What would you recommend?

}

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"
}
}

sha256sums = {
"https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip": "bd1aa17c7ef10066949c88dc6c9c8d536be27f992a1f3b5a584f9bd2ba5646a0",
"https://dl.google.com/android/repository/commandlinetools-mac-9477386_latest.zip": "2072ffce4f54cdc0e6d2074d2f381e7e579b7d63e915c220b96a7db95b2900ee",
}