androidenv: accept license during tests
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs ? import <nixpkgs> { },
|
||||
licenseAccepted ?
|
||||
config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1"),
|
||||
licenseAccepted ? pkgs.callPackage ./license.nix { },
|
||||
}:
|
||||
|
||||
lib.recurseIntoAttrs rec {
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
config.allowUnfree = true;
|
||||
},
|
||||
|
||||
config ? pkgs.config,
|
||||
# You probably need to set it to true to express consent.
|
||||
licenseAccepted ?
|
||||
config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1"),
|
||||
licenseAccepted ? pkgs.callPackage ../license.nix { },
|
||||
}:
|
||||
|
||||
# Copy this file to your Android project.
|
||||
@@ -36,14 +34,14 @@ let
|
||||
};
|
||||
|
||||
androidEnv = pkgs.callPackage "${androidEnvNixpkgs}/pkgs/development/mobile/androidenv" {
|
||||
inherit config pkgs;
|
||||
inherit pkgs;
|
||||
licenseAccepted = true;
|
||||
};
|
||||
*/
|
||||
|
||||
# Otherwise, just use the in-tree androidenv:
|
||||
androidEnv = pkgs.callPackage ./.. {
|
||||
inherit config pkgs licenseAccepted;
|
||||
inherit pkgs licenseAccepted;
|
||||
};
|
||||
|
||||
emulatorSupported = pkgs.stdenv.hostPlatform.isx86_64 || pkgs.stdenv.hostPlatform.isDarwin;
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
# This example pins nixpkgs: https://nix.dev/tutorials/first-steps/towards-reproducibility-pinning-nixpkgs.html
|
||||
/*
|
||||
nixpkgsSource ? (builtins.fetchTarball {
|
||||
name = "nixpkgs-20.09";
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz";
|
||||
sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy";
|
||||
name = "nixpkgs-20.09";
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz";
|
||||
sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy";
|
||||
}),
|
||||
pkgs ? import nixpkgsSource {
|
||||
config.allowUnfree = true;
|
||||
config.allowUnfree = true;
|
||||
},
|
||||
*/
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
pkgs ? import ../../../../.. {
|
||||
config.allowUnfree = true;
|
||||
},
|
||||
config ? pkgs.config,
|
||||
# You probably need to set it to true to express consent.
|
||||
licenseAccepted ?
|
||||
config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1"),
|
||||
|
||||
licenseAccepted ? pkgs.callPackage ../license.nix { },
|
||||
}:
|
||||
|
||||
# Copy this file to your Android project.
|
||||
@@ -29,20 +27,20 @@ let
|
||||
# If you copy this example out of nixpkgs, something like this will work:
|
||||
/*
|
||||
androidEnvNixpkgs = fetchTarball {
|
||||
name = "androidenv";
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/<fill me in from Git>.tar.gz";
|
||||
sha256 = "<fill me in with nix-prefetch-url --unpack>";
|
||||
name = "androidenv";
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/<fill me in from Git>.tar.gz";
|
||||
sha256 = "<fill me in with nix-prefetch-url --unpack>";
|
||||
};
|
||||
|
||||
androidEnv = pkgs.callPackage "${androidEnvNixpkgs}/pkgs/development/mobile/androidenv" {
|
||||
inherit config pkgs;
|
||||
licenseAccepted = true;
|
||||
inherit pkgs;
|
||||
licenseAccepted = true;
|
||||
};
|
||||
*/
|
||||
|
||||
# Otherwise, just use the in-tree androidenv:
|
||||
androidEnv = pkgs.callPackage ./.. {
|
||||
inherit config pkgs licenseAccepted;
|
||||
inherit pkgs licenseAccepted;
|
||||
};
|
||||
|
||||
sdkArgs = {
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
config.allowUnfree = true;
|
||||
},
|
||||
|
||||
config ? pkgs.config,
|
||||
# You probably need to set it to true to express consent.
|
||||
licenseAccepted ?
|
||||
config.android_sdk.accept_license or (builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1"),
|
||||
licenseAccepted ? pkgs.callPackage ../license.nix { },
|
||||
}:
|
||||
|
||||
# Copy this file to your Android project.
|
||||
@@ -34,14 +32,14 @@ let
|
||||
};
|
||||
|
||||
androidEnv = pkgs.callPackage "${androidEnvNixpkgs}/pkgs/development/mobile/androidenv" {
|
||||
inherit config pkgs;
|
||||
inherit pkgs;
|
||||
licenseAccepted = true;
|
||||
};
|
||||
*/
|
||||
|
||||
# Otherwise, just use the in-tree androidenv:
|
||||
androidEnv = pkgs.callPackage ./.. {
|
||||
inherit config pkgs licenseAccepted;
|
||||
inherit pkgs licenseAccepted;
|
||||
};
|
||||
|
||||
# The head unit only works on these platforms
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
config,
|
||||
}:
|
||||
|
||||
# Accept the license in the test suite.
|
||||
config.android_sdk.accept_license or (
|
||||
builtins.getEnv "NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE" == "1"
|
||||
|| builtins.getEnv "UPDATE_NIX_ATTR_PATH" == "androidenv.test-suite"
|
||||
)
|
||||
@@ -529,12 +529,15 @@ cur_latest.each do |k, v|
|
||||
end
|
||||
end
|
||||
|
||||
# Write the repository. Append a \n to keep nixpkgs Github Actions happy.
|
||||
File.write 'repo.json', (JSON.pretty_generate(sort_recursively(output)) + "\n")
|
||||
|
||||
# Output metadata for the nixpkgs update script.
|
||||
changed_paths = []
|
||||
if changed
|
||||
if ENV['UPDATE_NIX_ATTR_PATH']
|
||||
# Instantiate it.
|
||||
test_result = `nix-shell ../../../../default.nix -A #{Shellwords.join [ENV['UPDATE_NIX_ATTR_PATH']]} 2>&1`
|
||||
test_result = `NIXPKGS_ALLOW_UNFREE=1 NIXPKGS_ACCEPT_ANDROID_SDK_LICENSE=1 nix-build ../../../../default.nix -A #{Shellwords.join [ENV['UPDATE_NIX_ATTR_PATH']]} 2>&1`
|
||||
test_status = $?.exitstatus
|
||||
tests_ran = true
|
||||
else
|
||||
@@ -553,9 +556,10 @@ Performed the following automatic androidenv updates:
|
||||
<% if tests_ran %>
|
||||
Tests exited with status: <%= test_status -%>
|
||||
|
||||
<% if test_status != 0 %>
|
||||
<% if !test_result.empty? %>
|
||||
Last 100 lines of output:
|
||||
```
|
||||
<%= test_result -%>
|
||||
<%= test_result.lines.last(100).join -%>
|
||||
```
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -573,7 +577,4 @@ EOF
|
||||
end
|
||||
|
||||
# nix-update info is on stderr
|
||||
STDERR.puts JSON.pretty_generate(changed_paths)
|
||||
|
||||
# repo is on stdout
|
||||
STDOUT.puts JSON.pretty_generate(sort_recursively(output))
|
||||
STDOUT.puts JSON.pretty_generate(changed_paths)
|
||||
|
||||
@@ -6,7 +6,6 @@ set -e
|
||||
pushd "$(dirname "$0")" &>/dev/null || exit 1
|
||||
|
||||
echo "Writing repo.json" >&2
|
||||
pid=$BASHPID
|
||||
ruby mkrepo.rb \
|
||||
--packages ./xml/repository2-3.xml \
|
||||
--images ./xml/android-sys-img2-3.xml \
|
||||
@@ -16,7 +15,5 @@ ruby mkrepo.rb \
|
||||
--images ./xml/android-automotive-sys-img2-3.xml \
|
||||
--images ./xml/google_apis-sys-img2-3.xml \
|
||||
--images ./xml/google_apis_playstore-sys-img2-3.xml \
|
||||
--addons ./xml/addon2-3.xml <./repo.json 2>/proc/$pid/fd/1 \
|
||||
| sponge repo.json
|
||||
|
||||
--addons ./xml/addon2-3.xml <./repo.json
|
||||
popd &>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user