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

Side by Side Diff: runtime/vm/BUILD.gn

Issue 2471713003: [gn] Consolidate calls to gypi_to_gn to speed up GN generation
Patch Set: 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 | « runtime/bin/gypi_contents.gni ('k') | runtime/vm/gypi_contents.gni » ('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 import("gypi_contents.gni")
6
5 config("libdart_vm_config") { 7 config("libdart_vm_config") {
6 if (defined(is_fuchsia) && is_fuchsia) { 8 if (defined(is_fuchsia) && is_fuchsia) {
7 libs = [ "magenta" ] 9 libs = [ "magenta" ]
8 } else if (is_win) { 10 } else if (is_win) {
9 libs = [ 11 libs = [
10 "advapi32.lib", 12 "advapi32.lib",
11 "shell32.lib", 13 "shell32.lib",
12 "dbghelp.lib", 14 "dbghelp.lib",
13 ] 15 ]
14 } else { 16 } else {
15 libs = [ "dl" ] 17 libs = [ "dl" ]
16 if (!is_android) { 18 if (!is_android) {
17 libs += [ "pthread" ] 19 libs += [ "pthread" ]
18 } 20 }
19 if (is_linux) { 21 if (is_linux) {
20 libs += [ "rt" ] 22 libs += [ "rt" ]
21 } 23 }
22 } 24 }
23 } 25 }
24 26
25 static_library("libdart_platform") { 27 static_library("libdart_platform") {
26 configs += [ 28 configs += [
27 "..:dart_config", 29 "..:dart_config",
28 "..:dart_maybe_product_config", 30 "..:dart_maybe_product_config",
29 ] 31 ]
30 public_configs = [ ":libdart_vm_config" ] 32 public_configs = [ ":libdart_vm_config" ]
31 33
32 platform_headers_gypi = 34 sources = rebase_path(processed_gypis.platform_sources, ".", "../platform")
33 exec_script("../../tools/gypi_to_gn.py",
34 [ rebase_path("../platform/platform_headers.gypi") ],
35 "scope",
36 [ "../platform/platform_headers.gypi" ])
37 platform_headers =
38 rebase_path(platform_headers_gypi.sources, ".", "../platform")
39 35
40 platform_sources_gypi =
41 exec_script("../../tools/gypi_to_gn.py",
42 [ rebase_path("../platform/platform_sources.gypi") ],
43 "scope",
44 [ "../platform/platform_sources.gypi" ])
45 platform_sources =
46 rebase_path(platform_sources_gypi.sources, ".", "../platform")
47
48 sources = platform_headers + platform_sources
49 include_dirs = [ ".." ] 36 include_dirs = [ ".." ]
50 } 37 }
51 38
52 vm_sources_list = exec_script("../../tools/gypi_to_gn.py", 39 vm_sources_list = processed_gypis.vm_sources
53 [ rebase_path("vm_sources.gypi") ],
54 "scope",
55 [ "vm_sources.gypi" ])
56 40
57 static_library("libdart_vm") { 41 static_library("libdart_vm") {
58 configs += [ 42 configs += [
59 "..:dart_config", 43 "..:dart_config",
60 "..:dart_maybe_product_config", 44 "..:dart_maybe_product_config",
61 "..:dart_maybe_precompiled_runtime_config", 45 "..:dart_maybe_precompiled_runtime_config",
62 ] 46 ]
63 public_configs = [ ":libdart_vm_config" ] 47 public_configs = [ ":libdart_vm_config" ]
64 set_sources_assignment_filter([ 48 set_sources_assignment_filter([
65 "*_test.cc", 49 "*_test.cc",
66 "*_test.h", 50 "*_test.h",
67 ]) 51 ])
68 sources = vm_sources_list.sources 52 sources = vm_sources_list
69 include_dirs = [ ".." ] 53 include_dirs = [ ".." ]
70 } 54 }
71 55
72 static_library("libdart_vm_noopt") { 56 static_library("libdart_vm_noopt") {
73 configs += [ 57 configs += [
74 "..:dart_config", 58 "..:dart_config",
75 "..:dart_maybe_product_config", 59 "..:dart_maybe_product_config",
76 "..:dart_precompiler_config", 60 "..:dart_precompiler_config",
77 "..:dart_maybe_precompiled_runtime_config", 61 "..:dart_maybe_precompiled_runtime_config",
78 ] 62 ]
79 public_configs = [ ":libdart_vm_config" ] 63 public_configs = [ ":libdart_vm_config" ]
80 set_sources_assignment_filter([ 64 set_sources_assignment_filter([
81 "*_test.cc", 65 "*_test.cc",
82 "*_test.h", 66 "*_test.h",
83 ]) 67 ])
84 sources = vm_sources_list.sources 68 sources = vm_sources_list
85 include_dirs = [ ".." ] 69 include_dirs = [ ".." ]
86 } 70 }
87 71
88 static_library("libdart_vm_precompiled_runtime") { 72 static_library("libdart_vm_precompiled_runtime") {
89 configs += [ 73 configs += [
90 "..:dart_config", 74 "..:dart_config",
91 "..:dart_maybe_product_config", 75 "..:dart_maybe_product_config",
92 "..:dart_precompiled_runtime_config", 76 "..:dart_precompiled_runtime_config",
93 ] 77 ]
94 public_configs = [ ":libdart_vm_config" ] 78 public_configs = [ ":libdart_vm_config" ]
95 set_sources_assignment_filter([ 79 set_sources_assignment_filter([
96 "*_test.cc", 80 "*_test.cc",
97 "*_test.h", 81 "*_test.h",
98 ]) 82 ])
99 sources = vm_sources_list.sources 83 sources = vm_sources_list
100 include_dirs = [ ".." ] 84 include_dirs = [ ".." ]
101 } 85 }
102 86
103 static_library("libdart_vm_nosnapshot") { 87 static_library("libdart_vm_nosnapshot") {
104 configs += [ 88 configs += [
105 "..:dart_config", 89 "..:dart_config",
106 "..:dart_maybe_product_config", 90 "..:dart_maybe_product_config",
107 "..:dart_maybe_precompiled_runtime_config", 91 "..:dart_maybe_precompiled_runtime_config",
108 "..:dart_no_snapshot_config", 92 "..:dart_no_snapshot_config",
109 ] 93 ]
110 public_configs = [ ":libdart_vm_config" ] 94 public_configs = [ ":libdart_vm_config" ]
111 set_sources_assignment_filter([ 95 set_sources_assignment_filter([
112 "*_test.cc", 96 "*_test.cc",
113 "*_test.h", 97 "*_test.h",
114 ]) 98 ])
115 sources = vm_sources_list.sources 99 sources = vm_sources_list
116 include_dirs = [ ".." ] 100 include_dirs = [ ".." ]
117 } 101 }
118 102
119 static_library("libdart_vm_nosnapshot_precompiled_runtime") { 103 static_library("libdart_vm_nosnapshot_precompiled_runtime") {
120 configs += [ 104 configs += [
121 "..:dart_config", 105 "..:dart_config",
122 "..:dart_maybe_product_config", 106 "..:dart_maybe_product_config",
123 "..:dart_precompiled_runtime_config", 107 "..:dart_precompiled_runtime_config",
124 "..:dart_no_snapshot_config", 108 "..:dart_no_snapshot_config",
125 ] 109 ]
126 public_configs = [ ":libdart_vm_config" ] 110 public_configs = [ ":libdart_vm_config" ]
127 set_sources_assignment_filter([ 111 set_sources_assignment_filter([
128 "*_test.cc", 112 "*_test.cc",
129 "*_test.h", 113 "*_test.h",
130 ]) 114 ])
131 sources = vm_sources_list.sources 115 sources = vm_sources_list
132 include_dirs = [ ".." ] 116 include_dirs = [ ".." ]
133 } 117 }
134 118
135 static_library("libdart_vm_nosnapshot_with_precompiler") { 119 static_library("libdart_vm_nosnapshot_with_precompiler") {
136 configs += [ 120 configs += [
137 "..:dart_config", 121 "..:dart_config",
138 "..:dart_maybe_product_config", 122 "..:dart_maybe_product_config",
139 "..:dart_precompiler_config", 123 "..:dart_precompiler_config",
140 "..:dart_no_snapshot_config", 124 "..:dart_no_snapshot_config",
141 ] 125 ]
142 public_configs = [ ":libdart_vm_config" ] 126 public_configs = [ ":libdart_vm_config" ]
143 set_sources_assignment_filter([ 127 set_sources_assignment_filter([
144 "*_test.cc", 128 "*_test.cc",
145 "*_test.h", 129 "*_test.h",
146 ]) 130 ])
147 sources = vm_sources_list.sources 131 sources = vm_sources_list
148 include_dirs = [ ".." ] 132 include_dirs = [ ".." ]
149 } 133 }
150 134
151 template("process_library_source") { 135 template("process_library_source") {
152 assert(defined(invoker.filename), "Need filename in $target_name") 136 assert(defined(invoker.filename), "Need filename in $target_name")
137 assert(defined(invoker.type), "Need type in $target_name")
153 assert(defined(invoker.output), "Need output in $target_name") 138 assert(defined(invoker.output), "Need output in $target_name")
139 assert(defined(invoker.type), "Need type in $target_name")
154 assert(defined(invoker.path), "Need path in $target_name") 140 assert(defined(invoker.path), "Need path in $target_name")
155 action(target_name) { 141 action(target_name) {
156 visibility = [ ":*" ] # Only targets in this file can see this. 142 visibility = [ ":*" ] # Only targets in this file can see this.
157 filename = invoker.filename 143 filename = invoker.filename
144 type = invoker.type
158 path = invoker.path 145 path = invoker.path
159 146
160 lib_sources_gypi = 147 lib_sources =
161 exec_script("../../tools/gypi_to_gn.py", 148 rebase_path(processed_gypis["${filename}_${type}_sources"], ".", path)
162 [ rebase_path("${path}/${filename}_sources.gypi") ],
163 "scope",
164 [ "${path}/${filename}_sources.gypi" ])
165 lib_sources = rebase_path(lib_sources_gypi.sources, ".", path)
166 149
167 script = invoker.script 150 script = invoker.script
168 inputs = invoker.inputs + [ script ] 151 inputs = invoker.inputs + [ script ]
169 inputs += lib_sources 152 inputs += lib_sources
170 outputs = [ 153 outputs = [
171 invoker.output, 154 invoker.output,
172 ] 155 ]
173 args = invoker.args + rebase_path(lib_sources, root_build_dir) 156 args = invoker.args + rebase_path(lib_sources, root_build_dir)
174 } 157 }
175 } 158 }
176 159
177 template("generate_library_source") { 160 template("generate_library_source") {
178 assert(defined(invoker.libname), "Need libname in $target_name") 161 assert(defined(invoker.libname), "Need libname in $target_name")
179 assert(defined(invoker.filename), "Need a filename in $target_name") 162 assert(defined(invoker.filename), "Need a filename in $target_name")
180 assert(defined(invoker.kind), "Need kind in $target_name") 163 assert(defined(invoker.kind), "Need kind in $target_name")
164 assert(defined(invoker.type), "Need type in $target_name")
181 assert(defined(invoker.output), "Need output in $target_name") 165 assert(defined(invoker.output), "Need output in $target_name")
182 assert(defined(invoker.path), "Need path in $target_name")
183 166
184 process_library_source(target_name) { 167 process_library_source(target_name) {
185 libname = invoker.libname 168 libname = invoker.libname
186 filename = invoker.filename 169 filename = invoker.filename
187 kind = invoker.kind 170 kind = invoker.kind
171 type = invoker.type
188 output = invoker.output 172 output = invoker.output
189 path = invoker.path 173
174 if (type == "sdk") {
175 path = "../../sdk/lib/" + filename
176 } else {
177 path = "../lib"
178 }
190 script = "../tools/gen_library_src_paths.py" 179 script = "../tools/gen_library_src_paths.py"
191 inputs = [ 180 inputs = [
192 "../lib/libgen_in.cc", 181 "../lib/libgen_in.cc",
193 ] 182 ]
194 args = [ 183 args = [
195 "--output", 184 "--output",
196 rebase_path(invoker.output, root_build_dir), 185 rebase_path(invoker.output, root_build_dir),
197 "--input_cc", 186 "--input_cc",
198 rebase_path("../lib/libgen_in.cc", root_build_dir), 187 rebase_path("../lib/libgen_in.cc", root_build_dir),
199 "--include", 188 "--include",
(...skipping 16 matching lines...) Expand all
216 # The template iterates over the list, and generates generate_library_source 205 # The template iterates over the list, and generates generate_library_source
217 # actions for each. After that, it generates targets to compile the generated 206 # actions for each. After that, it generates targets to compile the generated
218 # sources to make libdart_lib_nosnapshot and libdart_lib. 207 # sources to make libdart_lib_nosnapshot and libdart_lib.
219 template("generate_core_libraries") { 208 template("generate_core_libraries") {
220 assert(defined(invoker.sources), "Need sources in $target_name") 209 assert(defined(invoker.sources), "Need sources in $target_name")
221 liboutputs = [] 210 liboutputs = []
222 libsources = [] 211 libsources = []
223 libdeps = [] 212 libdeps = []
224 foreach(lib, invoker.sources) { 213 foreach(lib, invoker.sources) {
225 libname = lib[0] 214 libname = lib[0]
226 filename = lib[1] 215 type = lib[1]
227 do_patch = lib[2] 216 filename = lib[2]
228 source_path = lib[3] 217 do_patch = lib[3]
229 generate_library_source("generate_${filename}_cc_file") { 218 generate_library_source("generate_${filename}_cc_file") {
230 libname = libname 219 libname = libname
231 filename = filename 220 filename = filename
232 kind = "source" 221 kind = "source"
233 path = source_path 222 type = type
234 output = "$target_gen_dir/${filename}_gen.cc" 223 output = "$target_gen_dir/${filename}_gen.cc"
235 } 224 }
236 if (do_patch) { 225 if (do_patch) {
237 patch_path = lib[4]
238 generate_library_source("generate_${filename}_patch_cc_file") { 226 generate_library_source("generate_${filename}_patch_cc_file") {
239 libname = libname 227 libname = libname
240 filename = filename 228 filename = filename
241 kind = "patch" 229 kind = "patch"
242 path = patch_path 230 type = "runtime"
243 output = "$target_gen_dir/${filename}_patch_gen.cc" 231 output = "$target_gen_dir/${filename}_patch_gen.cc"
244 } 232 }
245 } 233 }
246 lib_sources_gypi = { 234 libsources += rebase_path(processed_gypis["${filename}_runtime_sources"],
247 } 235 ".",
248 lib_sources_gypi = 236 "../lib")
249 exec_script("../../tools/gypi_to_gn.py",
250 [ rebase_path("../lib/${filename}_sources.gypi") ],
251 "scope",
252 [ "../lib/${filename}_sources.gypi" ])
253 libsources += rebase_path(lib_sources_gypi.sources, ".", "../lib")
254 liboutputs += [ "$target_gen_dir/${filename}_gen.cc" ] 237 liboutputs += [ "$target_gen_dir/${filename}_gen.cc" ]
255 libdeps += [ ":generate_${filename}_cc_file" ] 238 libdeps += [ ":generate_${filename}_cc_file" ]
256 if (do_patch) { 239 if (do_patch) {
257 liboutputs += [ "$target_gen_dir/${filename}_patch_gen.cc" ] 240 liboutputs += [ "$target_gen_dir/${filename}_patch_gen.cc" ]
258 libdeps += [ ":generate_${filename}_patch_cc_file" ] 241 libdeps += [ ":generate_${filename}_patch_cc_file" ]
259 } 242 }
260 } 243 }
261 244
262 static_library("libdart_lib_nosnapshot") { 245 static_library("libdart_lib_nosnapshot") {
263 configs += [ 246 configs += [
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 ] 289 ]
307 sources = libsources + [ "bootstrap_nocore.cc" ] 290 sources = libsources + [ "bootstrap_nocore.cc" ]
308 include_dirs = [ ".." ] 291 include_dirs = [ ".." ]
309 } 292 }
310 } 293 }
311 294
312 generate_core_libraries("core_libraries") { 295 generate_core_libraries("core_libraries") {
313 sources = [ 296 sources = [
314 [ 297 [
315 "async", 298 "async",
299 "sdk",
316 "async", 300 "async",
317 true, 301 true,
318 "../../sdk/lib/async",
319 "../lib",
320 ], 302 ],
321 [ 303 [
322 "core", 304 "core",
305 "sdk",
323 "core", 306 "core",
324 true, 307 true,
325 "../../sdk/lib/core",
326 "../lib",
327 ], 308 ],
328 [ 309 [
329 "collection", 310 "collection",
311 "sdk",
330 "collection", 312 "collection",
331 true, 313 true,
332 "../../sdk/lib/collection",
333 "../lib",
334 ], 314 ],
335 [ 315 [
336 "convert", 316 "convert",
317 "sdk",
337 "convert", 318 "convert",
338 true, 319 true,
339 "../../sdk/lib/convert",
340 "../lib",
341 ], 320 ],
342 [ 321 [
343 "developer", 322 "developer",
323 "sdk",
344 "developer", 324 "developer",
345 true, 325 true,
346 "../../sdk/lib/developer",
347 "../lib",
348 ], 326 ],
349 [ 327 [
350 "_internal", 328 "_internal",
329 "sdk",
351 "internal", 330 "internal",
352 true, 331 true,
353 "../../sdk/lib/internal",
354 "../lib",
355 ], 332 ],
356 [ 333 [
357 "isolate", 334 "isolate",
335 "sdk",
358 "isolate", 336 "isolate",
359 true, 337 true,
360 "../../sdk/lib/isolate",
361 "../lib",
362 ], 338 ],
363 [ 339 [
364 "math", 340 "math",
341 "sdk",
365 "math", 342 "math",
366 true, 343 true,
367 "../../sdk/lib/math",
368 "../lib",
369 ], 344 ],
370 [ 345 [
371 "mirrors", 346 "mirrors",
347 "sdk",
372 "mirrors", 348 "mirrors",
373 true, 349 true,
374 "../../sdk/lib/mirrors",
375 "../lib",
376 ], 350 ],
377 [ 351 [
378 "profiler", 352 "profiler",
353 "sdk",
379 "profiler", 354 "profiler",
380 false, 355 false,
381 "../../sdk/lib/profiler",
382 ], 356 ],
383 [ 357 [
384 "typed_data", 358 "typed_data",
359 "runtime",
385 "typed_data", 360 "typed_data",
386 false, 361 false,
387 "../lib",
388 ], 362 ],
389 [ 363 [
390 "_vmservice", 364 "_vmservice",
365 "sdk",
391 "vmservice", 366 "vmservice",
392 true, 367 true,
393 "../../sdk/lib/vmservice",
394 "../lib",
395 ], 368 ],
396 ] 369 ]
397 } 370 }
398 371
399 template("concatenate_patch") { 372 template("concatenate_patch") {
400 assert(defined(invoker.libname), "Need a name in $target_name") 373 assert(defined(invoker.libname), "Need a name in $target_name")
401 assert(defined(invoker.dir), "Need a dir in $target_name") 374 assert(defined(invoker.dir), "Need a dir in $target_name")
402 assert(defined(invoker.output), "Need an output in $target_name") 375 assert(defined(invoker.output), "Need an output in $target_name")
403 376
404 process_library_source(target_name) { 377 process_library_source(target_name) {
405 output = invoker.output 378 output = invoker.output
406 path = "../${invoker.dir}" 379 path = "../${invoker.dir}"
380 type = "sdk"
407 filename = invoker.libname 381 filename = invoker.libname
408 script = "../tools/concatenate_patches.py" 382 script = "../tools/concatenate_patches.py"
409 args = [ 383 args = [
410 "--output", 384 "--output",
411 rebase_path(output, root_build_dir), 385 rebase_path(output, root_build_dir),
412 ] 386 ]
413 inputs = [] 387 inputs = []
414 } 388 }
415 } 389 }
416 390
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 "vmservice", 509 "vmservice",
536 ], 510 ],
537 [ 511 [
538 "bin", 512 "bin",
539 "io", 513 "io",
540 ], 514 ],
541 ] 515 ]
542 } 516 }
543 517
544 } 518 }
OLDNEW
« no previous file with comments | « runtime/bin/gypi_contents.gni ('k') | runtime/vm/gypi_contents.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698