Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: build/config/jumbo.gni

Issue 2972533002: Support C and Objective-C in jumbo base scripts. (Closed)
Patch Set: Fixup for fixup for core/editing for mac and objective-c Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/config/merge_for_jumbo.py » ('j') | build/config/merge_for_jumbo.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/split_static_library.gni") # When someone uses that target_type 5 import("//build/split_static_library.gni") # When someone uses that target_type
6 6
7 declare_args() { 7 declare_args() {
8 # If true, use a jumbo build (files compiled together) to speed up 8 # If true, use a jumbo build (files compiled together) to speed up
9 # compilation. 9 # compilation.
10 use_jumbo_build = false 10 use_jumbo_build = !is_official_build && !(is_android && !is_clang)
Daniel Bratell 2017/07/04 11:37:44 Just to make cq test it. Must not be committed.
11 11
12 # A target to exclude from jumbo builds, for optimal round trip time 12 # A target to exclude from jumbo builds, for optimal round trip time
13 # when frequently changing a single cpp file. 13 # when frequently changing a single cpp file.
14 jumbo_build_excluded = "" 14 jumbo_build_excluded = ""
15 15
16 # How many files to group at most. Smaller numbers give more 16 # How many files to group at most. Smaller numbers give more
17 # parallellism, higher numbers give less total CPU usage. Higher 17 # parallellism, higher numbers give less total CPU usage. Higher
18 # numbers also give longer single-file recompilation times. 18 # numbers also give longer single-file recompilation times.
19 # 19 #
20 # Recommendations: 20 # Recommendations:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 foreach(source_file, invoker.sources) { 79 foreach(source_file, invoker.sources) {
80 if (current_file_index == next_chunk_start) { 80 if (current_file_index == next_chunk_start) {
81 jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_" + 81 jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_" +
82 next_chunk_number + ".cc" ] 82 next_chunk_number + ".cc" ]
83 next_chunk_number += 1 83 next_chunk_number += 1
84 next_chunk_start += files_per_chunk 84 next_chunk_start += files_per_chunk
85 } 85 }
86 current_file_index += 1 86 current_file_index += 1
87 } 87 }
88 88
89 has_objective_c_file = false
90 has_c_file = false
91 foreach(source_file, invoker.sources) {
92 source_ext = get_path_info(source_file, "extension")
93 if (source_ext == "c") {
94 has_c_file = true
95 } else if (source_ext == "mm") {
96 has_objective_c_file = true
97 }
98 }
99 if (has_c_file) {
100 jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_c.c" ]
101 }
102 if (has_objective_c_file) {
103 jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_mm.mm" ]
104 }
Dirk Pranke 2017/07/04 17:15:15 Clever. I hadn't thought of an obvious way to do t
105
89 merge_action_name = target_name + "__jumbo_merge" 106 merge_action_name = target_name + "__jumbo_merge"
90 107
91 # Create an action that calls a script that merges all the source files. 108 # Create an action that calls a script that merges all the source files.
92 action(merge_action_name) { 109 action(merge_action_name) {
93 script = "//build/config/merge_for_jumbo.py" 110 script = "//build/config/merge_for_jumbo.py"
94 response_file_contents = 111 response_file_contents =
95 rebase_path(invoker.sources - excluded_sources, gen_target_dir) 112 rebase_path(invoker.sources - excluded_sources, gen_target_dir)
96 outputs = jumbo_files 113 outputs = jumbo_files
97 args = [ "--outputs" ] + rebase_path(outputs, root_build_dir) + 114 args = [ "--outputs" ] + rebase_path(outputs, root_build_dir) +
98 [ "--file-list={{response_file_name}}" ] 115 [ "--file-list={{response_file_name}}" ]
(...skipping 19 matching lines...) Expand all
118 135
119 # Take everything else not handled above from the invoker. 136 # Take everything else not handled above from the invoker.
120 variables_to_not_forward = [ "deps" ] 137 variables_to_not_forward = [ "deps" ]
121 if (use_jumbo_build_for_target) { 138 if (use_jumbo_build_for_target) {
122 deps += [ ":" + merge_action_name ] 139 deps += [ ":" + merge_action_name ]
123 variables_to_not_forward += [ "sources" ] 140 variables_to_not_forward += [ "sources" ]
124 assert(jumbo_files != []) 141 assert(jumbo_files != [])
125 sources = jumbo_files + excluded_sources 142 sources = jumbo_files + excluded_sources
126 143
127 # Need to keep the headers in sources so that dependency checks 144 # Need to keep the headers in sources so that dependency checks
128 # work, and we need to keep Objective-C code since they 145 # work.
129 # cannot be merged into a cc file (FIXME).
130 foreach(source_file, invoker.sources) { 146 foreach(source_file, invoker.sources) {
131 source_ext = get_path_info(source_file, "extension") 147 if (get_path_info(source_file, "extension") == "h") {
132 if (source_ext == "h" || source_ext == "mm") {
133 sources += [ source_file ] 148 sources += [ source_file ]
134 } 149 }
135 } 150 }
136 } 151 }
137 forward_variables_from(invoker, "*", variables_to_not_forward) 152 forward_variables_from(invoker, "*", variables_to_not_forward)
138 } 153 }
139 } 154 }
140 155
141 set_defaults("jumbo_target") { 156 set_defaults("jumbo_target") {
142 # This sets the default list of configs when the content_source_set target 157 # This sets the default list of configs when the content_source_set target
143 # is defined. The default_compiler_configs comes from BUILDCONFIG.gn and 158 # is defined. The default_compiler_configs comes from BUILDCONFIG.gn and
144 # is the list normally applied to static libraries and source sets. 159 # is the list normally applied to static libraries and source sets.
145 configs = default_compiler_configs 160 configs = default_compiler_configs
146 } 161 }
OLDNEW
« no previous file with comments | « no previous file | build/config/merge_for_jumbo.py » ('j') | build/config/merge_for_jumbo.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698