Commit b8e70980 authored by Jens Widell's avatar Jens Widell Committed by Commit Bot

Improve jumbo chunk generation code

The main improvement is that source files with unhandled extensions
other than .h, for example .json and .idl, are not counted towards the
merge limit, and thus can't lead to too many chunks being generated.

By restructuring, the code also iterates the source file list once
instead of twice, and calls get_path_info() once per source file instead
of twice.

Change-Id: I130c815c84fff08b6ad2d6f36434140efbeb2d29
Reviewed-on: https://chromium-review.googlesource.com/850397Reviewed-by: default avatarDaniel Bratell <bratell@opera.com>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#527099}
parent 64fcef1e
...@@ -127,9 +127,19 @@ template("internal_jumbo_target") { ...@@ -127,9 +127,19 @@ template("internal_jumbo_target") {
merge_limit = jumbo_file_merge_default merge_limit = jumbo_file_merge_default
} }
} }
has_c_file = false
has_objective_c_file = false
has_S_file = false
assert(merge_limit > 0) assert(merge_limit > 0)
foreach(source_file, invoker_sources) { foreach(source_file, invoker_sources) {
if (get_path_info(source_file, "extension") != "h") { source_ext = get_path_info(source_file, "extension")
if (source_ext == "c") {
has_c_file = true
} else if (source_ext == "mm") {
has_objective_c_file = true
} else if (source_ext == "S") {
has_S_file = true
} else if (source_ext == "cc" || source_ext == "cpp") {
if (current_file_index == next_chunk_start) { if (current_file_index == next_chunk_start) {
jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_" + jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_" +
next_chunk_number + ".cc" ] next_chunk_number + ".cc" ]
...@@ -148,22 +158,7 @@ template("internal_jumbo_target") { ...@@ -148,22 +158,7 @@ template("internal_jumbo_target") {
assert(next_chunk_start >= 0) # Prevent "unused variable" assert(next_chunk_start >= 0) # Prevent "unused variable"
assert(next_chunk_number <= 2) # Prevent "unused variable" assert(next_chunk_number <= 2) # Prevent "unused variable"
} }
}
if (use_jumbo_build_for_target) {
has_c_file = false
has_objective_c_file = false
has_S_file = false
foreach(source_file, invoker_sources) {
source_ext = get_path_info(source_file, "extension")
if (source_ext == "c") {
has_c_file = true
} else if (source_ext == "mm") {
has_objective_c_file = true
} else if (source_ext == "S") {
has_S_file = true
}
}
if (has_c_file) { if (has_c_file) {
jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_c.c" ] jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_c.c" ]
} }
...@@ -173,7 +168,9 @@ template("internal_jumbo_target") { ...@@ -173,7 +168,9 @@ template("internal_jumbo_target") {
if (has_S_file) { if (has_S_file) {
jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_S.S" ] jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_S.S" ]
} }
}
if (use_jumbo_build_for_target) {
merge_action_name = target_name + "__jumbo_merge" merge_action_name = target_name + "__jumbo_merge"
# Create an action that calls a script that merges all the source files. # Create an action that calls a script that merges all the source files.
......
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