Unverified Commit 1d9f3aa9 authored by Alexandre Esteves's avatar Alexandre Esteves Committed by GitHub
Browse files

androidenv: fix new "37.0" packages with API version ranges (#507124)

parents 89f27f5b a1241180
Loading
Loading
Loading
Loading
+22 −8
Original line number Diff line number Diff line
@@ -298,7 +298,8 @@ let
  # Returns true if the given version exists.
  hasVersion =
    packages: package: version:
    lib.hasAttrByPath [ package (toString version) ] packages;
    lib.hasAttrByPath [ package (toString version) ] packages
    || lib.hasAttrByPath [ package "${(toString version)}.0" ] packages;

  # Displays a nice error message that includes the available options if a version doesn't exist.
  # Note that allPackages can be a list of package sets, or a single package set. Pass a list if
@@ -322,7 +323,7 @@ let
        }.
      ''
    else
      packageSet.${package}.${toString version};
      packageSet.${package}.${toString version} or packageSet.${package}."${toString version}.0";

  # Returns true if we should link the specified plugins.
  shouldLink =
@@ -546,12 +547,25 @@ lib.recurseIntoAttrs rec {
    }
  ) platformVersions';

  sources = map (
  # Google is not including sources for API 37+. If the user requests them, don't fail.
  sources = lib.filter (source: source != null) (
    map (
      version:
      let
        package =
          let
            version' = builtins.tryEval (checkVersion allArchives.packages "sources" version);
          in
          if version'.success then version'.value else null;
      in
      if package == null then
        null
      else
        deployAndroidPackage {
      package = checkVersion allArchives.packages "sources" version;
          inherit package;
        }
  ) platformVersions';
    ) platformVersions'
  );

  system-images = lib.flatten (
    map (
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ deployAndroidPackage {
        nspr
        alsa-lib
        waylandpp.lib
        libgbm
      ]
    )
    ++ (with pkgs; [
+2 −3
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ pkgs.mkShell rec {
          packages=(
            "build-tools" "cmdline-tools" \
            "platform-tools" "platforms;android-${toString latestSdkVersion}" \
            "system-images;android-${toString latestSdkVersion};google_apis;x86_64"
            "system-images;android-${toString latestSdkVersion};google_apis_ps16k;x86_64"
          )
          ${lib.optionalString emulatorSupported ''packages+=("emulator")''}

@@ -158,7 +158,6 @@ pkgs.mkShell rec {
          for x in $(seq 1 ${lib.versions.major (toString latestSdkVersion)}); do
            excluded_packages+=(
              "platforms;android-$x"
              "sources;android-$x"
              "system-images;android-$x"
            )
          done
@@ -188,7 +187,7 @@ pkgs.mkShell rec {
            mkdir -p $ANDROID_USER_HOME

            avdmanager delete avd -n testAVD || true
            echo "" | avdmanager create avd --force --name testAVD --package 'system-images;android-${toString latestSdkVersion};google_apis;x86_64'
            { echo "" | avdmanager create avd --force --name testAVD --package 'system-images;android-${toString latestSdkVersion};google_apis_ps16k;x86_64'; }
            result=$(avdmanager list avd)

            if [[ ! $result =~ "Name: testAVD" ]]; then
+0 −4
Original line number Diff line number Diff line
@@ -187,10 +187,6 @@ pkgs.mkShell rec {
            "extras;google;gcm"
          )

          for x in $(seq ${toString firstSdkVersion} ${toString latestSdkVersion}); do
            packages+=("sources;android-$x")
          done

          ${lib.optionalString includeAuto ''packages+=("extras;google;auto")''}

          for package in "''${packages[@]}"; do
+1945 −780

File changed.

Preview size limit exceeded, changes collapsed.