Browse Source

Replace androidenv by new implementation

nixos-19.03
Sander van der Burg 3 years ago
parent
commit
74750dc67d
  1. 3
      .gitignore
  2. 1614
      pkgs/development/mobile/androidenv/addon.xml
  3. 321
      pkgs/development/mobile/androidenv/addons.nix
  4. 120
      pkgs/development/mobile/androidenv/androidndk.nix
  5. 88
      pkgs/development/mobile/androidenv/androidndk_r8e.nix
  6. 296
      pkgs/development/mobile/androidenv/androidsdk.nix
  7. 47
      pkgs/development/mobile/androidenv/build-app.nix
  8. 108
      pkgs/development/mobile/androidenv/build-gradle-app.nix
  9. 376
      pkgs/development/mobile/androidenv/build-tools-srcs-linux.nix
  10. 376
      pkgs/development/mobile/androidenv/build-tools-srcs-macosx.nix
  11. 72
      pkgs/development/mobile/androidenv/build-tools.nix
  12. 10
      pkgs/development/mobile/androidenv/cmake.nix
  13. 255
      pkgs/development/mobile/androidenv/compose-android-packages.nix
  14. 128
      pkgs/development/mobile/androidenv/convertaddons.xsl
  15. 116
      pkgs/development/mobile/androidenv/convertpackages.xsl
  16. 47
      pkgs/development/mobile/androidenv/convertsystemimages.xsl
  17. 346
      pkgs/development/mobile/androidenv/default.nix
  18. 44
      pkgs/development/mobile/androidenv/deploy-androidpackage.nix
  19. 93
      pkgs/development/mobile/androidenv/emulate-app.nix
  20. 20
      pkgs/development/mobile/androidenv/emulator.nix
  21. 14
      pkgs/development/mobile/androidenv/fetch.sh
  22. 3
      pkgs/development/mobile/androidenv/generate-addons.sh
  23. 82
      pkgs/development/mobile/androidenv/generate-addons.xsl
  24. 4
      pkgs/development/mobile/androidenv/generate-platforms.sh
  25. 54
      pkgs/development/mobile/androidenv/generate-platforms.xsl
  26. 3
      pkgs/development/mobile/androidenv/generate-sources.sh
  27. 52
      pkgs/development/mobile/androidenv/generate-sources.xsl
  28. 26
      pkgs/development/mobile/androidenv/generate-sysimages.sh
  29. 20
      pkgs/development/mobile/androidenv/generate-sysimages.xsl
  30. 4
      pkgs/development/mobile/androidenv/generate-tools.sh
  31. 43
      pkgs/development/mobile/androidenv/generate-tools.xsl
  32. 16
      pkgs/development/mobile/androidenv/generate.sh
  33. 1145
      pkgs/development/mobile/androidenv/generated/addons.nix
  34. 1910
      pkgs/development/mobile/androidenv/generated/packages.nix
  35. 157
      pkgs/development/mobile/androidenv/generated/system-images-android-tv.nix
  36. 67
      pkgs/development/mobile/androidenv/generated/system-images-android-wear-cn.nix
  37. 97
      pkgs/development/mobile/androidenv/generated/system-images-android-wear.nix
  38. 547
      pkgs/development/mobile/androidenv/generated/system-images-android.nix
  39. 502
      pkgs/development/mobile/androidenv/generated/system-images-google_apis.nix
  40. 97
      pkgs/development/mobile/androidenv/generated/system-images-google_apis_playstore.nix
  41. 12
      pkgs/development/mobile/androidenv/lldb.nix
  42. 13
      pkgs/development/mobile/androidenv/make-standalone-toolchain_r10e.patch
  43. 13
      pkgs/development/mobile/androidenv/make-standalone-toolchain_r8e.patch
  44. 119
      pkgs/development/mobile/androidenv/make_standalone_toolchain.py_16b.patch
  45. 119
      pkgs/development/mobile/androidenv/make_standalone_toolchain.py_17c.patch
  46. 50
      pkgs/development/mobile/androidenv/ndk-bundle/default.nix
  47. 44
      pkgs/development/mobile/androidenv/ndk-bundle/make_standalone_toolchain.py_18.patch
  48. 56
      pkgs/development/mobile/androidenv/platform-tools.nix
  49. 343
      pkgs/development/mobile/androidenv/platforms-linux.nix
  50. 343
      pkgs/development/mobile/androidenv/platforms-macosx.nix
  51. 27
      pkgs/development/mobile/androidenv/querypackages.sh
  52. 2834
      pkgs/development/mobile/androidenv/repository-11.xml
  53. 184
      pkgs/development/mobile/androidenv/sources.nix
  54. 18
      pkgs/development/mobile/androidenv/support-repository.nix
  55. 18
      pkgs/development/mobile/androidenv/support.nix
  56. 1026
      pkgs/development/mobile/androidenv/sys-img.xml
  57. 305
      pkgs/development/mobile/androidenv/sysimages.nix
  58. 26
      pkgs/development/mobile/androidenv/tools.nix
  59. 62
      pkgs/development/mobile/androidenv/tools/25.nix
  60. 40
      pkgs/development/mobile/androidenv/tools/26.nix
  61. 2
      pkgs/top-level/all-packages.nix

3
.gitignore

@ -13,4 +13,5 @@ result-*
.DS_Store
/pkgs/development/libraries/qt-5/*/tmp/
/pkgs/desktops/kde-5/*/tmp/
/pkgs/desktops/kde-5/*/tmp/
/pkgs/development/mobile/androidenv/xml/*

1614
pkgs/development/mobile/androidenv/addon.xml

File diff suppressed because it is too large

321
pkgs/development/mobile/androidenv/addons.nix

@ -1,321 +0,0 @@
# This file is generated from generate-addons.sh. DO NOT EDIT.
# Execute generate-addons.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildGoogleApis = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
google_apis_3 = buildGoogleApis {
name = "google_apis-3";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-3-r03.zip;
sha1 = "1f92abf3a76be66ae8032257fc7620acbd2b2e3a";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_4 = buildGoogleApis {
name = "google_apis-4";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-4_r02.zip;
sha1 = "9b6e86d8568558de4d606a7debc4f6049608dbd0";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_5 = buildGoogleApis {
name = "google_apis-5";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-5_r01.zip;
sha1 = "46eaeb56b645ee7ffa24ede8fa17f3df70db0503";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_6 = buildGoogleApis {
name = "google_apis-6";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-6_r01.zip;
sha1 = "5ff545d96e031e09580a6cf55713015c7d4936b2";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_7 = buildGoogleApis {
name = "google_apis-7";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-7_r01.zip;
sha1 = "2e7f91e0fe34fef7f58aeced973c6ae52361b5ac";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_8 = buildGoogleApis {
name = "google_apis-8";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-8_r02.zip;
sha1 = "3079958e7ec87222cac1e6b27bc471b27bf2c352";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_9 = buildGoogleApis {
name = "google_apis-9";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-9_r02.zip;
sha1 = "78664645a1e9accea4430814f8694291a7f1ea5d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_10 = buildGoogleApis {
name = "google_apis-10";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-10_r02.zip;
sha1 = "cc0711857c881fa7534f90cf8cc09b8fe985484d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_11 = buildGoogleApis {
name = "google_apis-11";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-11_r01.zip;
sha1 = "5eab5e81addee9f3576d456d205208314b5146a5";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_12 = buildGoogleApis {
name = "google_apis-12";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-12_r01.zip;
sha1 = "e9999f4fa978812174dfeceec0721c793a636e5d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_13 = buildGoogleApis {
name = "google_apis-13";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-13_r01.zip;
sha1 = "3b153edd211c27dc736c893c658418a4f9041417";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_14 = buildGoogleApis {
name = "google_apis-14";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-14_r02.zip;
sha1 = "f8eb4d96ad0492b4c0db2d7e4f1a1a3836664d39";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_15 = buildGoogleApis {
name = "google_apis-15";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-15_r03.zip;
sha1 = "d0d2bf26805eb271693570a1aaec33e7dc3f45e9";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_16 = buildGoogleApis {
name = "google_apis-16";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-16_r04.zip;
sha1 = "ee6acf1b01020bfa8a8e24725dbc4478bee5e792";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_17 = buildGoogleApis {
name = "google_apis-17";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-17_r04.zip;
sha1 = "a076be0677f38df8ca5536b44dfb411a0c808c4f";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_18 = buildGoogleApis {
name = "google_apis-18";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-18_r04.zip;
sha1 = "6109603409debdd40854d4d4a92eaf8481462c8b";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_19 = buildGoogleApis {
name = "google_apis-19";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-19_r20.zip;
sha1 = "5b933abe830b2f25b4c0f171d45e9e0651e56311";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_21 = buildGoogleApis {
name = "google_apis-21";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-21_r01.zip;
sha1 = "66a754efb24e9bb07cc51648426443c7586c9d4a";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_22 = buildGoogleApis {
name = "google_apis-22";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-22_r01.zip;
sha1 = "5def0f42160cba8acff51b9c0c7e8be313de84f5";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_23 = buildGoogleApis {
name = "google_apis-23";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-23_r01.zip;
sha1 = "04c5cc1a7c88967250ebba9561d81e24104167db";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_24 = buildGoogleApis {
name = "google_apis-24";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-24_r1.zip;
sha1 = "31361c2868f27343ee917fbd259c1463821b6145";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_25 = buildGoogleApis {
name = "google_apis-25";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-25_r1.zip;
sha1 = "550e83eea9513ab11c44919ac6da54b36084a9f3";
};
meta = {
description = "Android + Google APIs";
};
};
android_support_extra = buildGoogleApis {
name = "android_support_extra";
src = fetchurl {
url = https://dl.google.com/android/repository/support_r23.2.1.zip;
sha1 = "41121bbc412c2fce0be170d589d20cfa3e78e857";
};
meta = {
description = "Android Support Library";
url = http://developer.android.com/;
};
};
google_play_services = buildGoogleApis {
name = "google_play_services";
src = fetchurl {
url = https://dl.google.com/android/repository/google_play_services_v16_1_rc09.zip;
sha1 = "f95bf19634e2ab0430923247fe2c50246432d2e9";
};
meta = {
description = "Google Play services client library and sample code";
url = http://developer.android.com/;
};
};
instant_apps = buildGoogleApis {
name = "instant_apps_sdk";
src = fetchurl {
url = https://dl.google.com/android/repository/iasdk-1.5.0-1538000167.zip;
sha1 = "6c282b9c686e819fe7f5ac8f2249d2479acb63b4";
};
meta = {
description = "Android Instant Apps Development SDK";
url = "https://developer.android.com/";
};
};
}

120
pkgs/development/mobile/androidenv/androidndk.nix

@ -1,120 +0,0 @@
{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools, python3, libcxx, version, sha1s, bash, runCommand
, fullNDK ? false # set to true if you want other parts of the NDK
# that is not used by Nixpkgs like sources,
# examples, docs, or LLVM toolchains
}:
let
makeStandaloneToolchain = api: arch: let
full_ndk = (ndk true);
in runCommand "makeStandaloneToolchain-${version}" {} ''
${full_ndk}/libexec/${full_ndk.name}/build/tools/make_standalone_toolchain.py --api ${toString api} --arch ${arch} --install-dir $out
'';
ndk = fullNDK: stdenv.mkDerivation rec {
name = "android-ndk-r${version}";
inherit version;
src = fetchurl {
url = "https://dl.google.com/android/repository/${name}-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}.zip";
sha1 = sha1s.${stdenv.hostPlatform.system} or (throw "platform ${stdenv.hostPlatform.system} not supported!");
};
phases = "buildPhase";
nativeBuildInputs = [ unzip makeWrapper file ];
buildCommand = let
bin_path = "$out/bin";
pkg_path = "$out/libexec/${name}";
sed_script_1 =
"'s|^PROGDIR=`dirname $0`" +
"|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
runtime_paths = (lib.makeBinPath [
coreutils file findutils
gawk gnugrep gnused
jdk python3 which
]) + ":${platformTools}/platform-tools";
in ''
mkdir -pv $out/libexec
cd $out/libexec
unzip -qq $src
# so that it doesn't fail because of read-only permissions set
cd -
${if (version == "10e") then
''
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./make-standalone-toolchain_r10e.patch }
''
else
''
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./. + "/make_standalone_toolchain.py_" + "${version}" + ".patch" }
sed -i 's,#!/usr/bin/env python,#!${python3}/bin/python,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
sed -i 's,#!/bin/bash,#!${bash}/bin/bash,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
wrapProgram ${pkg_path}/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
''
}
patchShebangs ${pkg_path}
cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size
rm -rf docs sources tests
# We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm*
'' +
''
find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \
\) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
--set-rpath ${stdenv.lib.makeLibraryPath [ libcxx zlib ncurses5 ]} {} \;
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"}
do
sed -i -e ${sed_script_1} $i
done
# wrap
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"}
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
done
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in ${pkg_path}/prebuilt/linux-x86_64/bin/*
do
if ! isELF $i; then continue; fi
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
''}
# make some executables available in PATH
mkdir -pv ${bin_path}
for i in \
ndk-build ${lib.optionalString (version == "10e") "ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which"}
do
ln -sf ${pkg_path}/$i ${bin_path}/$i
done
'';
meta = {
platforms = builtins.attrNames sha1s;
hydraPlatforms = [];
license = stdenv.lib.licenses.asl20;
};
};
passthru = {
inherit makeStandaloneToolchain;
};
in lib.extendDerivation true passthru (ndk fullNDK)

88
pkgs/development/mobile/androidenv/androidndk_r8e.nix

@ -1,88 +0,0 @@
{ stdenv, fetchurl, zlib, ncurses, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools
, fullNDK ? false # set to true if you want other parts of the NDK
# that is not used by Nixpkgs like sources,
# examples, docs, or LLVM toolchains
}:
stdenv.mkDerivation rec {
name = "android-ndk-r8e";
src = if stdenv.hostPlatform.system == "i686-linux"
then fetchurl {
url = "http://dl.google.com/android/ndk/${name}-linux-x86.tar.bz2";
sha256 = "c2c4e0c8b3037149a0f5dbb08d72f814a52af4da9fff9d80328c675457e95a98";
}
else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
url = "http://dl.google.com/android/ndk/${name}-linux-x86_64.tar.bz2";
sha256 = "093gf55zbh38p2gk5bdykj1vg9p5l774wjdzw5mhk4144jm1wdq7";
}
else throw "platform ${stdenv.hostPlatform.system} not supported!";
phases = "buildPhase";
nativeBuildInputs = [ makeWrapper ];
buildCommand = let
bin_path = "$out/bin";
pkg_path = "$out/libexec/${name}";
sed_script_1 =
"'s|^PROGDIR=`dirname $0`" +
"|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
sed_script_2 =
"'s|^MYNDKDIR=`dirname $0`" +
"|MYNDKDIR=`dirname $(readlink -f $(which $0))`|'";
runtime_paths = (lib.makeBinPath [
coreutils file findutils
gawk gnugrep gnused
jdk
which
]) + ":${platformTools}/platform-tools";
in ''
set -x
mkdir -pv $out/libexec
cd $out/libexec
tar -xjf $src
# so that it doesn't fail because of read-only permissions set
cd -
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch }
cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size
rm -rf docs sources tests
# We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm-*
'' + ''
find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \
\) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
--set-rpath ${stdenv.lib.makeLibraryPath [ zlib ncurses ]} {} \;
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build ndk-gdb ndk-gdb-py
do
sed -i -e ${sed_script_1} $i
done
sed -i -e ${sed_script_2} ndk-which
# a bash script
patchShebangs ndk-which
# wrap
for i in ndk-build ndk-gdb ndk-gdb-py ndk-which
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
done
# make some executables available in PATH
mkdir -pv ${bin_path}
for i in \
ndk-build ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which
do
ln -sf ${pkg_path}/$i ${bin_path}/$i
done
'';
}

296
pkgs/development/mobile/androidenv/androidsdk.nix

@ -1,296 +0,0 @@
{ stdenv, stdenv_32bit, fetchurl, fetchzip, unzip, makeWrapper
, platformTools, buildTools, support, supportRepository, platforms, sysimages, addons, sources
, libX11, libXext, libXrender, libxcb, libXau, libXdmcp, libXtst, libGLU_combined, alsaLib
, freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
, zlib, glxinfo, xkeyboardconfig
, includeSources
, licenseAccepted
}:
{ platformVersions, abiVersions, useGoogleAPIs, buildToolsVersions ? [], 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";
in fetchzip rec {
url = "https://dl-ssl.google.com/android/repository/google_m2repository_${version}.zip";
sha256 = "0k99xmynv0k62d301zx5jnjkddflr51i5lb02l9incg7m5cn8kzx";
};
in
stdenv.mkDerivation rec {
name = "android-sdk-${version}";
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/sdk-tools-linux-4333796.zip";
sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
}
else throw "platform not ${stdenv.hostPlatform.system} supported!";
emulator = fetchurl {
url = "https://dl.google.com/android/repository/emulator-linux-4969155.zip";
sha256 = "0iw0j6j3w9zpfalsa7xq2czz4vzgq96zk2zddjhanwwx4p8fhrfd";
};
buildCommand = ''
mkdir -p $out/libexec
cd $out/libexec
unpackFile $src
unpackFile $emulator
cd tools
for f in monitor bin/monkeyrunner bin/uiautomatorviewer
do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
''
# There are a number of native binaries. We must patch them to let them find the interpreter and libstdc++
for i in mksdcard
do
patchelf --set-interpreter ${stdenv_32bit.cc.libc.out}/lib/ld-linux.so.2 $i
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i
done
# The following scripts used SWT and wants to dynamically load some GTK+ stuff.
# Creating these wrappers ensure that they can be found:
wrapProgram `pwd`/android \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}
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") ''
cd ..
for i in emulator/emulator* emulator/qemu/linux-x86_64/qemu-system-*
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
wrapProgram `pwd`/$i \
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
--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
cd tools
''}
''}
patchShebangs .
${if stdenv.hostPlatform.system == "i686-linux" then
''
# The monitor requires some more patching
cd lib/monitor-x86
patchelf --set-interpreter ${stdenv_32bit.cc.libc.out}/lib/ld-linux.so.2 monitor
patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
wrapProgram `pwd`/monitor \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
cd ../..
''
else if stdenv.hostPlatform.system == "x86_64-linux" then
''
# The monitor requires some more patching
cd lib/monitor-x86_64
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 monitor
patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
wrapProgram `pwd`/monitor \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
cd ../..
''
else ""}
# Symlink the other sub packages
cd ..
ln -s ${platformTools}/platform-tools
ln -s ${support}/support
mkdir -p build-tools
cd build-tools
${stdenv.lib.concatMapStrings
(v: "ln -s ${builtins.getAttr "v${builtins.replaceStrings ["."] ["_"] v}" buildTools}/build-tools/*")
(if (builtins.length buildToolsVersions) == 0 then platformVersions else buildToolsVersions)}
cd ..
# Symlink required Google API add-ons
mkdir -p add-ons
cd add-ons
${if useGoogleAPIs then
stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("google_apis_"+platformVersion) addons) then
let
googleApis = builtins.getAttr ("google_apis_"+platformVersion) addons;
in
"ln -s ${googleApis}/* addon-google_apis-${platformVersion}\n"
else "") platformVersions
else ""}
cd ..
# Symlink required extras
mkdir -p extras/android
cd extras/android
ln -s ${supportRepository}/m2repository
${if useExtraSupportLibs then
"ln -s ${addons.android_support_extra}/support ."
else ""}
cd ..
mkdir -p google
cd google
${if useGooglePlayServices then
"ln -s ${addons.google_play_services}/google-play-services google_play_services"
else ""}
${stdenv.lib.optionalString useInstantApps
"ln -s ${addons.instant_apps}/whsdk instantapps"}
ln -s ${googleRepository} m2repository
cd ../..
# Symlink required sources
mkdir -p sources
cd sources
${if includeSources then
stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("source_"+platformVersion) sources) then
let
source = builtins.getAttr ("source_"+platformVersion) sources;
in
"ln -s ${source}/* android-${platformVersion}\n"
else "") platformVersions
else ""}
cd ..
# Symlink required platforms
mkdir -p platforms
cd platforms
${stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("platform_"+platformVersion) platforms) then
let
platform = builtins.getAttr ("platform_"+platformVersion) platforms;
in
"ln -s ${platform}/* android-${platformVersion}\n"
else ""
) platformVersions}
cd ..
# Symlink required system images
mkdir -p system-images
cd system-images
${stdenv.lib.concatMapStrings (abiVersion:
stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("sysimg_" + abiVersion + "_" + platformVersion) sysimages) then
let
sysimg = builtins.getAttr ("sysimg_" + abiVersion + "_" + platformVersion) sysimages;
in
''
mkdir -p android-${platformVersion}
cd android-${platformVersion}
ln -s ${sysimg}/*
cd ..
''
else ""
) platformVersions
) abiVersions}
# Create wrappers to the most important tools and platform tools so that we can run them if the SDK is in our PATH
mkdir -p $out/bin
for i in $out/libexec/tools/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
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 ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
for i in $out/libexec/build-tools/*/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
for i in $out/libexec/emulator/*
do
if [ ! -d $i ] && [ -x $i ]
then
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 ];
meta = {
platforms = stdenv.lib.platforms.unix;
hydraPlatforms = [];
license = stdenv.lib.licenses.unfree;
};
}

47
pkgs/development/mobile/androidenv/build-app.nix

@ -1,28 +1,26 @@
{ stdenv, androidsdk, jdk, ant, androidndk, gnumake, gawk, file, which }:
args@{ name, src, platformVersions ? [ "8" ], useGoogleAPIs ? false, antFlags ? ""
{ composeAndroidPackages, stdenv, ant, jdk, gnumake, gawk }:
{ name
, release ? false, keyStore ? null, keyAlias ? null, keyStorePassword ? null, keyAliasPassword ? null
, useNDK ? false, ...
}:
, antFlags ? ""
, ...
}@args:
assert release -> keyStore != null && keyAlias != null && keyStorePassword != null && keyAliasPassword != null;
let
androidsdkComposition = androidsdk {
inherit platformVersions useGoogleAPIs;
abiVersions = [];
};
androidSdkFormalArgs = builtins.functionArgs composeAndroidPackages;
androidArgs = builtins.intersectAttrs androidSdkFormalArgs args;
androidsdk = (composeAndroidPackages androidArgs).androidsdk;
extraArgs = removeAttrs args ([ "name" ] ++ builtins.attrNames androidSdkFormalArgs);
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
ANDROID_HOME = "${androidsdkComposition}/libexec";
buildInputs = [ jdk ant ] ++
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ];
name = stdenv.lib.replaceChars [" "] [""] name; # Android APKs may contain white spaces in their names, but Nix store paths cannot
ANDROID_HOME = "${androidsdk}/libexec/android-sdk";
buildInputs = [ jdk ant ];
buildPhase = ''
${stdenv.lib.optionalString release ''
# Provide key singing attributes
( echo "key.store=${keyStore}"
echo "key.alias=${keyAlias}"
@ -32,20 +30,19 @@ stdenv.mkDerivation ({
''}
export ANDROID_SDK_HOME=`pwd` # Key files cannot be stored in the user's home directory. This overrides it.
${if useNDK then ''
export GNUMAKE=${gnumake}/bin/make
export NDK_HOST_AWK=${gawk}/bin/gawk
${androidndk}/bin/ndk-build
'' else ""}
${stdenv.lib.optionalString (args ? includeNDK && args.includeNDK) ''
export GNUMAKE=${gnumake}/bin/make
export NDK_HOST_AWK=${gawk}/bin/gawk
${androidsdk}/libexec/android-sdk/ndk-bundle/ndk-build
''}
ant ${antFlags} ${if release then "release" else "debug"}
'';
installPhase = ''
mkdir -p $out
mv bin/*-${if release then "release" else "debug"}.apk $out
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.apk)\"" > $out/nix-support/hydra-build-products
'';
} //
builtins.removeAttrs args ["name"])
} // extraArgs)

108
pkgs/development/mobile/androidenv/build-gradle-app.nix

@ -1,108 +0,0 @@
{ stdenv, androidsdk, jdk, androidndk, gnumake, gawk, file
, which, gradle, fetchurl, buildEnv, runCommand }:
args@{ name, src, platformVersions ? [ "8" ], useGoogleAPIs ? false
, useExtraSupportLibs ? false, useGooglePlayServices ? false
, release ? false, keyStore ? null, keyAlias ? null
, keyStorePassword ? null, keyAliasPassword ? null
, useNDK ? false, buildInputs ? [], mavenDeps, gradleTask
, buildDirectory ? "./.", acceptAndroidSdkLicenses ? false }:
assert release -> keyStore != null;
assert release -> keyAlias != null;
assert release -> keyStorePassword != null;
assert release -> keyAliasPassword != null;
assert acceptAndroidSdkLicenses;
let
inherit (stdenv.lib) optionalString;
m2install = { repo, version, artifactId, groupId
, jarSha256, pomSha256, aarSha256, suffix ? "" }:
let m2Name = "${artifactId}-${version}";
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
in runCommand m2Name {} (''
mkdir -p $out/m2/${m2Path}
'' + optionalString (jarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.jar";
sha256 = jarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.jar
'' + optionalString (pomSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.pom";
sha256 = pomSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.pom
'' + optionalString (aarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.aar";
sha256 = aarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.aar
'');
androidsdkComposition = androidsdk {
inherit platformVersions useGoogleAPIs
useExtraSupportLibs useGooglePlayServices;
abiVersions = [ "armeabi-v7a" ];
};
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
ANDROID_HOME = "${androidsdkComposition}/libexec";
ANDROID_NDK_HOME = "${androidndk}/libexec/${androidndk.name}";
buildInputs = [ jdk gradle ] ++
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ] ++
buildInputs;
DEPENDENCIES = buildEnv { name = "${name}-maven-deps";
paths = map m2install mavenDeps;
};
buildPhase = ''
${optionalString release ''
# Provide key signing attributes
( echo "RELEASE_STORE_FILE=${keyStore}"
echo "RELEASE_KEY_ALIAS=${keyAlias}"
echo "RELEASE_STORE_PASSWORD=${keyStorePassword}"
echo "RELEASE_KEY_PASSWORD=${keyAliasPassword}"
) >> gradle.properties
''}
buildDir=`pwd`
cp -r $ANDROID_HOME $buildDir/local_sdk
chmod -R 755 local_sdk
export ANDROID_HOME=$buildDir/local_sdk
# Key files cannot be stored in the user's home directory. This
# overrides it.
export ANDROID_SDK_HOME=`pwd`
mkdir -p "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
export APP_HOME=`pwd`
mkdir -p .m2/repository
if [ -d "$DEPENDENCIES/m2" ] ; then
cp -RL "$DEPENDENCIES"/m2/* .m2/repository/
fi
chmod -R 755 .m2
mkdir -p .m2/repository/com/android/support
cp -RL local_sdk/extras/android/m2repository/com/android/support/* .m2/repository/com/android/support/
cp -RL local_sdk/extras/google/m2repository/* .m2/repository/
gradle ${gradleTask} --offline --no-daemon -g ./tmp -Dmaven.repo.local=`pwd`/.m2/repository
'';
installPhase = ''
mkdir -p $out
mv ${buildDirectory}/build/outputs/apk/*.apk $out
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.apk)\"" > $out/nix-support/hydra-build-products
'';
meta = {
license = stdenv.lib.licenses.unfree;
};
} // builtins.removeAttrs args ["name" "mavenDeps"])

376
pkgs/development/mobile/androidenv/build-tools-srcs-linux.nix

@ -1,376 +0,0 @@
# This file is generated from generate-tools.sh. DO NOT EDIT.
# Execute generate-tools.sh or fetch.sh to update the file.
{ fetchurl }:
{
v17 = {
version = "17.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r17-linux.zip;
sha1 = "2c2872bc3806aabf16a12e3959c2183ddc866e6d";
};
};
v18_0_1 = {
version = "18.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.0.1-linux.zip;
sha1 = "f11618492b0d2270c332325d45d752d3656a9640";
};
};
v18_1_0 = {
version = "18.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1-linux.zip;
sha1 = "f314a0599e51397f0886fe888b50dd98f2f050d8";
};
};
v18_1_1 = {
version = "18.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1.1-linux.zip;
sha1 = "68c9acbfc0cec2d51b19efaed39831a17055d998";
};
};
v19 = {
version = "19.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19-linux.zip;
sha1 = "55c1a6cf632e7d346f0002b275ec41fd3137fd83";
};
};
v19_0_1 = {
version = "19.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.1-linux.zip;
sha1 = "18d2312dc4368858914213087f4e61445aca4517";
};
};
v19_0_2 = {
version = "19.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.2-linux.zip;
sha1 = "a03a6bdea0091aea32e1b35b90a7294c9f04e3dd";
};
};
v19_0_3 = {
version = "19.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.3-linux.zip;
sha1 = "c2d6055478e9d2d4fba476ee85f99181ddd1160c";
};
};
v19_1_0 = {
version = "19.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.1-linux.zip;
sha1 = "1ff20ac15fa47a75d00346ec12f180d531b3ca89";
};
};
v20 = {
version = "20.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r20-linux.zip;
sha1 = "b688905526a5584d1327a662d871a635ff502758";
};
};
v21 = {
version = "21.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21-linux.zip;
sha1 = "4933328fdeecbd554a29528f254f4993468e1cf4";
};
};
v21_0_1 = {
version = "21.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.1-linux.zip;
sha1 = "e573069eea3e5255e7a65bedeb767f4fd0a5f49a";
};
};
v21_0_2 = {
version = "21.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.2-linux.zip;
sha1 = "e1236ab8897b62b57414adcf04c132567b2612a5";
};
};
v21_1_0 = {
version = "21.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1-linux.zip;
sha1 = "b7455e543784d52a8925f960bc880493ed1478cb";
};
};
v21_1_1 = {
version = "21.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.1-linux.zip;
sha1 = "1c712ee3a1ba5a8b0548f9c32f17d4a0ddfd727d";
};
};
v21_1_2 = {
version = "21.1.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.2-linux.zip;
sha1 = "5e35259843bf2926113a38368b08458735479658";
};
};
v22 = {
version = "22.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22-linux.zip;
sha1 = "a8a1619dd090e44fac957bce6842e62abf87965b";
};
};
v22_0_1 = {
version = "22.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22.0.1-linux.zip;
sha1 = "da8b9c5c3ede39298e6cf0283c000c2ee9029646";
};
};
v23 = {
version = "23.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23-linux.zip;
sha1 = "c1d6209212b01469f80fa804e0c1d39a06bc9060";
};
};
v23_0_1 = {
version = "23.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.1-linux.zip;
sha1 = "b6ba7c399d5fa487d95289d8832e4ad943aed556";
};
};
v23_0_2 = {
version = "23.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.2-linux.zip;
sha1 = "8a9f2b37f6fcf7a9fa784dc21aeaeb41bbb9f2c3";
};
};
v23_0_3 = {
version = "23.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.3-linux.zip;
sha1 = "368f2600feac7e9b511b82f53d1f2240ae4a91a3";
};
};
v24 = {
version = "24.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24-linux.zip;
sha1 = "c6271c4d78a5612ea6c7150688bcd5b7313de8d1";
};
};
v24_0_1 = {
version = "24.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.1-linux.zip;
sha1 = "84f18c392919a074fcbb9b1d967984e6b2fef8b4";
};
};
v24_0_2 = {
version = "24.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.2-linux.zip;
sha1 = "f199a7a788c3fefbed102eea34d6007737b803cf";
};
};
v24_0_3 = {
version = "24.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.3-linux.zip;
sha1 = "9e8cc49d66e03fa1a8ecc1ac3e58f1324f5da304";
};
};
v25 = {
version = "25.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25-linux.zip;
sha1 = "f2bbda60403e75cabd0f238598c3b4dfca56ea44";
};
};
v25_0_1 = {
version = "25.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.1-linux.zip;
sha1 = "ff063d252ab750d339f5947d06ff782836f22bac";
};
};
v25_0_2 = {
version = "25.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.2-linux.zip;
sha1 = "ff953c0177e317618fda40516f3e9d95fd43c7ae";
};
};
v25_0_3 = {
version = "25.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.3-linux.zip;
sha1 = "db95f3a0ae376534d4d69f4cdb6fad20649f3509";
};
};
v26 = {
version = "26.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-linux.zip;
sha1 = "1cbe72929876f8a872ab1f1b1040a9f720261f59";
};
};
v26_rc1 = {
version = "26.0.0-rc1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc1-linux.zip;
sha1 = "8cd6388dc96db2d7a49d06159cf990d3bbc78d04";
};
};
v26_rc2 = {
version = "26.0.0-rc2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc2-linux.zip;
sha1 = "629bbd8d2e415bf64871fb0b4c0540fd6d0347a0";
};
};
v26_0_1 = {
version = "26.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip;
sha1 = "5378c2c78091b414d0eac40a6bd37f2faa31a365";
};
};
v26_0_2 = {
version = "26.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip;
sha1 = "5b2b7b66c7bf2151f2af183b5b50a17808850592";
};
};
v26_0_3 = {
version = "26.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.3-linux.zip;
sha1 = "8a2e6c1bcd845844523a68aa17e5442f0dce328c";
};
};
v27 = {
version = "27.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27-linux.zip;
sha1 = "28542332ba97cf4a08c3eddfcf5edd70e3cf1260";
};
};
v27_0_1 = {
version = "27.0.1";