0

Remove remaining exec_script() uses of find.py

gn gen --time shows this was taking ~200ms on my machine.

Bug: 398002893
Change-Id: I889b03960a224389de69d06d1106ac3fd3ae4550
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6489059
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Sam Maier <smaier@chromium.org>
Commit-Queue: Sam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1452794}
This commit is contained in:
Andrew Grieve
2025-04-28 11:48:14 -07:00
committed by Chromium LUCI CQ
parent 18ed4c7d84
commit f966acd553
3 changed files with 93 additions and 40 deletions
.gn
build/android/gyp
chrome/android/webapk/shell_apk/prepare_upload_dir

1
.gn

@ -156,7 +156,6 @@ exec_script_allowlist =
# in the Chromium repo outside of //build. # in the Chromium repo outside of //build.
"//build_overrides/build.gni", "//build_overrides/build.gni",
"//chrome/android/webapk/shell_apk/prepare_upload_dir/BUILD.gn",
"//chrome/version.gni", "//chrome/version.gni",
"//google_apis/BUILD.gn", "//google_apis/BUILD.gn",

@ -1,33 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Finds files in directories.
"""
import fnmatch
import optparse
import os
import sys
def main(argv):
parser = optparse.OptionParser()
parser.add_option('--pattern', default='*', help='File pattern to match.')
options, directories = parser.parse_args(argv)
for d in directories:
if not os.path.exists(d):
print('%s does not exist' % d, file=sys.stderr)
return 1
for root, _, filenames in os.walk(d):
for f in fnmatch.filter(filenames, options.pattern):
print(os.path.join(root, f))
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

@ -8,17 +8,12 @@ import(
upload_dir = "${target_gen_dir}/upload_to_build_bucket" upload_dir = "${target_gen_dir}/upload_to_build_bucket"
# Copies |source_dir| to |destination_dir|.
template("copy_dir") { template("copy_dir") {
copy_ex(target_name) { copy_ex(target_name) {
source_dir = invoker.source_dir source_dir = invoker.source_dir
dest = invoker.destination_dir dest = invoker.destination_dir
_sources_rel_build_rel = renaming_sources = rebase_path(invoker.sources, ".", source_dir)
exec_script("//build/android/gyp/find.py",
[ rebase_path(source_dir, root_build_dir) ],
"list lines")
renaming_sources = rebase_path(_sources_rel_build_rel, ".", root_build_dir)
renaming_destinations = rebase_path(renaming_sources, source_dir) renaming_destinations = rebase_path(renaming_sources, source_dir)
} }
} }
@ -26,21 +21,113 @@ template("copy_dir") {
copy_dir("copy_res_to_upload_dir") { copy_dir("copy_res_to_upload_dir") {
source_dir = "//chrome/android/webapk/shell_apk/res" source_dir = "//chrome/android/webapk/shell_apk/res"
destination_dir = "${upload_dir}/res" destination_dir = "${upload_dir}/res"
sources = [
"drawable-hdpi/ic_site_settings.png",
"drawable-hdpi/last_resort_runtime_host_logo.png",
"drawable-hdpi/notification_badge.png",
"drawable-hdpi/shortcut_1_icon.png",
"drawable-hdpi/shortcut_2_icon.png",
"drawable-hdpi/shortcut_3_icon.png",
"drawable-hdpi/shortcut_4_icon.png",
"drawable-hdpi/splash_icon.xml",
"drawable-mdpi/ic_site_settings.png",
"drawable-mdpi/notification_badge.png",
"drawable-mdpi/shortcut_1_icon.png",
"drawable-mdpi/shortcut_2_icon.png",
"drawable-mdpi/shortcut_3_icon.png",
"drawable-mdpi/shortcut_4_icon.png",
"drawable-mdpi/splash_icon.xml",
"drawable-xhdpi/ic_site_settings.png",
"drawable-xhdpi/notification_badge.png",
"drawable-xhdpi/shortcut_1_icon.png",
"drawable-xhdpi/shortcut_2_icon.png",
"drawable-xhdpi/shortcut_3_icon.png",
"drawable-xhdpi/shortcut_4_icon.png",
"drawable-xhdpi/splash_icon.xml",
"drawable-xxhdpi/ic_site_settings.png",
"drawable-xxhdpi/notification_badge.png",
"drawable-xxhdpi/shortcut_1_icon.png",
"drawable-xxhdpi/shortcut_2_icon.png",
"drawable-xxhdpi/shortcut_3_icon.png",
"drawable-xxhdpi/shortcut_4_icon.png",
"drawable-xxhdpi/splash_icon.xml",
"drawable-xxxhdpi/ic_site_settings.png",
"drawable-xxxhdpi/notification_badge.png",
"drawable-xxxhdpi/shortcut_1_icon.png",
"drawable-xxxhdpi/shortcut_2_icon.png",
"drawable-xxxhdpi/shortcut_3_icon.png",
"drawable-xxxhdpi/shortcut_4_icon.png",
"drawable-xxxhdpi/splash_icon.xml",
"layout-night-v31/splash_screen_view.xml",
"layout-v31/splash_screen_view.xml",
"layout/host_browser_list_item.xml",
"mipmap-anydpi-v26/ic_launcher.xml",
"mipmap-hdpi/ic_launcher.xml",
"mipmap-mdpi/ic_launcher.xml",
"mipmap-mdpi/ic_launcher_background.png",
"mipmap-mdpi/ic_launcher_foreground.png",
"mipmap-nodpi/app_icon_hdpi.png",
"mipmap-nodpi/app_icon_mdpi.png",
"mipmap-nodpi/app_icon_xhdpi.png",
"mipmap-nodpi/app_icon_xxhdpi.png",
"mipmap-nodpi/app_icon_xxxhdpi.png",
"mipmap-nodpi/maskable_app_icon_hdpi.png",
"mipmap-nodpi/maskable_app_icon_mdpi.png",
"mipmap-nodpi/maskable_app_icon_xhdpi.png",
"mipmap-nodpi/maskable_app_icon_xxhdpi.png",
"mipmap-nodpi/maskable_app_icon_xxxhdpi.png",
"mipmap-nodpi/maskable_splash_icon_xxhdpi.png",
"mipmap-nodpi/maskable_splash_icon_xxxhdpi.png",
"mipmap-nodpi/splash_icon_xxhdpi.png",
"mipmap-nodpi/splash_icon_xxxhdpi.png",
"mipmap-xhdpi/ic_launcher.xml",
"mipmap-xxhdpi/ic_launcher.xml",
"mipmap-xxxhdpi/ic_launcher.xml",
"values-hdpi/is_splash_icon_maskable_bool.xml",
"values-mdpi/is_splash_icon_maskable_bool.xml",
"values-night-v17/styles.xml",
"values-night-v31/dimens.xml",
"values-night-v31/styles.xml",
"values-v17/styles.xml",
"values-v31/dimens.xml",
"values-v31/styles.xml",
"values-xhdpi/is_splash_icon_maskable_bool.xml",
"values-xxhdpi/is_splash_icon_maskable_bool.xml",
"values-xxxhdpi/is_splash_icon_maskable_bool.xml",
"values/colors.xml",
"values/dimens.xml",
"xml/shortcuts.xml",
]
} }
copy_dir("copy_res_template_to_upload_dir") { copy_dir("copy_res_template_to_upload_dir") {
source_dir = "//chrome/android/webapk/shell_apk/res_template" source_dir = "//chrome/android/webapk/shell_apk/res_template"
destination_dir = "${upload_dir}/res" destination_dir = "${upload_dir}/res"
sources = [
"mipmap-nodpi/app_icon.xml",
"mipmap-nodpi/maskable_app_icon.xml",
"values/background_color.xml",
]
} }
copy_dir("copy_libs_common_res_splash_to_upload_dir") { copy_dir("copy_libs_common_res_splash_to_upload_dir") {
source_dir = "//chrome/android/webapk/libs/common/res_splash" source_dir = "//chrome/android/webapk/libs/common/res_splash"
destination_dir = "${upload_dir}/res" destination_dir = "${upload_dir}/res"
sources = [
"layout/webapp_splash_screen_large.xml",
"layout/webapp_splash_screen_no_icon.xml",
"values-v17/common_styles.xml",
"values/common_colors.xml",
]
} }
copy_dir("copy_components_libs_common_res_splash_to_upload_dir") { copy_dir("copy_components_libs_common_res_splash_to_upload_dir") {
source_dir = "//components/webapk/android/libs/common/res_splash" source_dir = "//components/webapk/android/libs/common/res_splash"
destination_dir = "${upload_dir}/res" destination_dir = "${upload_dir}/res"
sources = [
"values-sw600dp/common_dimens.xml",
"values/common_dimens.xml",
]
} }
copy_ex("copy_extra_files_to_upload_dir") { copy_ex("copy_extra_files_to_upload_dir") {