androidenv: make nix-build -A androidenv.test-suite work

androidenv: set config.allowUnfree = true for integration tests

androidenv: fix concerns in the PR
This commit is contained in:
Hadi 2023-02-01 17:52:02 -05:00
parent d511bfd0e2
commit a05928d7fe
5 changed files with 18 additions and 11 deletions

View file

@ -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;

View file

@ -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 {

View file

@ -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 = {

View file

@ -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 {

View file

@ -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 = ./.;
buildCommand = ''
touch $out
'';
dontConfigure = true;
dontBuild = true;
passthru.tests = examples-shell.passthru.tests //
examples-shell-with-emulator.passthru.tests;
passthru.tests = all-tests;
meta.timeout = 60;
}