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

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

Issue 2472813002: [gn] Consolidate exec_script calls to speed up generation (Closed)
Patch Set: fix paths to sources in generate_patched_sdk 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 | « no previous file | runtime/bin/gypi_contents.gni » ('j') | runtime/vm/BUILD.gn » ('J')
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 declare_args() { 7 declare_args() {
6 # Whether to fall back to built-in root certificates when they cannot be 8 # Whether to fall back to built-in root certificates when they cannot be
7 # verified at the operating system level. 9 # verified at the operating system level.
8 dart_use_fallback_root_certificates = false 10 dart_use_fallback_root_certificates = false
9 11
10 # The BUILD.gn file that we pull from chromium as part of zlib has a 12 # The BUILD.gn file that we pull from chromium as part of zlib has a
11 # dependence on //base, which we don't pull in. In a standalone build of the 13 # dependence on //base, which we don't pull in. In a standalone build of the
12 # VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without 14 # VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without
13 # a dependence on //base. 15 # a dependence on //base.
14 dart_zlib_path = "//third_party/zlib" 16 dart_zlib_path = "//third_party/zlib"
15 17
16 # Whether to link the standalone VM against tcmalloc. The standalone build of 18 # Whether to link the standalone VM against tcmalloc. The standalone build of
17 # the VM enables this only for Linux builds. 19 # the VM enables this only for Linux builds.
18 dart_use_tcmalloc = false 20 dart_use_tcmalloc = false
19 } 21 }
20 22
21 resources_sources_gypi =
22 exec_script("../../tools/gypi_to_gn.py",
23 [ rebase_path("vmservice/vmservice_sources.gypi") ],
24 "scope",
25 [ "vmservice/vmservice_sources.gypi" ])
26
27 # Generate a resources.cc file for the service isolate without Observatory. 23 # Generate a resources.cc file for the service isolate without Observatory.
28 action("gen_resources_cc") { 24 action("gen_resources_cc") {
29 visibility = [ ":*" ] # Only targets in this file can see this. 25 visibility = [ ":*" ] # Only targets in this file can see this.
30 script = "../tools/create_resources.py" 26 script = "../tools/create_resources.py"
31 inputs = [ 27 inputs = [
32 "../tools/create_resources.py", 28 "../tools/create_resources.py",
33 ] 29 ]
34 30
35 # The path below is hard coded for the Mojo and Flutter trees. When moving 31 # The path below is hard coded for the Mojo and Flutter trees. When moving
36 # the Dart runtime to gn, this path might need to be updated. 32 # the Dart runtime to gn, this path might need to be updated.
37 sources = rebase_path(resources_sources_gypi.sources, "", "../bin/vmservice/") 33 sources = rebase_path(resources_sources_gypi, "", "../bin/vmservice/")
38 outputs = [ 34 outputs = [
39 "$target_gen_dir/resources_gen.cc", 35 "$target_gen_dir/resources_gen.cc",
40 ] 36 ]
41 args = [ 37 args = [
42 "--output", 38 "--output",
43 rebase_path("$target_gen_dir/resources_gen.cc", root_build_dir), 39 rebase_path("$target_gen_dir/resources_gen.cc", root_build_dir),
44 "--outer_namespace", 40 "--outer_namespace",
45 "dart", 41 "dart",
46 "--inner_namespace", 42 "--inner_namespace",
47 "bin", 43 "bin",
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 "--include", 75 "--include",
80 "bin/builtin.h", 76 "bin/builtin.h",
81 "--var_name", 77 "--var_name",
82 "dart::bin::Builtin::${name}_${kind}_paths_", 78 "dart::bin::Builtin::${name}_${kind}_paths_",
83 "--library_name", 79 "--library_name",
84 library_name, 80 library_name,
85 ] + rebase_path(invoker.sources, root_build_dir) 81 ] + rebase_path(invoker.sources, root_build_dir)
86 } 82 }
87 } 83 }
88 84
89 builtin_sources_gypi = exec_script("../../tools/gypi_to_gn.py",
90 [ rebase_path("builtin_sources.gypi") ],
91 "scope",
92 [ "builtin_sources.gypi" ])
93
94 gen_library_src_path("generate_builtin_cc_file") { 85 gen_library_src_path("generate_builtin_cc_file") {
95 name = "_builtin" 86 name = "_builtin"
96 kind = "source" 87 kind = "source"
97 sources = builtin_sources_gypi.sources 88 sources = builtin_sources_gypi
98 output = "$target_gen_dir/builtin_gen.cc" 89 output = "$target_gen_dir/builtin_gen.cc"
99 } 90 }
100 91
101 sdk_io_sources_gypi = 92 sdk_io_sources_gypi =
102 exec_script("../../tools/gypi_to_gn.py", 93 exec_script("../../tools/gypi_to_gn.py",
103 [ rebase_path("../../sdk/lib/io/io_sources.gypi") ], 94 [ rebase_path("../../sdk/lib/io/io_sources.gypi") ],
104 "scope", 95 "scope",
105 [ "../../sdk/lib/io/io_sources.gypi" ]) 96 [ "../../sdk/lib/io/io_sources.gypi" ])
106 sdk_io_sources = 97 sdk_io_sources =
107 rebase_path(sdk_io_sources_gypi.sources, ".", "../../sdk/lib/io") 98 rebase_path(sdk_io_sources_gypi.sources, ".", "../../sdk/lib/io")
108 99
109 gen_library_src_path("generate_io_cc_file") { 100 gen_library_src_path("generate_io_cc_file") {
110 name = "io" 101 name = "io"
111 kind = "source" 102 kind = "source"
112 sources = [ "../../sdk/lib/io/io.dart" ] + sdk_io_sources 103 sources = [ "../../sdk/lib/io/io.dart" ] + sdk_io_sources
113 output = "$target_gen_dir/io_gen.cc" 104 output = "$target_gen_dir/io_gen.cc"
114 } 105 }
115 106
116 io_sources_gypi = exec_script("../../tools/gypi_to_gn.py",
117 [ rebase_path("io_sources.gypi") ],
118 "scope",
119 [ "io_sources.gypi" ])
120
121 gen_library_src_path("generate_io_patch_cc_file") { 107 gen_library_src_path("generate_io_patch_cc_file") {
122 name = "io" 108 name = "io"
123 kind = "patch" 109 kind = "patch"
124 sources = io_sources_gypi.sources 110 sources = io_sources_gypi
125 output = "$target_gen_dir/io_patch_gen.cc" 111 output = "$target_gen_dir/io_patch_gen.cc"
126 } 112 }
127 113
128 gen_library_src_path("generate_html_cc_file") { 114 gen_library_src_path("generate_html_cc_file") {
129 name = "html" 115 name = "html"
130 kind = "source" 116 kind = "source"
131 sources = [ 117 sources = [
132 "../../sdk/lib/html/dartium/html_dartium.dart", 118 "../../sdk/lib/html/dartium/html_dartium.dart",
133 ] 119 ]
134 output = "$target_gen_dir/html_gen.cc" 120 output = "$target_gen_dir/html_gen.cc"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 libs = [ "dl" ] 232 libs = [ "dl" ]
247 } 233 }
248 if (is_android) { 234 if (is_android) {
249 libs += [ 235 libs += [
250 "android", 236 "android",
251 "log", 237 "log",
252 ] 238 ]
253 } 239 }
254 } 240 }
255 241
256 builtin_impl_sources_gypi =
257 exec_script("../../tools/gypi_to_gn.py",
258 [ rebase_path("builtin_impl_sources.gypi") ],
259 "scope",
260 [ "builtin_impl_sources.gypi" ])
261
262 static_library("libdart_builtin") { 242 static_library("libdart_builtin") {
263 configs += [ 243 configs += [
264 "..:dart_config", 244 "..:dart_config",
265 "..:dart_maybe_product_config", 245 "..:dart_maybe_product_config",
266 ] 246 ]
267 public_configs = [ ":libdart_builtin_config" ] 247 public_configs = [ ":libdart_builtin_config" ]
268 deps = [ 248 deps = [
269 ":generate_blink_cc_file", 249 ":generate_blink_cc_file",
270 ":generate_builtin_cc_file", 250 ":generate_builtin_cc_file",
271 ":generate_cached_patches_cc_file", 251 ":generate_cached_patches_cc_file",
(...skipping 14 matching lines...) Expand all
286 set_sources_assignment_filter([ 266 set_sources_assignment_filter([
287 "*_test.cc", 267 "*_test.cc",
288 "*_test.h", 268 "*_test.h",
289 ]) 269 ])
290 sources = [ 270 sources = [
291 "log_android.cc", 271 "log_android.cc",
292 "log_fuchsia.cc", 272 "log_fuchsia.cc",
293 "log_linux.cc", 273 "log_linux.cc",
294 "log_macos.cc", 274 "log_macos.cc",
295 "log_win.cc", 275 "log_win.cc",
296 ] + builtin_impl_sources_gypi.sources 276 ] + builtin_impl_sources_gypi
297 } 277 }
298 278
299 io_impl_sources_gypi = exec_script("../../tools/gypi_to_gn.py",
300 [ rebase_path("io_impl_sources.gypi") ],
301 "scope",
302 [ "io_impl_sources.gypi" ])
303
304 executable("gen_snapshot") { 279 executable("gen_snapshot") {
305 configs += [ 280 configs += [
306 "..:dart_config", 281 "..:dart_config",
307 "..:dart_maybe_product_config", 282 "..:dart_maybe_product_config",
308 "..:dart_precompiler_config", 283 "..:dart_precompiler_config",
309 ] 284 ]
310 deps = [ 285 deps = [
311 ":gen_resources_cc", 286 ":gen_resources_cc",
312 ":gen_snapshot_dart_io", 287 ":gen_snapshot_dart_io",
313 ":generate_builtin_cc_file", 288 ":generate_builtin_cc_file",
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 # Dart tree uses *_macos.* instead of *_mac.* 354 # Dart tree uses *_macos.* instead of *_mac.*
380 custom_sources_filter += [ 355 custom_sources_filter += [
381 "*_macos.h", 356 "*_macos.h",
382 "*_macos.cc", 357 "*_macos.cc",
383 ] 358 ]
384 } 359 }
385 set_sources_assignment_filter(custom_sources_filter) 360 set_sources_assignment_filter(custom_sources_filter)
386 361
387 defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ] 362 defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
388 363
389 sources = io_impl_sources_gypi.sources + builtin_impl_sources_gypi.sources 364 sources = io_impl_sources_gypi + builtin_impl_sources_gypi
390 sources += [ 365 sources += [
391 "io_natives.cc", 366 "io_natives.cc",
392 "io_natives.h", 367 "io_natives.h",
393 ] 368 ]
394 369
395 include_dirs = [ 370 include_dirs = [
396 "..", 371 "..",
397 "//third_party", 372 "//third_party",
398 ] 373 ]
399 } 374 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 libs += [ "CoreServices.framework" ] 420 libs += [ "CoreServices.framework" ]
446 } 421 }
447 } else if (defined(is_fuchsia) && is_fuchsia) { 422 } else if (defined(is_fuchsia) && is_fuchsia) {
448 defines += [ "DART_IO_SECURE_SOCKET_DISABLED" ] 423 defines += [ "DART_IO_SECURE_SOCKET_DISABLED" ]
449 } else { 424 } else {
450 deps = [ 425 deps = [
451 "//third_party/boringssl", 426 "//third_party/boringssl",
452 ] 427 ]
453 } 428 }
454 429
455 sources = io_impl_sources_gypi.sources + builtin_impl_sources_gypi.sources 430 sources = io_impl_sources_gypi + builtin_impl_sources_gypi
456 sources += [ 431 sources += [
457 "builtin_natives.cc", 432 "builtin_natives.cc",
458 "io_natives.cc", 433 "io_natives.cc",
459 "io_natives.h", 434 "io_natives.h",
460 "log_android.cc", 435 "log_android.cc",
461 "log_linux.cc", 436 "log_linux.cc",
462 "log_macos.cc", 437 "log_macos.cc",
463 "log_win.cc", 438 "log_win.cc",
464 "log.h", 439 "log.h",
465 ] + extra_sources 440 ] + extra_sources
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 "$target_gen_dir", 778 "$target_gen_dir",
804 ] 779 ]
805 defines = [ "TESTING" ] 780 defines = [ "TESTING" ]
806 781
807 if (dart_use_tcmalloc) { 782 if (dart_use_tcmalloc) {
808 deps += [ "//third_party/tcmalloc" ] 783 deps += [ "//third_party/tcmalloc" ]
809 } 784 }
810 785
811 # The VM sources are already included in libdart, so we just want to add in 786 # The VM sources are already included in libdart, so we just want to add in
812 # the tests here. 787 # the tests here.
813 vm_tests_list = exec_script("../../tools/gypi_to_gn.py", 788 vm_tests = rebase_path(vm_tests_list, ".", "../vm")
814 [
815 rebase_path("../vm/vm_sources.gypi"),
816 "--keep_only=_test.cc",
817 "--keep_only=_test.h",
818 ],
819 "scope",
820 [ "../vm/vm_sources.gypi" ])
821 vm_tests = rebase_path(vm_tests_list.sources, ".", "../vm")
822
823 builtin_impl_tests_list =
824 exec_script("../../tools/gypi_to_gn.py",
825 [
826 rebase_path("builtin_impl_sources.gypi"),
827 "--keep_only=_test.cc",
828 "--keep_only=_test.h",
829 ],
830 "scope",
831 [ "builtin_impl_sources.gypi" ])
832 789
833 sources = [ 790 sources = [
834 "builtin_nolib.cc", 791 "builtin_nolib.cc",
835 "run_vm_tests.cc", 792 "run_vm_tests.cc",
836 ] + builtin_impl_tests_list.sources + vm_tests 793 ] + builtin_impl_tests_list + vm_tests
837 794
838 if (!is_win) { 795 if (!is_win) {
839 ldflags = [ "-rdynamic" ] 796 ldflags = [ "-rdynamic" ]
840 } 797 }
841 798
842 if (is_win) { 799 if (is_win) {
843 libs = [ 800 libs = [
844 "iphlpapi.lib", 801 "iphlpapi.lib",
845 "psapi.lib", 802 "psapi.lib",
846 "ws2_32.lib", 803 "ws2_32.lib",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 # The only effect of DART_SHARED_LIB is to export the Dart API. 841 # The only effect of DART_SHARED_LIB is to export the Dart API.
885 "DART_SHARED_LIB", 842 "DART_SHARED_LIB",
886 ] 843 ]
887 if (is_win) { 844 if (is_win) {
888 libs = [ "dart.lib" ] 845 libs = [ "dart.lib" ]
889 abs_root_out_dir = rebase_path(root_out_dir) 846 abs_root_out_dir = rebase_path(root_out_dir)
890 ldflags = [ "/LIBPATH:$abs_root_out_dir" ] 847 ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
891 } 848 }
892 } 849 }
893 } 850 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/gypi_contents.gni » ('j') | runtime/vm/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698