|
24 | 24 | useGoogleTVAddOns = false; |
25 | 25 | includeExtras = [ "extras;android;m2repository" "extras;google;m2repository" ]; |
26 | 26 | }; |
| 27 | + licensedAndroidEnv = callPackage ./licensed-android-sdk.nix { inherit androidComposition; }; |
27 | 28 |
|
28 | 29 | in |
29 | 30 | { |
|
32 | 33 | buildInputs = [ openjdk gradle ]; |
33 | 34 | shellHook = '' |
34 | 35 | export JAVA_HOME="${openjdk}" |
35 | | - export ANDROID_HOME=~/.status/Android/Sdk |
| 36 | + export ANDROID_HOME=${licensedAndroidEnv} |
36 | 37 | export ANDROID_SDK_ROOT="$ANDROID_HOME" |
37 | 38 | export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle" |
38 | 39 | export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" |
39 | 40 | export ANDROID_NDK="$ANDROID_NDK_ROOT" |
40 | 41 | export PATH="$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$PATH" |
41 | | - '' + |
42 | | - ## We need to make a writeable copy of the Android SDK so that we can accept the license (which causes files to be written to the SDK folders) |
43 | | - ## since the nix store is immutable by nature, we can't license the SDK from there. |
44 | | - '' |
45 | | - if ! [ -d $ANDROID_HOME ]; then |
46 | | - echo "=> pulling the Android SDK out of the nix store and into a writeable directory" |
47 | 42 |
|
48 | | - mkdir -p $ANDROID_HOME |
49 | | - cp -rL ${androidComposition.androidsdk}/bin $ANDROID_HOME |
50 | | - cp -rL ${androidComposition.androidsdk}/libexec/android-sdk/* $ANDROID_HOME/ |
51 | | - chmod -R 755 $ANDROID_HOME/ |
52 | | - '' + lib.optionalString config.android_sdk.accept_license '' |
53 | | - echo "=> accepting Android SDK licenses" |
54 | | - pushd $ANDROID_HOME |
55 | | - yes | $PWD/bin/sdkmanager --licenses || if [ $? -ne '141' ]; then exit $?; fi; #Captures SIGPIPE 141 error but still allow repeating "y" to accept all licenses |
56 | | - popd |
57 | | - '' + |
58 | | - '' |
59 | | - echo "=> generating keystore" |
60 | | - $PWD/scripts/generate-keystore.sh |
61 | | - fi |
| 43 | + $(git rev-parse --show-toplevel)/scripts/generate-keystore.sh |
62 | 44 | ''; |
63 | 45 | } |
0 commit comments