Commit b2cbe567 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Perform list filtering without using set_sources_assignment_filter

Convert code abusing set_sources_assignment_filter to filter lists
to instead manually filter the list using foreach and get_path_info.

Bug: 1018739
Change-Id: I66205fe54ebdce67e23d0b14e594d237555bce8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890061Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712201}
parent 32ca944e
...@@ -475,8 +475,12 @@ if (enable_java_templates) { ...@@ -475,8 +475,12 @@ if (enable_java_templates) {
} }
# Filter out .d files. # Filter out .d files.
set_sources_assignment_filter([ "*.d" ]) sources = []
sources = get_target_outputs(":$_apply_gcc_target_name") foreach(_output, get_target_outputs(":$_apply_gcc_target_name")) {
if (get_path_info(_output, "extension") != "d") {
sources += [ _output ]
}
}
zip(target_name) { zip(target_name) {
forward_variables_from(invoker, [ "visibility" ]) forward_variables_from(invoker, [ "visibility" ])
......
...@@ -1398,15 +1398,12 @@ template("ios_framework_bundle") { ...@@ -1398,15 +1398,12 @@ template("ios_framework_bundle") {
# sources, so filter any non-header source files from "sources". It is # sources, so filter any non-header source files from "sources". It is
# less error prone that having the developer duplicate the list of all # less error prone that having the developer duplicate the list of all
# headers in addition to "sources". # headers in addition to "sources".
set_sources_assignment_filter([ sources = []
"*.c", foreach(_source, invoker.sources) {
"*.cc", if (get_path_info(_source, "extension") == "h") {
"*.cpp", sources += [ _source ]
"*.m", }
"*.mm", }
])
sources = invoker.sources
set_sources_assignment_filter([])
args = [ args = [
rebase_path(_header_map_filename), rebase_path(_header_map_filename),
......
...@@ -1429,9 +1429,12 @@ jumbo_component("platform") { ...@@ -1429,9 +1429,12 @@ jumbo_component("platform") {
sources += get_target_outputs(":character_data") + sources += get_target_outputs(":character_data") +
get_target_outputs(":color_data") + get_target_outputs(":color_data") +
get_target_outputs(":font_family_names") get_target_outputs(":font_family_names")
set_sources_assignment_filter([ "*.pickle" ])
sources += get_target_outputs(":runtime_enabled_features") foreach(_output, get_target_outputs(":runtime_enabled_features")) {
set_sources_assignment_filter(sources_assignment_filter) if (get_path_info(_output, "extension") != "pickle") {
sources += [ _output ]
}
}
if (is_win) { if (is_win) {
jumbo_excluded_sources = [ jumbo_excluded_sources = [
......
...@@ -314,13 +314,11 @@ template("grit") { ...@@ -314,13 +314,11 @@ template("grit") {
get_path_info(rebase_path(invoker.outputs, ".", output_dir), "abspath") get_path_info(rebase_path(invoker.outputs, ".", output_dir), "abspath")
# Add .info output for all pak files # Add .info output for all pak files
set_sources_assignment_filter([ "*.pak" ])
sources = grit_outputs
pak_grit_outputs = grit_outputs - sources
sources = []
pak_info_outputs = [] pak_info_outputs = []
foreach(output, pak_grit_outputs) { foreach(output, grit_outputs) {
pak_info_outputs += [ "${output}.info" ] if (get_path_info(output, "extension") == "pak") {
pak_info_outputs += [ output + ".info" ]
}
} }
grit_custom_target = target_name + "_grit" grit_custom_target = target_name + "_grit"
...@@ -391,16 +389,18 @@ template("grit") { ...@@ -391,16 +389,18 @@ template("grit") {
args += define_args + grit_flags + assert_files_flags args += define_args + grit_flags + assert_files_flags
if (enable_resource_whitelist_generation) { if (enable_resource_whitelist_generation) {
set_sources_assignment_filter([ "*.rc" ]) rc_grit_outputs = []
sources = grit_outputs foreach(output, grit_outputs) {
rc_grit_outputs = grit_outputs - sources if (get_path_info(output, "extension") == "rc") {
sources = [] rc_grit_outputs += [ output ]
}
}
if (rc_grit_outputs != []) { if (rc_grit_outputs != []) {
# Resource whitelisting cannot be used with .rc files. # Resource whitelisting cannot be used with .rc files.
# Make sure that there aren't any .pak outputs which would require # Make sure that there aren't any .pak outputs which would require
# whitelist annotations. # whitelist annotations.
assert(pak_grit_outputs == [], "can't combine .pak and .rc outputs") assert(pak_info_outputs == [], "can't combine .pak and .rc outputs")
} else { } else {
args += [ "--whitelist-support" ] args += [ "--whitelist-support" ]
} }
...@@ -474,13 +474,13 @@ template("grit") { ...@@ -474,13 +474,13 @@ template("grit") {
# Since we generate a file, we need to be run before the targets that # Since we generate a file, we need to be run before the targets that
# depend on us. # depend on us.
set_sources_assignment_filter([ sources = []
"*.json", foreach(output, grit_outputs) {
"*.pak", extension = get_path_info(output, "extension")
"*.xml", if (extension != "json" && extension != "pak" && extension != "xml") {
]) sources += [ output ]
sources = grit_outputs }
set_sources_assignment_filter(sources_assignment_filter) }
# Deps set on the template invocation will go on the action that runs # Deps set on the template invocation will go on the action that runs
# grit above rather than this library. This target needs to depend on the # grit above rather than this library. This target needs to depend on the
......
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