summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorErik Arvstedt <erik.arvstedt@gmail.com>2019-08-17 10:48:08 +0200
committerErik Arvstedt <erik.arvstedt@gmail.com>2019-08-17 11:19:05 +0200
commit2ec43d3509253200a015d854ee0976ffea4aa9e7 (patch)
tree26e6604f69d0a942b1ec6727876a463df91a7ee6 /pkgs/development/mobile
parent4daca65fe311b882ce0044813845399f7f6019bf (diff)
downloadnixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar.gz
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar.bz2
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar.lz
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar.xz
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.tar.zst
nixpkgs-2ec43d3509253200a015d854ee0976ffea4aa9e7.zip
androidenv/emulate-app: rename androidsdkComposition -> sdk
This greatly improves readability by shortening some of the overlong lines.
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/androidenv/emulate-app.nix26
1 files changed, 13 insertions, 13 deletions
diff --git a/pkgs/development/mobile/androidenv/emulate-app.nix b/pkgs/development/mobile/androidenv/emulate-app.nix
index ec9001340db..b44b4e57c95 100644
--- a/pkgs/development/mobile/androidenv/emulate-app.nix
+++ b/pkgs/development/mobile/androidenv/emulate-app.nix
@@ -15,7 +15,7 @@ let
     abiVersions = [ abiVersion ];
   } // sdkExtraArgs;
 
-  androidsdkComposition = (composeAndroidPackages sdkArgs).androidsdk;
+  sdk = (composeAndroidPackages sdkArgs).androidsdk;
 in
 stdenv.mkDerivation {
   inherit name;
@@ -41,7 +41,7 @@ stdenv.mkDerivation {
     ''}
 
     # We need to specify the location of the Android SDK root folder
-    export ANDROID_SDK_ROOT=${androidsdkComposition}/libexec/android-sdk
+    export ANDROID_SDK_ROOT=${sdk}/libexec/android-sdk
 
     # We have to look for a free TCP port
 
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
 
     for i in $(seq 5554 2 5584)
     do
-        if [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb devices | grep emulator-$i)" ]
+        if [ -z "$(${sdk}/libexec/android-sdk/platform-tools/adb devices | grep emulator-$i)" ]
         then
             port=$i
             break
@@ -67,12 +67,12 @@ stdenv.mkDerivation {
     export ANDROID_SERIAL="emulator-$port"
 
     # Create a virtual android device for testing if it does not exists
-    ${androidsdkComposition}/libexec/android-sdk/tools/android list targets
+    ${sdk}/libexec/android-sdk/tools/android list targets
 
-    if [ "$(${androidsdkComposition}/libexec/android-sdk/tools/android list avd | grep 'Name: device')" = "" ]
+    if [ "$(${sdk}/libexec/android-sdk/tools/android list avd | grep 'Name: device')" = "" ]
     then
         # Create a virtual android device
-        yes "" | ${androidsdkComposition}/libexec/android-sdk/tools/android create avd -n device -t 1 --abi ${systemImageType}/${abiVersion} $NIX_ANDROID_AVD_FLAGS
+        yes "" | ${sdk}/libexec/android-sdk/tools/android create avd -n device -t 1 --abi ${systemImageType}/${abiVersion} $NIX_ANDROID_AVD_FLAGS
 
         ${stdenv.lib.optionalString enableGPU ''
           # Enable GPU acceleration
@@ -85,23 +85,23 @@ stdenv.mkDerivation {
     fi
 
     # Launch the emulator
-    ${androidsdkComposition}/libexec/android-sdk/emulator/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
+    ${sdk}/libexec/android-sdk/emulator/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
 
     # Wait until the device has completely booted
     echo "Waiting until the emulator has booted the device and the package manager is ready..." >&2
 
-    ${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port wait-for-device
+    ${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port wait-for-device
 
     echo "Device state has been reached" >&2
 
-    while [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
+    while [ -z "$(${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
     do
         sleep 5
     done
 
     echo "dev.bootcomplete property is 1" >&2
 
-    #while [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
+    #while [ -z "$(${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
     #do
         #sleep 5
     #done
@@ -113,7 +113,7 @@ stdenv.mkDerivation {
     ${stdenv.lib.optionalString (app != null) ''
       # Install the App through the debugger, if it has not been installed yet
 
-      if [ -z "${package}" ] || [ "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
+      if [ -z "${package}" ] || [ "$(${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
       then
           if [ -d "${app}" ]
           then
@@ -122,12 +122,12 @@ stdenv.mkDerivation {
               appPath="${app}"
           fi
 
-          ${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port install "$appPath"
+          ${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port install "$appPath"
       fi
 
       # Start the application
       ${stdenv.lib.optionalString (package != null && activity != null) ''
-          ${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
+          ${sdk}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
       ''}
     ''}
     EOF