androidenv: fix extras;google;auto (#374102)

This commit is contained in:
Tristan Ross
2025-02-05 12:59:42 -08:00
committed by GitHub
8 changed files with 2356 additions and 567 deletions
@@ -7,7 +7,7 @@
, platformToolsVersion ? "35.0.2"
, buildToolsVersions ? [ "35.0.0" ]
, includeEmulator ? false
, emulatorVersion ? "35.1.4"
, emulatorVersion ? "35.3.10"
, platformVersions ? []
, includeSources ? false
, includeSystemImages ? false
@@ -150,16 +150,10 @@ rec {
postInstall = ''
${linkPlugin { name = "platform-tools"; plugin = platform-tools; }}
${linkPlugin { name = "patcher"; plugin = patcher; }}
${linkPlugin { name = "emulator"; plugin = emulator; check = includeEmulator; }}
'';
};
patcher = callPackage ./patcher.nix {
inherit deployAndroidPackage os;
package = packages.patcher."1";
};
build-tools = map (version:
callPackage ./build-tools.nix {
inherit deployAndroidPackage os;
@@ -339,7 +333,6 @@ rec {
# Symlink all requested plugins
${linkPlugin { name = "platform-tools"; plugin = platform-tools; }}
${linkPlugin { name = "tools"; plugin = tools; check = toolsVersion != null; }}
${linkPlugin { name = "patcher"; plugin = patcher; }}
${linkPlugins { name = "build-tools"; plugins = build-tools; }}
${linkPlugin { name = "emulator"; plugin = emulator; check = includeEmulator; }}
${linkPlugins { name = "platforms"; plugins = platforms; }}
@@ -354,16 +347,16 @@ rec {
# Link extras
${lib.concatMapStrings (identifier:
let
path = addons.extras.${identifier}.path;
addon = deployAndroidPackage {
inherit os;
package = addons.extras.${identifier};
package = addons.extras.${identifier};
path = package.path;
extras = callPackage ./extras.nix {
inherit deployAndroidPackage package os;
};
in
''
targetDir=$(dirname ${path})
mkdir -p $targetDir
ln -s ${addon}/libexec/android-sdk/${path} $targetDir
ln -s ${extras}/libexec/android-sdk/${path} $targetDir
'') includeExtras}
# Expose common executables in bin/
@@ -134,7 +134,7 @@ pkgs.mkShell rec {
packages=(
"build-tools;35.0.0" "cmdline-tools;13.0" \
"emulator" "patcher;v4" "platform-tools" "platforms;android-35" \
"emulator" "platform-tools" "platforms;android-35" \
"system-images;android-35;google_apis;x86_64"
)
@@ -127,7 +127,7 @@ pkgs.mkShell rec {
packages=(
"build-tools;35.0.0" "cmdline-tools;13.0" \
"patcher;v4" "platform-tools" "platforms;android-35"
"platform-tools" "platforms;android-35"
)
for package in "''${packages[@]}"; do
@@ -37,7 +37,10 @@ let
platforms = [ "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" ];
abis = [ "x86_64" ];
extras = ["extras;google;gcm"];
extras = [
"extras;google;gcm"
"extras;google;auto"
];
};
# If you copy this example out of nixpkgs, something like this will work:
@@ -180,7 +183,9 @@ pkgs.mkShell rec {
"system-images;android-32;google_apis_playstore;x86_64" \
"system-images;android-33;google_apis_playstore;x86_64" \
"system-images;android-34;google_apis;x86_64" \
"system-images;android-35;google_apis_playstore_ps16k;x86_64"
"system-images;android-35;google_apis;x86_64" \
"extras;google;gcm"
"extras;google;auto"
)
for package in "''${packages[@]}"; do
@@ -0,0 +1,39 @@
{
deployAndroidPackage,
lib,
package,
os,
autoPatchelfHook,
makeWrapper,
pkgs,
}:
deployAndroidPackage {
inherit package os;
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals (os == "linux") [ autoPatchelfHook ];
buildInputs = lib.optionals (os == "linux") (
with pkgs;
[
llvmPackages.libcxx
SDL2
]
);
patchInstructions = lib.optionalString (os == "linux") ''
autoPatchelf --no-recurse $packageBaseDir
if [ -f $PWD/desktop-head-unit ]; then
echo "desktop-head-unit exists"
wrapProgram $PWD/desktop-head-unit \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath (
with pkgs;
[
xorg.libX11
xorg.libXrandr
]
)
}
fi
'';
}
+18 -4
View File
@@ -248,11 +248,18 @@ end
def parse_package_xml doc
licenses = get_licenses doc
packages = {}
# check https://github.com/NixOS/nixpkgs/issues/373785
extras = {}
doc.css('remotePackage').each do |package|
name, _, version = package['path'].partition(';')
next if version == 'latest'
is_extras = name == 'extras'
if is_extras
name = package['path'].tr(';', '-')
end
type, revision, _ = package_revision(package)
next unless revision
@@ -267,8 +274,14 @@ def parse_package_xml doc
dependencies_xml = package.at_css('> dependencies')
dependencies = to_json_collector dependencies_xml if dependencies_xml
target = (packages[name] ||= {})
target = (target[revision] ||= {})
if is_extras
target = extras
component = package['path']
target = (target[component] ||= {})
else
target = (packages[name] ||= {})
target = (target[revision] ||= {})
end
target['name'] ||= name
target['path'] ||= path
@@ -284,7 +297,7 @@ def parse_package_xml doc
target['last-available-day'] = today
end
[licenses, packages]
[licenses, packages, extras]
end
def parse_image_xml doc
@@ -431,9 +444,10 @@ result['addons'] = {}
result['extras'] = {}
opts[:packages].each do |filename|
licenses, packages = parse_package_xml(Nokogiri::XML(File.open(filename)) { |conf| conf.noblanks })
licenses, packages, extras = parse_package_xml(Nokogiri::XML(File.open(filename)) { |conf| conf.noblanks })
merge result['licenses'], licenses
merge result['packages'], packages
merge result['extras'], extras
end
opts[:images].each do |filename|
@@ -12,6 +12,7 @@ cat ./repo.json | ruby mkrepo.rb \
--images ./xml/android-tv-sys-img2-1.xml \
--images ./xml/android-wear-cn-sys-img2-1.xml \
--images ./xml/android-wear-sys-img2-1.xml \
--images ./xml/android-automotive-sys-img2-1.xml \
--images ./xml/google_apis-sys-img2-1.xml \
--images ./xml/google_apis_playstore-sys-img2-1.xml \
--addons ./xml/addon2-1.xml \
File diff suppressed because one or more lines are too long