androidenv fix cmdline beta versions' problem
This commit is contained in:
parent
cf73a86c35
commit
7c005a7b69
|
@ -1,4 +1,4 @@
|
|||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, stdenv, cmdLineToolsVersion, postInstall}:
|
||||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, stdenv, postInstall}:
|
||||
|
||||
deployAndroidPackage {
|
||||
name = "androidsdk";
|
||||
|
@ -16,7 +16,7 @@ deployAndroidPackage {
|
|||
export ANDROID_SDK_ROOT="$out/libexec/android-sdk"
|
||||
|
||||
# Wrap all scripts that require JAVA_HOME
|
||||
find $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin -maxdepth 1 -type f -executable | while read program; do
|
||||
find $ANDROID_SDK_ROOT/${package.path}/bin -maxdepth 1 -type f -executable | while read program; do
|
||||
if grep -q "JAVA_HOME" $program; then
|
||||
wrapProgram $program --prefix PATH : ${pkgs.jdk11}/bin \
|
||||
--prefix ANDROID_SDK_ROOT : $ANDROID_SDK_ROOT
|
||||
|
@ -24,12 +24,12 @@ deployAndroidPackage {
|
|||
done
|
||||
|
||||
# Wrap sdkmanager script
|
||||
wrapProgram $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin/sdkmanager \
|
||||
wrapProgram $ANDROID_SDK_ROOT/${package.path}/bin/sdkmanager \
|
||||
--prefix PATH : ${lib.makeBinPath [ pkgs.jdk11 ]} \
|
||||
--add-flags "--sdk_root=$ANDROID_SDK_ROOT"
|
||||
|
||||
# Patch all script shebangs
|
||||
patchShebangs $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin
|
||||
patchShebangs $ANDROID_SDK_ROOT/${package.path}/bin
|
||||
|
||||
cd $ANDROID_SDK_ROOT
|
||||
${postInstall}
|
||||
|
|
|
@ -314,6 +314,8 @@ rec {
|
|||
'') plugins}
|
||||
''; # */
|
||||
|
||||
cmdline-tools-package = check-version packages "cmdline-tools" cmdLineToolsVersion;
|
||||
|
||||
# This derivation deploys the tools package and symlinks all the desired
|
||||
# plugins that we want to use. If the license isn't accepted, prints all the licenses
|
||||
# requested and throws.
|
||||
|
@ -329,9 +331,9 @@ rec {
|
|||
by an environment variable for a single invocation of the nix tools.
|
||||
$ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1
|
||||
'' else callPackage ./cmdline-tools.nix {
|
||||
inherit deployAndroidPackage os cmdLineToolsVersion;
|
||||
inherit deployAndroidPackage os;
|
||||
|
||||
package = check-version packages "cmdline-tools" cmdLineToolsVersion;
|
||||
package = cmdline-tools-package;
|
||||
|
||||
postInstall = ''
|
||||
# Symlink all requested plugins
|
||||
|
@ -375,7 +377,7 @@ rec {
|
|||
ln -s $i $out/bin
|
||||
done
|
||||
|
||||
find $ANDROID_SDK_ROOT/cmdline-tools/${cmdLineToolsVersion}/bin -type f -executable | while read i; do
|
||||
find $ANDROID_SDK_ROOT/${cmdline-tools-package.path}/bin -type f -executable | while read i; do
|
||||
ln -s $i $out/bin
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue