Commit 4bd370dd by Mohan Maiya Committed by Commit Bot

Refactor roll_aosp.sh

roll_aosp.sh can now generate an Android.bp file without having to perform a roll. This facilitates on demand generation of Android.bp. Provide an option to enable API traces with "--enableApiTrace" flag. Usage - # Generates Android.bp and perform a roll ./scripts/roll_aosp.sh # Generates Android.bp ./scripts/roll_aosp.sh --genAndroidBp # Generates Android.bp with API tracing enabled ./scripts/roll_aosp.sh --genAndroidBp --enableApiTrace Bug: angleproject:5774 Change-Id: I3a2bd505f5d75d6d5fc331d61fa9517d6042db70 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2774758Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent fddbc9c7
...@@ -12,14 +12,90 @@ set -e ...@@ -12,14 +12,90 @@ set -e
# Change the working directory to the ANGLE root directory # Change the working directory to the ANGLE root directory
cd "${0%/*}/.." cd "${0%/*}/.."
GN_OUTPUT_DIRECTORY=out/Android
function generate_Android_bp_file() {
rm -rf ${GN_OUTPUT_DIRECTORY}
abis=(
"arm"
"arm64"
"x86"
"x64"
)
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"
"angle_enable_commit_id = false"
# Disable histogram/protobuf support
"angle_has_histograms = false"
# Disable _LIBCPP_ABI_UNSTABLE, since it breaks std::string
"libcxx_abi_unstable = false"
)
if [[ "$1" == "--enableApiTrace" ]]; then
gn_args=(
"${gn_args[@]}"
"angle_enable_trace = true"
"angle_enable_trace_android_logcat = true"
)
fi
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 -rf ${GN_OUTPUT_DIRECTORY}
}
if [[ "$1" == "--genAndroidBp" ]];then
generate_Android_bp_file "$2"
exit 0
fi
# Check out depot_tools locally and add it to the path # Check out depot_tools locally and add it to the path
DEPOT_TOOLS_DIR=_depot_tools DEPOT_TOOLS_DIR=_depot_tools
rm -rf ${DEPOT_TOOLS_DIR} rm -rf ${DEPOT_TOOLS_DIR}
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_DIR} git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_DIR}
export PATH=`pwd`/${DEPOT_TOOLS_DIR}:$PATH export PATH=`pwd`/${DEPOT_TOOLS_DIR}:$PATH
GN_OUTPUT_DIRECTORY=out/Android
deps=( deps=(
"third_party/abseil-cpp" "third_party/abseil-cpp"
"third_party/jsoncpp" "third_party/jsoncpp"
...@@ -51,64 +127,8 @@ done ...@@ -51,64 +127,8 @@ done
python scripts/bootstrap.py python scripts/bootstrap.py
gclient sync --reset --force --ignore_locks --delete_unversioned_trees --break_repo_locks gclient sync --reset --force --ignore_locks --delete_unversioned_trees --break_repo_locks
abis=( generate_Android_bp_file
"arm"
"arm64"
"x86"
"x64"
)
rm -rf ${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"
"angle_enable_commit_id = false"
# Disable histogram/protobuf support
"angle_has_histograms = false"
# Disable _LIBCPP_ABI_UNSTABLE, since it breaks std::string
"libcxx_abi_unstable = 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 -rf ${GN_OUTPUT_DIRECTORY}
git add Android.bp git add Android.bp
# Delete the .git files in each dep so that it can be added to this repo. Some deps like jsoncpp # Delete the .git files in each dep so that it can be added to this repo. Some deps like jsoncpp
......
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