Skip to content

Commit

Permalink
androidenv: make nix-build -A androidenv.test-suite work
Browse files Browse the repository at this point in the history
androidenv: set config.allowUnfree = true for integration tests

androidenv: fix concerns in the PR
  • Loading branch information
hadilq committed Feb 28, 2023
1 parent d511bfd commit a05928d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ rec {
You must accept the following licenses:
${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames}
by setting nixpkgs config option 'android_sdk.accept_license = true;'.
a)
by setting nixpkgs config option 'android_sdk.accept_license = true;'.
b)
by an environment variable for a single invocation of the nix tools.
$ export NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1
'' else callPackage ./cmdline-tools.nix {
inherit deployAndroidPackage os cmdLineToolsVersion;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/mobile/androidenv/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ config, pkgs ? import <nixpkgs> {}
, licenseAccepted ? config.android_sdk.accept_license or false
, licenseAccepted ? config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1")
}:

rec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ let
# Otherwise, just use the in-tree androidenv:
androidEnv = pkgs.callPackage ./.. {
inherit config pkgs;
licenseAccepted = true;
# You probably need to uncomment below line to express consent.
# licenseAccepted = true;
};

sdkArgs = {
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/mobile/androidenv/examples/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ let
# Otherwise, just use the in-tree androidenv:
androidEnv = pkgs.callPackage ./.. {
inherit config pkgs;
licenseAccepted = true;
# You probably need to uncomment below line to express consent.
# licenseAccepted = true;
};

androidComposition = androidEnv.composeAndroidPackages {
Expand Down
15 changes: 8 additions & 7 deletions pkgs/development/mobile/androidenv/test-suite.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{ stdenv, callPackage }:
{callPackage, lib, stdenv}:
let
examples-shell = callPackage ./examples/shell.nix {};
examples-shell-with-emulator = callPackage ./examples/shell-with-emulator.nix {};
all-tests = examples-shell.passthru.tests //
examples-shell-with-emulator.passthru.tests;
in
stdenv.mkDerivation {
name = "androidenv-test-suite";
buidInputs = lib.mapAttrsToList (name: value: value) all-tests;

src = ./.;

dontConfigure = true;
dontBuild = true;
buildCommand = ''
touch $out
'';

passthru.tests = examples-shell.passthru.tests //
examples-shell-with-emulator.passthru.tests;
passthru.tests = all-tests;

meta.timeout = 60;
}

0 comments on commit a05928d

Please sign in to comment.