summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2021-01-10 15:09:36 +0000
committerGitHub <noreply@github.com>2021-01-10 15:09:36 +0000
commit51894963cbdc41f0cd8f571b7bcf79437d940355 (patch)
tree1db522e1af0f8d171aae79e4cccef795b6f196a8
parent9f8b7cb4a8948afe0701e5d717a4ee9cbf38163c (diff)
parent5b91d4ab65748285ffad3e309bba2e7475c7d3db (diff)
Merge pull request #89775 from numinit/update-androidenv
-rw-r--r--doc/languages-frameworks/android.section.md159
-rw-r--r--nixos/doc/manual/release-notes/rl-2103.xml16
-rw-r--r--pkgs/development/mobile/androidenv/.gitignore2
-rw-r--r--pkgs/development/mobile/androidenv/cmake.nix4
-rw-r--r--pkgs/development/mobile/androidenv/compose-android-packages.nix197
-rw-r--r--pkgs/development/mobile/androidenv/convertaddons.xsl128
-rw-r--r--pkgs/development/mobile/androidenv/convertpackages.xsl116
-rw-r--r--pkgs/development/mobile/androidenv/convertsystemimages.xsl76
-rw-r--r--pkgs/development/mobile/androidenv/examples/shell.nix145
-rwxr-xr-xpkgs/development/mobile/androidenv/fetchrepo.sh26
-rwxr-xr-xpkgs/development/mobile/androidenv/generate.sh37
-rw-r--r--pkgs/development/mobile/androidenv/generated/addons.nix964
-rw-r--r--pkgs/development/mobile/androidenv/generated/packages.nix2563
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-android-tv.nix114
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-android-wear-cn.nix44
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-android-wear.nix64
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-android.nix364
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-google_apis.nix384
-rw-r--r--pkgs/development/mobile/androidenv/generated/system-images-google_apis_playstore.nix64
-rw-r--r--pkgs/development/mobile/androidenv/lldb.nix12
-rw-r--r--pkgs/development/mobile/androidenv/mkrepo.rb321
-rwxr-xr-xpkgs/development/mobile/androidenv/mkrepo.sh19
-rw-r--r--pkgs/development/mobile/androidenv/ndk-bundle/default.nix32
-rwxr-xr-x[-rw-r--r--]pkgs/development/mobile/androidenv/querypackages.sh36
-rw-r--r--pkgs/development/mobile/androidenv/repo.json5343
25 files changed, 6161 insertions, 5069 deletions
diff --git a/doc/languages-frameworks/android.section.md b/doc/languages-frameworks/android.section.md
index cfbacf1bccdc..62e544cd48b6 100644
--- a/doc/languages-frameworks/android.section.md
+++ b/doc/languages-frameworks/android.section.md
@@ -13,21 +13,19 @@ with import <nixpkgs> {};
let
androidComposition = androidenv.composeAndroidPackages {
- toolsVersion = "25.2.5";
- platformToolsVersion = "27.0.1";
- buildToolsVersions = [ "27.0.3" ];
+ toolsVersion = "26.1.1";
+ platformToolsVersion = "30.0.5";
+ buildToolsVersions = [ "30.0.3" ];
includeEmulator = false;
- emulatorVersion = "27.2.0";
- platformVersions = [ "24" ];
+ emulatorVersion = "30.3.4";
+ platformVersions = [ "28" "29" "30" ];
includeSources = false;
- includeDocs = false;
includeSystemImages = false;
- systemImageTypes = [ "default" ];
- abiVersions = [ "armeabi-v7a" ];
- lldbVersions = [ "2.0.2558144" ];
- cmakeVersions = [ "3.6.4111459" ];
- includeNDK = false;
- ndkVersion = "16.1.4479499";
+ systemImageTypes = [ "google_apis_playstore" ];
+ abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
+ cmakeVersions = [ "3.10.2" ];
+ includeNDK = true;
+ ndkVersion = "22.0.7026061";
useGoogleAPIs = false;
useGoogleTVAddOns = false;
includeExtras = [
@@ -46,13 +44,11 @@ The following parameters are supported:
* `toolsVersion`, specifies the version of the tools package to use
* `platformsToolsVersion` specifies the version of the `platform-tools` plugin
-* `buildToolsVersion` specifies the versions of the `build-tools` plugins to
+* `buildToolsVersions` specifies the versions of the `build-tools` plugins to
use.
* `includeEmulator` specifies whether to deploy the emulator package (`false`
by default). When enabled, the version of the emulator to deploy can be
specified by setting the `emulatorVersion` parameter.
-* `includeDocs` specifies whether the documentation catalog should be included.
-* `lldbVersions` specifies what LLDB versions should be deployed.
* `cmakeVersions` specifies which CMake versions should be deployed.
* `includeNDK` specifies that the Android NDK bundle should be included.
Defaults to: `false`.
@@ -82,6 +78,38 @@ For each requested system image we can specify the following options:
Most of the function arguments have reasonable default settings.
+You can specify license names:
+
+* `extraLicenses` is a list of of license names.
+ You can get these names from repo.json or `querypackages.sh licenses`. The SDK
+ license (`android-sdk-license`) is accepted for you if you set accept_license
+ to true. If you are doing something like working with preview SDKs, you will
+ want to add `android-sdk-preview-license` or whichever license applies here.
+
+Additionally, you can override the repositories that composeAndroidPackages will
+pull from:
+
+* `repoJson` specifies a path to a generated repo.json file. You can generate this
+ by running `generate.sh`, which in turn will call into `mkrepo.rb`.
+* `repoXmls` is an attribute set containing paths to repo XML files. If specified,
+ it takes priority over `repoJson`, and will trigger a local build writing out a
+ repo.json to the Nix store based on the given repository XMLs.
+
+```nix
+repoXmls = {
+ packages = [ ./xml/repository2-1.xml ];
+ images = [
+ ./xml/android-sys-img2-1.xml
+ ./xml/android-tv-sys-img2-1.xml
+ ./xml/android-wear-sys-img2-1.xml
+ ./xml/android-wear-cn-sys-img2-1.xml
+ ./xml/google_apis-sys-img2-1.xml
+ ./xml/google_apis_playstore-sys-img2-1.xml
+ ];
+ addons = [ ./xml/addon2-1.xml ];
+};
+```
+
When building the above expression with:
```bash
@@ -104,8 +132,8 @@ in
androidComposition.platform-tools
```
-Using predefine Android package compositions
---------------------------------------------
+Using predefined Android package compositions
+---------------------------------------------
In addition to composing an Android package set manually, it is also possible
to use a predefined composition that contains all basic packages for a specific
Android version, such as version 9.0 (API-level 28).
@@ -209,27 +237,104 @@ androidenv.emulateApp {
In addition to prebuilt APKs, you can also bind the APK parameter to a
`buildApp {}` function invocation shown in the previous example.
+Notes on environment variables in Android projects
+--------------------------------------------------
+* `ANDROID_SDK_ROOT` should point to the Android SDK. In your Nix expressions, this should be
+ `${androidComposition.androidsdk}/libexec/android-sdk`. Note that `ANDROID_HOME` is deprecated,
+ but if you rely on tools that need it, you can export it too.
+* `ANDROID_NDK_ROOT` should point to the Android NDK, if you're doing NDK development.
+ In your Nix expressions, this should be `${ANDROID_SDK_ROOT}/ndk-bundle`.
+
+If you are running the Android Gradle plugin, you need to export GRADLE_OPTS to override aapt2
+to point to the aapt2 binary in the Nix store as well, or use a FHS environment so the packaged
+aapt2 can run. If you don't want to use a FHS environment, something like this should work:
+
+```nix
+let
+ buildToolsVersion = "30.0.3";
+
+ # Use buildToolsVersion when you define androidComposition
+ androidComposition = <...>;
+in
+pkgs.mkShell rec {
+ ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
+ ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
+
+ # Use the same buildToolsVersion here
+ GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
+}
+```
+
+If you are using cmake, you need to add it to PATH in a shell hook or FHS env profile.
+The path is suffixed with a build number, but properly prefixed with the version.
+So, something like this should suffice:
+
+```nix
+let
+ cmakeVersion = "3.10.2";
+
+ # Use cmakeVersion when you define androidComposition
+ androidComposition = <...>;
+in
+pkgs.mkShell rec {
+ ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
+ ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
+
+ # Use the same cmakeVersion here
+ shellHook = ''
+ export PATH="$(echo "$ANDROID_SDK_ROOT/cmake/${cmakeVersion}".*/bin):$PATH"
+ '';
+}
+```
+
+Note that running Android Studio with ANDROID_SDK_ROOT set will automatically write a
+`local.properties` file with `sdk.dir` set to $ANDROID_SDK_ROOT if one does not already
+exist. If you are using the NDK as well, you may have to add `ndk.dir` to this file.
+
+An example shell.nix that does all this for you is provided in examples/shell.nix.
+This shell.nix includes a shell hook that overwrites local.properties with the correct
+sdk.dir and ndk.dir values. This will ensure that the SDK and NDK directories will
+both be correct when you run Android Studio inside nix-shell.
+
+Notes on improving build.gradle compatibility
+---------------------------------------------
+Ensure that your buildToolsVersion and ndkVersion match what is declared in androidenv.
+If you are using cmake, make sure its declared version is correct too.
+
+Otherwise, you may get cryptic errors from aapt2 and the Android Gradle plugin warning
+that it cannot install the build tools because the SDK directory is not writeable.
+
+```gradle
+android {
+ buildToolsVersion "30.0.3"
+ ndkVersion = "22.0.7026061"
+ externalNativeBuild {
+ cmake {
+ version "3.10.2"
+ }
+ }
+}
+
+```
+
Querying the available versions of each plugin
----------------------------------------------
-When using any of the previously shown functions, it may be a bit inconvenient
-to find out what options are supported, since the Android SDK provides many
-plugins.
+repo.json provides all the options in one file now.
-A shell script in the `pkgs/development/mobile/androidenv/` sub directory can be used to retrieve all
+A shell script in the `pkgs/development/mobile/androidenv/` subdirectory can be used to retrieve all
possible options:
```bash
-sh ./querypackages.sh packages build-tools
+./querypackages.sh packages
```
-The above command-line instruction queries all build-tools versions in the
-generated `packages.nix` expression.
+The above command-line instruction queries all package versions in repo.json.
Updating the generated expressions
----------------------------------
-Most of the Nix expressions are generated from XML files that the Android
-package manager uses. To update the expressions run the `generate.sh` script
-that is stored in the `pkgs/development/mobile/androidenv/` sub directory:
+repo.json is generated from XML files that the Android Studio package manager uses.
+To update the expressions run the `generate.sh` script that is stored in the
+`pkgs/development/mobile/androidenv/` subdirectory:
```bash
./generate.sh
diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml
index e0857e7731ee..6d1a581114b3 100644
--- a/nixos/doc/manual/release-notes/rl-2103.xml
+++ b/nixos/doc/manual/release-notes/rl-2103.xml
@@ -362,6 +362,22 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e
official documentation</link> of the json_exporter.
</para>
</listitem>
+ <listitem>
+ <para>
+ Androidenv was updated, removing the <literal>includeDocs</literal> and <literal>lldbVersions</literal>
+ arguments. Docs only covered a single version of the Android SDK, LLDB is now bundled with the NDK,
+ and both are no longer available to download from the Android package repositories. Additionally, since
+ the package lists have been updated, some older versions of Android packages may not be bundled. If you
+ depend on older versions of Android packages, we recommend overriding the repo.
+ </para>
+ <para>
+ Android packages are now loaded from a repo.json file created by parsing Android repo XML files. The arguments
+ <literal>repoJson</literal> and <literal>repoXmls</literal> have been added to allow overriding the built-in
+ androidenv repo.json with your own. Additionally, license files are now written to allow compatibility
+ with Gradle-based tools, and the <literal>extraLicenses</literal> argument has been added to accept more
+ SDK licenses if your project requires it. See the androidenv documentation for more details.
+ </para>
+ </listitem>
</itemizedlist>
</section>
diff --git a/pkgs/development/mobile/androidenv/.gitignore b/pkgs/development/mobile/androidenv/.gitignore
new file mode 100644
index 000000000000..c15750760a44
--- /dev/null
+++ b/pkgs/development/mobile/androidenv/.gitignore
@@ -0,0 +1,2 @@
+/xml
+local.properties
diff --git a/pkgs/development/mobile/androidenv/cmake.nix b/pkgs/development/mobile/androidenv/cmake.nix
index 1aeef467642c..ade111cf3f9e 100644
--- a/pkgs/development/mobile/androidenv/cmake.nix
+++ b/pkgs/development/mobile/androidenv/cmake.nix
@@ -2,8 +2,8 @@
deployAndroidPackage {
inherit package os;
- buildInputs = [ autoPatchelfHook ]
- ++ lib.optional (os == "linux") [ pkgs.stdenv.glibc pkgs.stdenv.cc.cc ];
+ nativeBuildInputs = [ autoPatchelfHook ];
+ buildInputs = lib.optional (os == "linux") [ pkgs.stdenv.glibc pkgs.stdenv.cc.cc pkgs.ncurses5 ];
patchInstructions = lib.optionalString (os == "linux") ''
autoPatchelf $packageBaseDir/bin
'';
diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix
index 794de2276645..fd78fa9ac0f8 100644
--- a/pkgs/development/mobile/androidenv/compose-android-packages.nix
+++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix
@@ -1,23 +1,26 @@
-{requireFile, autoPatchelfHook, pkgs, pkgsHostHost, pkgs_i686, licenseAccepted ? false}:
+{ requireFile, autoPatchelfHook, pkgs, pkgsHostHost, pkgs_i686
+, licenseAccepted ? false
+}:
-{ toolsVersion ? "25.2.5"
-, platformToolsVersion ? "29.0.6"
-, buildToolsVersions ? [ "28.0.3" ]
+{ toolsVersion ? "26.1.1"
+, platformToolsVersion ? "30.0.5"
+, buildToolsVersions ? [ "30.0.3" ]
, includeEmulator ? false
-, emulatorVersion ? "30.0.3"
+, emulatorVersion ? "30.3.4"
, platformVersions ? []
, includeSources ? false
-, includeDocs ? false
, includeSystemImages ? false
-, systemImageTypes ? [ "default" ]
+, systemImageTypes ? [ "google_apis_playstore" ]
, abiVersions ? [ "armeabi-v7a" ]
-, lldbVersions ? [ ]
, cmakeVersions ? [ ]
, includeNDK ? false
-, ndkVersion ? "21.0.6113669"
+, ndkVersion ? "22.0.7026061"
, useGoogleAPIs ? false
, useGoogleTVAddOns ? false
, includeExtras ? []
+, repoJson ? ./repo.json
+, repoXmls ? null
+, extraLicenses ? []
}:
let
@@ -28,48 +31,86 @@ let
else if stdenv.system == "x86_64-darwin" then "macosx"
else throw "No Android SDK tarballs are available for system architecture: ${stdenv.system}";
- # Generated Nix packages
- packages = import ./generated/packages.nix {
- inherit fetchurl;
- };
-
- # Generated system images
- system-images-packages-android = import ./generated/system-images-android.nix {
- inherit fetchurl;
- };
-
- system-images-packages-android-tv = import ./generated/system-images-android-tv.nix {
- inherit fetchurl;
- };
-
- system-images-packages-android-wear = import ./generated/system-images-android-wear.nix {
- inherit fetchurl;
- };
-
- system-images-packages-android-wear-cn = import ./generated/system-images-android-wear-cn.nix {
- inherit fetchurl;
- };
-
- system-images-packages-google_apis = import ./generated/system-images-google_apis.nix {
- inherit fetchurl;
+ # Uses mkrepo.rb to create a repo spec.
+ mkRepoJson = { packages ? [], images ? [], addons ? [] }: let
+ mkRepoRuby = (pkgs.ruby.withPackages (pkgs: with pkgs; [ slop nokogiri ]));
+ mkRepoRubyArguments = lib.lists.flatten [
+ (builtins.map (package: ["--packages" "${package}"]) packages)
+ (builtins.map (image: ["--images" "${image}"]) images)
+ (builtins.map (addon: ["--addons" "${addon}"]) addons)
+ ];
+ in
+ stdenv.mkDerivation {
+ name = "androidenv-repo-json";
+ buildInputs = [ mkRepoRuby ];
+ preferLocalBuild = true;
+ unpackPhase = "true";
+ buildPhase = ''
+ ruby ${./mkrepo.rb} ${lib.escapeShellArgs mkRepoRubyArguments} > repo.json
+ '';
+ installPhase = ''
+ mv repo.json $out
+ '';
};
- system-images-packages-google_apis_playstore = import ./generated/system-images-google_apis_playstore.nix {
- inherit fetchurl;
+ # Reads the repo JSON. If repoXmls is provided, will build a repo JSON into the Nix store.
+ repo = if repoXmls != null then
+ let
+ repoXmlSpec = {
+ packages = repoXmls.packages or [];
+ images = repoXmls.images or [];
+ addons = repoXmls.addons or [];
+ };
+ in
+ builtins.fromJSON (builtins.readFile "${mkRepoJson repoXmlSpec}")
+ else
+ builtins.fromJSON (builtins.readFile repoJson);
+
+ # Converts all 'archives' keys in a repo spec to fetchurl calls.
+ fetchArchives = attrSet:
+ lib.attrsets.mapAttrsRecursive
+ (path: value:
+ if (builtins.elemAt path ((builtins.length path) - 1)) == "archives" then
+ (builtins.listToAttrs
+ (builtins.map
+ (archive: lib.attrsets.nameValuePair archive.os (fetchurl { inherit (archive) url sha1; })) value))
+ else value
+ )
+ attrSet;
+
+ # Converts the repo attrset into fetch calls
+ packages = fetchArchives repo.packages;
+ system-images-packages = fetchArchives repo.images;
+ addons = {
+ addons = fetchArchives repo.addons;
+ extras = fetchArchives repo.extras;
};
- system-images-packages =
- lib.recursiveUpdate
- system-images-packages-android
- (lib.recursiveUpdate system-images-packages-android-tv
- (lib.recursiveUpdate system-images-packages-android-wear
- (lib.recursiveUpdate system-images-packages-android-wear-cn
- (lib.recursiveUpdate system-images-packages-google_apis system-images-packages-google_apis_playstore))));
-
- # Generated addons
- addons = import ./generated/addons.nix {
- inherit fetchurl;
- };
+ # Converts a license name to a list of license texts.
+ mkLicenses = licenseName: repo.licenses.${licenseName};
+
+ # Converts a list of license names to a flattened list of license texts.
+ # Just used for displaying licenses.
+ mkLicenseTexts = licenseNames:
+ lib.lists.flatten
+ (builtins.map
+ (licenseName:
+ builtins.map
+ (licenseText: "--- ${licenseName} ---\n${licenseText}")
+ (mkLicenses licenseName))
+ licenseNames);
+
+ # Converts a license name to a list of license hashes.
+ mkLicenseHashes = licenseName:
+ builtins.map
+ (licenseText: builtins.hashString "sha1" licenseText)
+ (mkLicenses licenseName);
+
+ # The list of all license names we're accepting. Put android-sdk-license there
+ # by default.
+ licenseNames = lib.lists.unique ([
+ "android-sdk-license"
+ ] ++ extraLicenses);
in
rec {
deployAndroidPackage = import ./deploy-androidpackage.nix {
@@ -88,14 +129,9 @@ rec {
}
) buildToolsVersions;
- docs = deployAndroidPackage {
- inherit os;
- package = packages.docs."1";
- };
-
emulator = import ./emulator.nix {
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgs_i686 lib;
- package = packages.emulator.${emulatorVersion}.${os};
+ package = packages.emulator.${emulatorVersion};
};
platforms = map (version:
@@ -115,27 +151,22 @@ rec {
system-images = lib.flatten (map (apiVersion:
map (type:
map (abiVersion:
- deployAndroidPackage {
- inherit os;
- package = system-images-packages.${apiVersion}.${type}.${abiVersion};
- # Patch 'google_apis' system images so they're recognized by the sdk.
- # Without this, `android list targets` shows 'Tag/ABIs : no ABIs' instead
- # of 'Tag/ABIs : google_apis*/*' and the emulator fails with an ABI-related error.
- patchInstructions = lib.optionalString (lib.hasPrefix "google_apis" type) ''
- sed -i '/^Addon.Vendor/d' source.properties
- '';
- }
+ if lib.hasAttrByPath [apiVersion type abiVersion] system-images-packages then
+ deployAndroidPackage {
+ inherit os;
+ package = system-images-packages.${apiVersion}.${type}.${abiVersion};
+ # Patch 'google_apis' system images so they're recognized by the sdk.
+ # Without this, `android list targets` shows 'Tag/ABIs : no ABIs' instead
+ # of 'Tag/ABIs : google_apis*/*' and the emulator fails with an ABI-related error.
+ patchInstructions = lib.optionalString (lib.hasPrefix "google_apis" type) ''
+ sed -i '/^Addon.Vendor/d' source.properties
+ '';
+ }
+ else []
) abiVersions
) systemImageTypes
) platformVersions);
- lldb = map (version:
- import ./lldb.nix {
- inherit deployAndroidPackage os autoPatchelfHook pkgs lib;
- package = packages.lldb.${version};
- }
- ) lldbVersions;
-
cmake = map (version:
import ./cmake.nix {
inherit deployAndroidPackage os autoPatchelfHook pkgs lib;
@@ -187,12 +218,15 @@ rec {
''; # */
# This derivation deploys the tools package and symlinks all the desired
- # plugins that we want to use.
-
+ # plugins that we want to use. If the license isn't accepted, prints all the licenses
+ # requested and throws.
androidsdk = 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;'
+ ${builtins.concatStringsSep "\n\n" (mkLicenseTexts licenseNames)}
+
+ You must accept the following licenses:
+ ${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames}
+
+ by setting nixpkgs config option 'android_sdk.accept_license = true;'.
'' else import ./tools.nix {
inherit deployAndroidPackage requireFile packages toolsVersion autoPatchelfHook makeWrapper os pkgs pkgs_i686 lib;
@@ -202,10 +236,8 @@ rec {
${linkPlugin { name = "platform-tools"; plugin = platform-tools; }}
${linkPlugins { name = "build-tools"; plugins = build-tools; }}
${linkPlugin { name = "emulator"; plugin = emulator; check = includeEmulator; }}
- ${linkPlugin { name = "docs"; plugin = docs; check = includeDocs; }}
${linkPlugins { name = "platforms"; plugins = platforms; }}
${linkPlatformPlugins { name = "sources"; plugins = sources; check = includeSources; }}
- ${linkPlugins { name = "lldb"; plugins = lldb; }}
${linkPlugins { name = "cmake"; plugins = cmake; }}
${linkPlugin { name = "ndk-bundle"; plugin = ndk-bundle; check = includeNDK; }}
@@ -253,6 +285,17 @@ rec {
do
ln -s $i $out/bin
done
+
+ # Write licenses
+ mkdir -p licenses
+ ${lib.concatMapStrings (licenseName:
+ let
+ licenseHashes = builtins.concatStringsSep "\n" (mkLicenseHashes licenseName);
+ licenseHashFile = pkgs.writeText "androidenv-${licenseName}" licenseHashes;
+ in
+ ''
+ ln -s ${licenseHashFile} licenses/${licenseName}
+ '') licenseNames}
'';
};
}
diff --git a/pkgs/development/mobile/androidenv/convertaddons.xsl b/pkgs/development/mobile/androidenv/convertaddons.xsl
deleted file mode 100644
index 20f007eca048..000000000000
--- a/pkgs/development/mobile/androidenv/convertaddons.xsl
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:addon="http://schemas.android.com/sdk/android/repo/addon2/01"
- xmlns:sdk="http://schemas.android.com/repository/android/common/01"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
- <xsl:output omit-xml-declaration="yes" indent="no" />
-
- <!-- Template that puts a google HTTP prefix in front of relative URLs -->
- <xsl:template name="repository-url">
- <xsl:variable name="raw-url" select="complete/url"/>
- <xsl:choose>
- <xsl:when test="starts-with($raw-url, 'http')">
- <xsl:value-of select="$raw-url"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>https://dl.google.com/android/repository/</xsl:text>
- <xsl:value-of select="$raw-url"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="/addon:sdk-addon">
-{fetchurl}:
-
-{
- addons = {
- <!-- Convert all addons, but skip the entry for google APIs version 25 because it is inconsistent with the spec -->
- <xsl:for-each select="remotePackage[type-details/@xsi:type='addon:addonDetailsType' and archives/archive/complete/url != 'google_apis-25_r1.zip' ]"><xsl:sort select="@path" />
- "<xsl:value-of select="type-details/api-level" />"."<xsl:value-of select="type-details/tag/id" />" = {
- name = "<xsl:value-of select="type-details/tag/id" />";
- path = "<xsl:value-of select="translate(@path, ';', '/')" />";
- revision = "<xsl:value-of select="type-details/api-level" />";
- displayName = "<xsl:value-of select="display-name" />";
- archives = {
- <xsl:for-each select="archives/archive[not(host-os)]">
- all = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- <xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
- <xsl:value-of select="host-os" /> = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- };
- };
- </xsl:for-each>
-
- <!-- Workaround to make google APIs version 25 work. Hopefully, we can get rid of this at some point -->
- <xsl:for-each select="remotePackage[type-details/@xsi:type='addon:addonDetailsType' and archives/archive/complete/url = 'google_apis-25_r1.zip' ]">
- "<xsl:value-of select="25" />"."<xsl:value-of select="type-details/tag/id" />" = {
- name = "<xsl:value-of select="type-details/tag/id" />";
- path = "add-ons/addon-google_apis-google-25";
- revision = "<xsl:value-of select="25" />";
- displayName = "<xsl:value-of select="display-name" />";
- archives = {
- <xsl:for-each select="archives/archive[not(host-os)]">
- all = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- <xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
- <xsl:value-of select="host-os" /> = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- };
- };
- </xsl:for-each>
- };
-
- extras = {
- <!-- Convert all extras and maven artefacts -->
- <xsl:for-each select="remotePackage[type-details/@xsi:type='addon:extraDetailsType' or type-details/@xsi:type='addon:mavenType']"><xsl:sort select="@path" />
-
- <!-- Compose revision string from revision attributes -->
- <xsl:variable name="revision">
- <xsl:choose>
- <xsl:when test="revision/major">
- <xsl:value-of select="revision/major" />
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="revision/minor">.<xsl:value-of select="revision/minor" />
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="revision/micro">.<xsl:value-of select="revision/micro" />
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="revision/preview">-rc<xsl:value-of select="revision/preview" />
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- "<xsl:value-of select="@path" />" = {
- name = "<xsl:value-of select="translate(@path, ';', '-')" />";
- path = "<xsl:value-of select="translate(@path, ';', '/')" />";
- revision = "<xsl:value-of select="$revision" />";
- displayName = "<xsl:value-of select="display-name" />";
- archives = {
- <xsl:for-each select="archives/archive[not(host-os)]">
- all = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- <xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
- <xsl:value-of select="host-os" /> = fetchurl {
- url = "<xsl:call-template name="repository-url"/>";
- sha1 = "<xsl:value-of select="complete/checksum" />";
- };
- </xsl:for-each>
- };
- };
- </xsl:for-each>
- };