Commit 20eb9be5 by Tim Van Patten Committed by Commit Bot

Generate Android.bp from multiple gn descriptions

With the introduction of ABI-specific build targets (zlib), the script generate_android_bp.py needs to be updated to consume ABI-specific gn descriptions and generate ABI-specific build rules for each target. The roll_aosp.sh script was updated to generate ABI-specific gn descriptions for each: arm arm64 x86 x64 Bug: b/160727922 Test: Manual script execution and building in AOSP Change-Id: I459b388176f8fcc010f9f5668535d941b931cdd4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2285272 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 80d7725d
......@@ -6,6 +6,8 @@
#
# Generates a roll CL within the ANGLE repository of AOSP.
GN_OUTPUT_DIRECTORY=out/Android
deps=(
"third_party/spirv-tools/src"
"third_party/glslang/src"
......@@ -35,69 +37,82 @@ done
python scripts/bootstrap.py
gclient sync -D
# generate gn build files and convert them to blueprints
gn_args=(
"target_os = \"android\""
"is_component_build = false"
"is_debug = false"
# Build for 64-bit CPUs
"target_cpu = \"arm64\""
# Don't make a dependency on .git/HEAD. Some Android builds are done without .git folders
# present.
"angle_enable_commit_id = false"
# Target ndk API 26 to make sure ANGLE can use the Vulkan backend on Android
"android32_ndk_api_level = 26"
"android64_ndk_api_level = 26"
# Disable all backends except Vulkan
"angle_enable_vulkan = true"
"angle_enable_gl = true" # TODO(geofflang): Disable GL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_d3d9 = false"
"angle_enable_d3d11 = false"
"angle_enable_null = false"
"angle_enable_metal = false"
# SwiftShader is loaded as the system Vulkan driver on Android, not compiled by ANGLE
"angle_enable_swiftshader = false"
# Disable all shader translator targets except desktop GL (for Vulkan)
"angle_enable_essl = true" # TODO(geofflang): Disable ESSL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_glsl = true" # TODO(geofflang): Disable ESSL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_hlsl = false"
abis=(
"arm"
"arm64"
"x86"
"x64"
)
gn gen out/Android --args="${gn_args[*]}"
gn desc out/Android --format=json "*" > out/Android/desc.json
python scripts/generate_android_bp.py out/Android/desc.json > Android.bp
rm -r out
rm -r ${GN_OUTPUT_DIRECTORY}
for abi in ${abis[@]}; do
# generate gn build files and convert them to blueprints
gn_args=(
"target_os = \"android\""
"is_component_build = false"
"is_debug = false"
# Build for 64-bit CPUs
"target_cpu = \"$abi\""
# Target ndk API 26 to make sure ANGLE can use the Vulkan backend on Android
"android32_ndk_api_level = 26"
"android64_ndk_api_level = 26"
# Disable all backends except Vulkan
"angle_enable_vulkan = true"
"angle_enable_gl = true" # TODO(geofflang): Disable GL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_d3d9 = false"
"angle_enable_d3d11 = false"
"angle_enable_null = false"
"angle_enable_metal = false"
# SwiftShader is loaded as the system Vulkan driver on Android, not compiled by ANGLE
"angle_enable_swiftshader = false"
# Disable all shader translator targets except desktop GL (for Vulkan)
"angle_enable_essl = true" # TODO(geofflang): Disable ESSL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_glsl = true" # TODO(geofflang): Disable ESSL once Andrid no longer requires it. anglebug.com/4444
"angle_enable_hlsl = false"
)
gn gen ${GN_OUTPUT_DIRECTORY} --args="${gn_args[*]}"
gn desc ${GN_OUTPUT_DIRECTORY} --format=json "*" > ${GN_OUTPUT_DIRECTORY}/desc.$abi.json
done
python scripts/generate_android_bp.py \
${GN_OUTPUT_DIRECTORY}/desc.arm.json \
${GN_OUTPUT_DIRECTORY}/desc.arm64.json \
${GN_OUTPUT_DIRECTORY}/desc.x86.json \
${GN_OUTPUT_DIRECTORY}/desc.x64.json > Android.bp
rm -r ${GN_OUTPUT_DIRECTORY}
git add Android.bp
# Delete the .git files in each dep so that it can be added to this repo. Some deps like jsoncpp
# have multiple layers of deps so delete everything before adding them.
for dep in ${deps[@]} ${delete_only_deps[@]}; do
rm -rf $dep/.git
rm -rf $dep/.git
done
extra_removal_files=(
# Some third_party deps have OWNERS files which contains users that have not logged into
# the Android gerrit. Repo cannot upload with these files present.
"third_party/jsoncpp/OWNERS"
"third_party/vulkan_memory_allocator/OWNERS"
"third_party/zlib/OWNERS"
"third_party/zlib/google/OWNERS"
"third_party/zlib/contrib/tests/OWNERS"
"third_party/zlib/contrib/bench/OWNERS"
"third_party/zlib/contrib/tests/fuzzers/OWNERS"
# Some third_party deps have OWNERS files which contains users that have not logged into
# the Android gerrit. Repo cannot upload with these files present.
"third_party/jsoncpp/OWNERS"
"third_party/vulkan_memory_allocator/OWNERS"
"third_party/zlib/OWNERS"
"third_party/zlib/google/OWNERS"
"third_party/zlib/contrib/tests/OWNERS"
"third_party/zlib/contrib/bench/OWNERS"
"third_party/zlib/contrib/tests/fuzzers/OWNERS"
)
for removal_file in ${extra_removal_files[@]}; do
rm $removal_file
rm $removal_file
done
for dep in ${deps[@]} ${add_only_deps[@]}; do
git add -f $dep
git add -f $dep
done
git commit --amend --no-edit
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment