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) {
}
# Filter out .d files.
set_sources_assignment_filter([ "*.d" ])
sources = get_target_outputs(":$_apply_gcc_target_name")
sources = []
foreach(_output, get_target_outputs(":$_apply_gcc_target_name")) {
if (get_path_info(_output, "extension") != "d") {
sources += [ _output ]
}
}
zip(target_name) {
forward_variables_from(invoker, [ "visibility" ])
......
......@@ -1398,15 +1398,12 @@ template("ios_framework_bundle") {
# sources, so filter any non-header source files from "sources". It is
# less error prone that having the developer duplicate the list of all
# headers in addition to "sources".
set_sources_assignment_filter([
"*.c",
"*.cc",
"*.cpp",
"*.m",
"*.mm",
])
sources = invoker.sources
set_sources_assignment_filter([])
sources = []
foreach(_source, invoker.sources) {
if (get_path_info(_source, "extension") == "h") {
sources += [ _source ]
}
}
args = [
rebase_path(_header_map_filename),
......
......@@ -1429,9 +1429,12 @@ jumbo_component("platform") {
sources += get_target_outputs(":character_data") +
get_target_outputs(":color_data") +
get_target_outputs(":font_family_names")
set_sources_assignment_filter([ "*.pickle" ])
sources += get_target_outputs(":runtime_enabled_features")
set_sources_assignment_filter(sources_assignment_filter)
foreach(_output, get_target_outputs(":runtime_enabled_features")) {
if (get_path_info(_output, "extension") != "pickle") {
sources += [ _output ]
}
}
if (is_win) {
jumbo_excluded_sources = [
......
......@@ -314,13 +314,11 @@ template("grit") {
get_path_info(rebase_path(invoker.outputs, ".", output_dir), "abspath")
# 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 = []
foreach(output, pak_grit_outputs) {
pak_info_outputs += [ "${output}.info" ]
foreach(output, grit_outputs) {
if (get_path_info(output, "extension") == "pak") {
pak_info_outputs += [ output + ".info" ]
}
}
grit_custom_target = target_name + "_grit"
......@@ -391,16 +389,18 @@ template("grit") {
args += define_args + grit_flags + assert_files_flags
if (enable_resource_whitelist_generation) {
set_sources_assignment_filter([ "*.rc" ])
sources = grit_outputs
rc_grit_outputs = grit_outputs - sources
sources = []
rc_grit_outputs = []
foreach(output, grit_outputs) {
if (get_path_info(output, "extension") == "rc") {
rc_grit_outputs += [ output ]
}
}
if (rc_grit_outputs != []) {
# Resource whitelisting cannot be used with .rc files.
# Make sure that there aren't any .pak outputs which would require
# 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 {
args += [ "--whitelist-support" ]
}
......@@ -474,13 +474,13 @@ template("grit") {
# Since we generate a file, we need to be run before the targets that
# depend on us.
set_sources_assignment_filter([
"*.json",
"*.pak",
"*.xml",
])
sources = grit_outputs
set_sources_assignment_filter(sources_assignment_filter)
sources = []
foreach(output, grit_outputs) {
extension = get_path_info(output, "extension")
if (extension != "json" && extension != "pak" && extension != "xml") {
sources += [ output ]
}
}
# 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
......
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