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

Side by Side Diff: runtime/BUILD.gn

Issue 2451613005: Format GN files and add a presubmit check that GN is properly formatted (Closed)
Patch Set: Fix gn args Created 4 years, 1 month 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 | « pkg/BUILD.gn ('k') | runtime/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 declare_args() { 5 declare_args() {
6 # Instead of using is_debug, we introduce a different flag for specifying a 6 # Instead of using is_debug, we introduce a different flag for specifying a
7 # Debug build of Dart so that clients can still use a Release build of Dart 7 # Debug build of Dart so that clients can still use a Release build of Dart
8 # while themselves doing a Debug build. 8 # while themselves doing a Debug build.
9 dart_debug = false 9 dart_debug = false
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 # Explicitly set the target architecture in case of precompilation. Leaving 25 # Explicitly set the target architecture in case of precompilation. Leaving
26 # this unspecified results in automatic target architecture detection. 26 # this unspecified results in automatic target architecture detection.
27 # Available options are: arm, arm64, mips, x64 and ia32 27 # Available options are: arm, arm64, mips, x64 and ia32
28 dart_target_arch = "" 28 dart_target_arch = ""
29 29
30 dart_experimental_interpreter = false 30 dart_experimental_interpreter = false
31 } 31 }
32 32
33 config("dart_public_config") { 33 config("dart_public_config") {
34 include_dirs = [ 34 include_dirs = [ "." ]
35 ".",
36 ]
37 } 35 }
38 36
39 # Adds PRODUCT define if Flutter has specified "release" for dart_runtime_mode 37 # Adds PRODUCT define if Flutter has specified "release" for dart_runtime_mode
40 config("dart_maybe_product_config") { 38 config("dart_maybe_product_config") {
41 defines = [] 39 defines = []
42 40
43 if ((dart_runtime_mode != "develop") && 41 if (dart_runtime_mode != "develop" && dart_runtime_mode != "profile" &&
44 (dart_runtime_mode != "profile") && 42 dart_runtime_mode != "release") {
45 (dart_runtime_mode != "release")) {
46 print("Invalid |dart_runtime_mode|") 43 print("Invalid |dart_runtime_mode|")
47 assert(false) 44 assert(false)
48 } 45 }
49 46
50 if (dart_runtime_mode == "release") { 47 if (dart_runtime_mode == "release") {
51 if (dart_debug) { 48 if (dart_debug) {
52 print("Debug and release mode are mutually exclusive.") 49 print("Debug and release mode are mutually exclusive.")
53 } 50 }
54 assert(!dart_debug) 51 assert(!dart_debug)
55 defines += ["PRODUCT"] 52 defines += [ "PRODUCT" ]
56 } 53 }
57 } 54 }
58 55
59 # Adds the DART_PRECOMPILED_RUNTIME define if Flutter has specified "profile" or 56 # Adds the DART_PRECOMPILED_RUNTIME define if Flutter has specified "profile" or
60 # "release" for dart_runtime_mode. 57 # "release" for dart_runtime_mode.
61 config("dart_maybe_precompiled_runtime_config") { 58 config("dart_maybe_precompiled_runtime_config") {
62 defines = [] 59 defines = []
63 60
64 if ((dart_runtime_mode != "develop") && 61 if (dart_runtime_mode != "develop" && dart_runtime_mode != "profile" &&
65 (dart_runtime_mode != "profile") && 62 dart_runtime_mode != "release") {
66 (dart_runtime_mode != "release")) {
67 print("Invalid |dart_runtime_mode|") 63 print("Invalid |dart_runtime_mode|")
68 assert(false) 64 assert(false)
69 } 65 }
70 66
71 if (dart_runtime_mode == "release") { 67 if (dart_runtime_mode == "release") {
72 if (dart_debug) { 68 if (dart_debug) {
73 print("Debug and release mode are mutually exclusive.") 69 print("Debug and release mode are mutually exclusive.")
74 } 70 }
75 assert(!dart_debug) 71 assert(!dart_debug)
76 72
77 if (!dart_experimental_interpreter) { 73 if (!dart_experimental_interpreter) {
78 defines += ["DART_PRECOMPILED_RUNTIME"] 74 defines += [ "DART_PRECOMPILED_RUNTIME" ]
79 } 75 }
80 } else if (dart_runtime_mode == "profile") { 76 } else if (dart_runtime_mode == "profile") {
81 if (!dart_experimental_interpreter) { 77 if (!dart_experimental_interpreter) {
82 defines += ["DART_PRECOMPILED_RUNTIME"] 78 defines += [ "DART_PRECOMPILED_RUNTIME" ]
83 } 79 }
84 } 80 }
85 } 81 }
86 82
87 config("dart_precompiled_runtime_config") { 83 config("dart_precompiled_runtime_config") {
88 defines = [] 84 defines = []
89 defines += ["DART_PRECOMPILED_RUNTIME"] 85 defines += [ "DART_PRECOMPILED_RUNTIME" ]
90 } 86 }
91 87
92 # Controls DART_PRECOMPILER #define. 88 # Controls DART_PRECOMPILER #define.
93 config("dart_precompiler_config") { 89 config("dart_precompiler_config") {
94 defines = [] 90 defines = []
95 defines += ["DART_PRECOMPILER"] 91 defines += [ "DART_PRECOMPILER" ]
96 } 92 }
97 93
98 config("dart_no_snapshot_config") { 94 config("dart_no_snapshot_config") {
99 defines = [] 95 defines = []
100 defines += ["DART_NO_SNAPSHOT"] 96 defines += [ "DART_NO_SNAPSHOT" ]
101 } 97 }
102 98
103 config("dart_config") { 99 config("dart_config") {
104 defines = [] 100 defines = []
105 101
106 if (dart_experimental_interpreter) { 102 if (dart_experimental_interpreter) {
107 dart_target_arch = "dbc" 103 dart_target_arch = "dbc"
108 } 104 }
109 105
110 if (dart_target_arch != "") { 106 if (dart_target_arch != "") {
111 if ((dart_target_arch == "arm") || 107 if (dart_target_arch == "arm" || dart_target_arch == "simarm") {
112 (dart_target_arch == "simarm")) {
113 defines += [ "TARGET_ARCH_ARM" ] 108 defines += [ "TARGET_ARCH_ARM" ]
114 if (target_os == "mac" || target_os == "ios") { 109 if (target_os == "mac" || target_os == "ios") {
115 defines += [ "TARGET_ABI_IOS" ] 110 defines += [ "TARGET_ABI_IOS" ]
116 } else { 111 } else {
117 defines += [ "TARGET_ABI_EABI" ] 112 defines += [ "TARGET_ABI_EABI" ]
118 } 113 }
119 } else if ((dart_target_arch == "armv6") || 114 } else if (dart_target_arch == "armv6" || dart_target_arch == "simarmv6") {
120 (dart_target_arch == "simarmv6")) {
121 defines += [ "TARGET_ARCH_ARM" ] 115 defines += [ "TARGET_ARCH_ARM" ]
122 defines += [ "TARGET_ARCH_ARM_6" ] 116 defines += [ "TARGET_ARCH_ARM_6" ]
123 defines += [ "TARGET_ABI_EABI" ] 117 defines += [ "TARGET_ABI_EABI" ]
124 } else if ((dart_target_arch == "armv5te") || 118 } else if (dart_target_arch == "armv5te" ||
125 (dart_target_arch == "simarmv5te")) { 119 dart_target_arch == "simarmv5te") {
126 defines += [ "TARGET_ARCH_ARM" ] 120 defines += [ "TARGET_ARCH_ARM" ]
127 defines += [ "TARGET_ARCH_ARM_5TE" ] 121 defines += [ "TARGET_ARCH_ARM_5TE" ]
128 defines += [ "TARGET_ABI_EABI" ] 122 defines += [ "TARGET_ABI_EABI" ]
129 } else if ((dart_target_arch == "arm64") || 123 } else if (dart_target_arch == "arm64" || dart_target_arch == "simarm64") {
130 (dart_target_arch == "simarm64")) {
131 defines += [ "TARGET_ARCH_ARM64" ] 124 defines += [ "TARGET_ARCH_ARM64" ]
132 } else if ((dart_target_arch == "mips") || 125 } else if (dart_target_arch == "mips" || dart_target_arch == "simmips") {
133 (dart_target_arch == "simmips")) {
134 defines += [ "TARGET_ARCH_MIPS" ] 126 defines += [ "TARGET_ARCH_MIPS" ]
135 } else if (dart_target_arch == "x64") { 127 } else if (dart_target_arch == "x64") {
136 defines += [ "TARGET_ARCH_X64" ] 128 defines += [ "TARGET_ARCH_X64" ]
137 } else if (dart_target_arch == "ia32") { 129 } else if (dart_target_arch == "ia32") {
138 defines += [ "TARGET_ARCH_IA32" ] 130 defines += [ "TARGET_ARCH_IA32" ]
139 } else if ((dart_target_arch == "dbc") || 131 } else if (dart_target_arch == "dbc" || dart_target_arch == "simdbc" ||
140 (dart_target_arch == "simdbc") || 132 dart_target_arch == "simdbc64") {
141 (dart_target_arch == "simdbc64")) {
142 defines += [ "TARGET_ARCH_DBC" ] 133 defines += [ "TARGET_ARCH_DBC" ]
143 defines += [ "USING_SIMULATOR" ] 134 defines += [ "USING_SIMULATOR" ]
144 } else { 135 } else {
145 print("Invalid |dart_target_arch|") 136 print("Invalid |dart_target_arch|")
146 assert(false) 137 assert(false)
147 } 138 }
148 } 139 }
149 140
150 if (dart_debug) { 141 if (dart_debug) {
151 defines += ["DEBUG"] 142 defines += [ "DEBUG" ]
152 } else { 143 } else {
153 defines += ["NDEBUG"] 144 defines += [ "NDEBUG" ]
154 } 145 }
155 146
156 if (!is_win) { 147 if (!is_win) {
157 cflags = [ 148 cflags = [
158 "-Werror", 149 "-Werror",
159 "-Wall", 150 "-Wall",
160 "-Wextra", # Also known as -W. 151 "-Wextra", # Also known as -W.
161 "-Wno-unused-parameter", 152 "-Wno-unused-parameter",
162 "-Wnon-virtual-dtor", 153 "-Wnon-virtual-dtor",
163 "-Wvla", 154 "-Wvla",
164 "-Wno-conversion-null", 155 "-Wno-conversion-null",
165 "-Woverloaded-virtual", 156 "-Woverloaded-virtual",
166 "-g3", 157 "-g3",
167 "-ggdb3", 158 "-ggdb3",
168 "-fno-rtti", 159 "-fno-rtti",
169 "-fno-exceptions", 160 "-fno-exceptions",
170 ] 161 ]
171 162
172 if (dart_debug) { 163 if (dart_debug) {
173 cflags += [ 164 cflags += [ "-O1" ]
174 "-O1",
175 ]
176 } else { 165 } else {
177 cflags += [ 166 cflags += [ "-O3" ]
178 "-O3",
179 ]
180 } 167 }
181 168
182 if (defined(is_asan) && is_asan) { 169 if (defined(is_asan) && is_asan) {
183 ldflags = [ 170 ldflags = [ "-fsanitize=address" ]
184 "-fsanitize=address",
185 ]
186 } 171 }
187 } 172 }
188 } 173 }
189 174
190 template("libdart_library") { 175 template("libdart_library") {
191 extra_configs = [] 176 extra_configs = []
192 if (defined(invoker.extra_configs)) { 177 if (defined(invoker.extra_configs)) {
193 extra_configs += invoker.extra_configs 178 extra_configs += invoker.extra_configs
194 } 179 }
195 extra_deps = [] 180 extra_deps = []
196 if (defined(invoker.extra_deps)) { 181 if (defined(invoker.extra_deps)) {
197 extra_deps += invoker.extra_deps 182 extra_deps += invoker.extra_deps
198 } 183 }
199 static_library(target_name) { 184 static_library(target_name) {
200 configs += [ 185 configs += [
201 ":dart_config", 186 ":dart_config",
202 ":dart_maybe_product_config" 187 ":dart_maybe_product_config",
203 ] + extra_configs 188 ] + extra_configs
204 deps = [ 189 deps = [
205 "vm:libdart_platform", 190 "vm:libdart_platform",
206 "third_party/double-conversion/src:libdouble_conversion", 191 "third_party/double-conversion/src:libdouble_conversion",
207 ":generate_version_cc_file", 192 ":generate_version_cc_file",
208 ] + extra_deps 193 ] + extra_deps
209 include_dirs = [ 194 include_dirs = [ "." ]
210 ".", 195 public_configs = [ ":dart_public_config" ]
211 ]
212 public_configs = [":dart_public_config"]
213 sources = [ 196 sources = [
197 "$target_gen_dir/version.cc",
214 "include/dart_api.h", 198 "include/dart_api.h",
215 "include/dart_mirrors_api.h", 199 "include/dart_mirrors_api.h",
216 "include/dart_native_api.h", 200 "include/dart_native_api.h",
217 "include/dart_tools_api.h", 201 "include/dart_tools_api.h",
218 "vm/dart_api_impl.cc", 202 "vm/dart_api_impl.cc",
219 "vm/debugger_api_impl.cc", 203 "vm/debugger_api_impl.cc",
220 "vm/mirrors_api_impl.cc", 204 "vm/mirrors_api_impl.cc",
221 "vm/native_api_impl.cc", 205 "vm/native_api_impl.cc",
222 "vm/version.h", 206 "vm/version.h",
223 "$target_gen_dir/version.cc",
224 ] 207 ]
225 defines = [ 208 defines = [ "DART_SHARED_LIB" ]
226 "DART_SHARED_LIB",
227 ]
228 } 209 }
229 } 210 }
230 211
231 libdart_library("libdart") { 212 libdart_library("libdart") {
232 extra_configs = [ 213 extra_configs = [ ":dart_maybe_precompiled_runtime_config" ]
233 ":dart_maybe_precompiled_runtime_config"
234 ]
235 extra_deps = [ 214 extra_deps = [
236 "vm:libdart_lib", 215 "vm:libdart_lib",
237 "vm:libdart_vm", 216 "vm:libdart_vm",
238 ] 217 ]
239 } 218 }
240 219
241 libdart_library("libdart_noopt") { 220 libdart_library("libdart_noopt") {
242 extra_configs = [ 221 extra_configs = [
243 ":dart_maybe_precompiled_runtime_config", 222 ":dart_maybe_precompiled_runtime_config",
244 ":dart_precompiler_config", 223 ":dart_precompiler_config",
245 ] 224 ]
246 extra_deps = [ 225 extra_deps = [
247 "vm:libdart_lib", 226 "vm:libdart_lib",
248 "vm:libdart_vm_noopt", 227 "vm:libdart_vm_noopt",
249 ] 228 ]
250 } 229 }
251 230
252 libdart_library("libdart_precompiled_runtime") { 231 libdart_library("libdart_precompiled_runtime") {
253 extra_configs = [ 232 extra_configs = [ ":dart_precompiled_runtime_config" ]
254 ":dart_precompiled_runtime_config"
255 ]
256 extra_deps = [ 233 extra_deps = [
257 "vm:libdart_lib_precompiled_runtime", 234 "vm:libdart_lib_precompiled_runtime",
258 "vm:libdart_vm_precompiled_runtime", 235 "vm:libdart_vm_precompiled_runtime",
259 ] 236 ]
260 } 237 }
261 238
262 libdart_library("libdart_nosnapshot") { 239 libdart_library("libdart_nosnapshot") {
263 extra_configs = [ 240 extra_configs = [
264 ":dart_no_snapshot_config", 241 ":dart_no_snapshot_config",
265 ":dart_maybe_precompiled_runtime_config" 242 ":dart_maybe_precompiled_runtime_config",
266 ] 243 ]
267 extra_deps = [ 244 extra_deps = [
268 "vm:libdart_lib_nosnapshot", 245 "vm:libdart_lib_nosnapshot",
269 "vm:libdart_vm_nosnapshot", 246 "vm:libdart_vm_nosnapshot",
270 ] 247 ]
271 } 248 }
272 249
273 libdart_library("libdart_nosnapshot_precompiled_runtime") { 250 libdart_library("libdart_nosnapshot_precompiled_runtime") {
274 extra_configs = [ 251 extra_configs = [
275 ":dart_no_snapshot_config", 252 ":dart_no_snapshot_config",
276 ":dart_precompiled_runtime_config" 253 ":dart_precompiled_runtime_config",
277 ] 254 ]
278 extra_deps = [ 255 extra_deps = [
279 "vm:libdart_lib_nosnapshot_precompiled_runtime", 256 "vm:libdart_lib_nosnapshot_precompiled_runtime",
280 "vm:libdart_vm_nosnapshot_precompiled_runtime", 257 "vm:libdart_vm_nosnapshot_precompiled_runtime",
281 ] 258 ]
282 } 259 }
283 260
284 libdart_library("libdart_nosnapshot_with_precompiler") { 261 libdart_library("libdart_nosnapshot_with_precompiler") {
285 extra_configs = [ 262 extra_configs = [
286 ":dart_no_snapshot_config", 263 ":dart_no_snapshot_config",
287 ":dart_precompiler_config", 264 ":dart_precompiler_config",
288 ] 265 ]
289 extra_deps = [ 266 extra_deps = [
290 "vm:libdart_lib_nosnapshot_with_precompiler", 267 "vm:libdart_lib_nosnapshot_with_precompiler",
291 "vm:libdart_vm_nosnapshot_with_precompiler", 268 "vm:libdart_vm_nosnapshot_with_precompiler",
292 ] 269 ]
293 } 270 }
294 271
295 action("generate_version_cc_file") { 272 action("generate_version_cc_file") {
296 deps = [ 273 deps = [
297 ":libdart_dependency_helper", 274 ":libdart_dependency_helper",
298 ] 275 ]
299 inputs = [ 276 inputs = [
300 "../tools/utils.py", 277 "../tools/utils.py",
301 "../tools/print_version.py", 278 "../tools/print_version.py",
302 "../tools/VERSION", 279 "../tools/VERSION",
303 "vm/version_in.cc", 280 "vm/version_in.cc",
304 ] 281 ]
305 output = "$target_gen_dir/version.cc" 282 output = "$target_gen_dir/version.cc"
306 outputs = [ output, ] 283 outputs = [
284 output,
285 ]
307 286
308 script = "../tools/make_version.py" 287 script = "../tools/make_version.py"
309 args = [ 288 args = [
310 "--quiet", 289 "--quiet",
311 "--output", rebase_path(output, root_build_dir), 290 "--output",
312 "--input", rebase_path("vm/version_in.cc", root_build_dir), 291 rebase_path(output, root_build_dir),
292 "--input",
293 rebase_path("vm/version_in.cc", root_build_dir),
313 ] 294 ]
314 } 295 }
315 296
316
317 executable("libdart_dependency_helper") { 297 executable("libdart_dependency_helper") {
318 configs += [":dart_config", 298 configs += [
319 ":dart_maybe_product_config"] 299 ":dart_config",
300 ":dart_maybe_product_config",
301 ]
320 deps = [ 302 deps = [
303 "third_party/double-conversion/src:libdouble_conversion",
304 "vm:libdart_lib",
321 "vm:libdart_lib_nosnapshot", 305 "vm:libdart_lib_nosnapshot",
322 "vm:libdart_lib", 306 "vm:libdart_platform",
323 "vm:libdart_vm", 307 "vm:libdart_vm",
324 "vm:libdart_platform",
325 "third_party/double-conversion/src:libdouble_conversion",
326 ] 308 ]
327 sources = [ 309 sources = [
328 "vm/libdart_dependency_helper.cc", 310 "vm/libdart_dependency_helper.cc",
329 ] 311 ]
330 } 312 }
OLDNEW
« no previous file with comments | « pkg/BUILD.gn ('k') | runtime/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698