summary refs log tree commit diff
path: root/pkgs/development/mobile/androidenv
diff options
context:
space:
mode:
authorNick Novitski <nick@expo.io>2018-10-22 16:00:14 -0700
committerNick Novitski <nick@expo.io>2018-10-25 11:56:47 -0700
commit950608bae0b4fd15d603c5ec4686c170df85a1d3 (patch)
tree9b55dbff807f03f77c0da089df9c3726c48d993f /pkgs/development/mobile/androidenv
parenta50d57498651180f3459b801b245861f447cad00 (diff)
downloadnixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar.gz
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar.bz2
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar.lz
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar.xz
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.tar.zst
nixpkgs-950608bae0b4fd15d603c5ec4686c170df85a1d3.zip
androidsdk: 25.2.5 -> 26.1.1, license agreement
Diffstat (limited to 'pkgs/development/mobile/androidenv')
-rw-r--r--pkgs/development/mobile/androidenv/androidsdk.nix61
-rw-r--r--pkgs/development/mobile/androidenv/default.nix4
2 files changed, 32 insertions, 33 deletions
diff --git a/pkgs/development/mobile/androidenv/androidsdk.nix b/pkgs/development/mobile/androidenv/androidsdk.nix
index 5f61f25d54e..feef5a787bf 100644
--- a/pkgs/development/mobile/androidenv/androidsdk.nix
+++ b/pkgs/development/mobile/androidenv/androidsdk.nix
@@ -4,10 +4,18 @@
 , freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
 , zlib, glxinfo, xkeyboardconfig
 , includeSources
+, licenseAccepted
 }:
 { platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
 , useGooglePlayServices ? false, useInstantApps ? false }:
 
+if !licenseAccepted then throw ''
+    You must accept the Android Software Development Kit License Agreement at
+    https://developer.android.com/studio/terms
+    by setting nixpkgs config option 'android_sdk.accept_license = true;'
+  ''
+else assert licenseAccepted;
+
 let inherit (stdenv.lib) makeLibraryPath;
 
     googleRepository = let version = "gms_v9_rc41_wear_2_0_rc6";
@@ -20,16 +28,16 @@ in
 
 stdenv.mkDerivation rec {
   name = "android-sdk-${version}";
-  version = "25.2.5";
+  version = "26.1.1";
 
   src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
     then fetchurl {
-      url = "https://dl.google.com/android/repository/tools_r${version}-linux.zip";
-      sha256 = "0gnk49pkwy4m0nqwm1xnf3w4mfpi9w0kk7841xlawpwbkj0icxap";
+      url = "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip";
+      sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
     }
     else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
-      url = "http://dl.google.com/android/repository/tools_r${version}-macosx.zip";
-      sha256 = "0yg7wjmyw70xsh8k4hgbqb5rilam2a94yc8dwbh7fjwqcmpxgwqb";
+      url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
+      sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
     }
     else throw "platform not ${stdenv.hostPlatform.system} supported!";
 
@@ -39,7 +47,7 @@ stdenv.mkDerivation rec {
     unpackFile $src
     cd tools
 
-    for f in android traceview draw9patch hierarchyviewer monitor ddms screenshot2 uiautomatorviewer monkeyrunner jobb lint
+    for f in monitor bin/monkeyrunner bin/uiautomatorviewer
     do
         sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
     done
@@ -54,24 +62,6 @@ stdenv.mkDerivation rec {
           patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i
       done
 
-      ${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
-        for i in bin64/{mkfs.ext4,fsck.ext4,e2fsck,tune2fs,resize2fs}
-        do
-            patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
-            patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
-        done
-      ''}
-
-      ${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
-        # We must also patch the 64-bit emulator instances, if needed
-
-        for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service emulator-check qemu/linux-x86_64/qemu-system-*
-        do
-            patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
-            patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
-        done
-      ''}
-
       # The following scripts used SWT and wants to dynamically load some GTK+ stuff.
       # Creating these wrappers ensure that they can be found:
 
@@ -79,22 +69,18 @@ stdenv.mkDerivation rec {
         --prefix PATH : ${jdk}/bin \
         --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}
 
-      wrapProgram `pwd`/uiautomatorviewer \
-        --prefix PATH : ${jdk}/bin \
-        --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
-
-      wrapProgram `pwd`/hierarchyviewer \
+      wrapProgram `pwd`/bin/uiautomatorviewer \
         --prefix PATH : ${jdk}/bin \
         --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
 
       # The emulators need additional libraries, which are dynamically loaded => let's wrap them
 
       ${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
-        for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service
+        for i in emulator emulator-check
         do
             wrapProgram `pwd`/$i \
               --prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
-              --suffix LD_LIBRARY_PATH : `pwd`/lib64:`pwd`/lib64/qt/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
+              --suffix LD_LIBRARY_PATH : `pwd`/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
               --suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
         done
       ''}
@@ -245,6 +231,14 @@ stdenv.mkDerivation rec {
         fi
     done
 
+    for i in $out/libexec/tools/bin/*
+    do
+        if [ ! -d $i ] && [ -x $i ]
+        then
+            ln -sf $i $out/bin/$(basename $i)
+        fi
+    done
+
     for i in $out/libexec/platform-tools/*
     do
         if [ ! -d $i ] && [ -x $i ]
@@ -260,6 +254,11 @@ stdenv.mkDerivation rec {
             ln -sf $i $out/bin/$(basename $i)
         fi
     done
+
+    wrapProgram $out/bin/sdkmanager \
+      --set JAVA_HOME ${jdk}
+
+    yes | ANDROID_SDK_HOME=$(mktemp -d) $out/bin/sdkmanager --licenses || true
   '';
 
   buildInputs = [ unzip makeWrapper ];
diff --git a/pkgs/development/mobile/androidenv/default.nix b/pkgs/development/mobile/androidenv/default.nix
index 1f61be9440b..bd369200bd5 100644
--- a/pkgs/development/mobile/androidenv/default.nix
+++ b/pkgs/development/mobile/androidenv/default.nix
@@ -1,5 +1,5 @@
 { buildPackages, pkgs, pkgs_i686, targetPackages
-, includeSources ? true
+, includeSources ? true, licenseAccepted ? false
 }:
 
 # TODO: use callPackage instead of import to avoid so many inherits
@@ -57,7 +57,7 @@ rec {
 
     inherit platformTools buildTools support
             supportRepository platforms sysimages
-            addons sources includeSources;
+            addons sources includeSources licenseAccepted;
 
     stdenv_32bit = pkgs_i686.stdenv;
   };