Commit c40262dc by Tim Van Patten Committed by Angle LUCI CQ

Remove unused third_party/ deps from Android checkin

Remove unused third_party/ deps from the Android checkins to reduce the license burden from unused libraries. Bug: b/187342779 Change-Id: I87358377d0dbbc644cb85555464f4afad9d5c333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954924Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
parent 7b14e506
......@@ -107,7 +107,7 @@ def gn_target_to_blueprint_target(target, target_info):
# Split the gn target name (in the form of //gn_file_path:target_name) into gn_file_path and
# target_name
target_regex = re.compile(r"^//([a-zA-Z0-9\-_/]*):([a-zA-Z0-9\-_.]+)$")
target_regex = re.compile(r"^//([a-zA-Z0-9\-\+_/]*):([a-zA-Z0-9\-\+_.]+)$")
match = re.match(target_regex, target)
assert match is not None
......@@ -179,8 +179,16 @@ target_blockist = [
'//third_party/vulkan-validation-layers/src:vulkan_clean_old_validation_layer_objects',
]
third_party_target_allowlist = [
'//third_party/abseil-cpp',
'//third_party/vulkan-deps',
'//third_party/vulkan_memory_allocator',
'//third_party/zlib',
]
include_blocklist = [
'//out/Android/gen/third_party/vulkan-deps/glslang/src/include/',
'//third_party/android_ndk/sources/android/cpufeatures/',
]
......@@ -194,7 +202,8 @@ def gn_deps_to_blueprint_deps(target_info, build_info):
return static_libs, defaults
for dep in target_info['deps']:
if dep not in target_blockist:
if dep not in target_blockist and (not dep.startswith('//third_party') or any(
dep.startswith(substring) for substring in third_party_target_allowlist)):
dep_info = build_info[dep]
blueprint_dep_name = gn_target_to_blueprint_target(dep, dep_info)
......@@ -220,6 +229,13 @@ def gn_deps_to_blueprint_deps(target_info, build_info):
# target depends on another's genrule, it wont find the outputs. Propogate generated
# headers up the dependency stack.
generated_headers += child_generated_headers
elif dep == '//third_party/android_ndk:cpu_features':
# chrome_zlib needs cpufeatures from the Android NDK. Rather than including the
# entire NDK is a dep in the ANGLE checkout, use the library that's already part
# of Android.
dep_info = build_info[dep]
blueprint_dep_name = gn_target_to_blueprint_target(dep, dep_info)
static_libs.append('cpufeatures')
return static_libs, shared_libs, defaults, generated_headers, header_libs
......
......@@ -7,7 +7,14 @@
# Generates a roll CL within the ANGLE repository of AOSP.
# exit when any command fails
set -e
set -eE -o functrace
failure() {
local lineno=$1
local msg=$2
echo "Failed at $lineno: $msg"
}
trap 'failure ${LINENO} "$BASH_COMMAND"' ERR
# Change the working directory to the ANGLE root directory
cd "${0%/*}/.."
......@@ -99,10 +106,8 @@ rm -rf ${DEPOT_TOOLS_DIR}
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_DIR}
export PATH=`pwd`/${DEPOT_TOOLS_DIR}:$PATH
deps=(
third_party_deps=(
"third_party/abseil-cpp"
"third_party/jsoncpp"
"third_party/jsoncpp/source"
"third_party/vulkan-deps/glslang/src"
"third_party/vulkan-deps/spirv-headers/src"
"third_party/vulkan-deps/spirv-tools/src"
......@@ -113,16 +118,11 @@ deps=(
# Only add the parts of NDK and vulkan-deps that are required by ANGLE. The entire dep is too large.
delete_only_deps=(
"third_party/android_ndk"
"third_party/vulkan-deps"
)
add_only_deps=(
"third_party/android_ndk/sources/android/cpufeatures"
)
# Delete dep directories so that gclient can check them out
for dep in "${deps[@]}" "${delete_only_deps[@]}"; do
for dep in "${third_party_deps[@]}" "${delete_only_deps[@]}"; do
rm -rf "$dep"
done
......@@ -132,11 +132,21 @@ gclient sync --reset --force --ignore_locks --delete_unversioned_trees --break_r
generate_Android_bp_file
# Delete all unsupported 3rd party dependencies. Do this after generate_Android_bp_file, so
# it has access to all of the necessary BUILD.gn files.
# Any 3rd party dependencies that are added to this list must have their licenses verified.
find third_party/ -maxdepth 1 -type d ! -wholename third_party/ \
! -wholename third_party/abseil-cpp \
! -wholename third_party/vulkan-deps \
! -wholename third_party/vulkan_memory_allocator \
! -wholename third_party/zlib \
-print0 | xargs --null rm -rf
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
for dep in "${third_party_deps[@]}"; do
rm -rf "$dep"/.git
done
......@@ -144,7 +154,6 @@ 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/abseil-cpp/OWNERS"
"third_party/jsoncpp/OWNERS"
"third_party/vulkan_memory_allocator/OWNERS"
"third_party/zlib/OWNERS"
"third_party/zlib/google/OWNERS"
......@@ -157,7 +166,7 @@ for removal_file in "${extra_removal_files[@]}"; do
rm -f "$removal_file"
done
for dep in "${deps[@]}" "${add_only_deps[@]}"; do
for dep in "${third_party_deps[@]}"; do
git add -f "$dep"
done
......
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