Index: runtime/vm/BUILD.gn |
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn |
index 684b4480ceb7aa8a159b2df548cf54fbd9559fcb..285b0d52334eb964eeaa4b0836fdc82ec2c7efea 100644 |
--- a/runtime/vm/BUILD.gn |
+++ b/runtime/vm/BUILD.gn |
@@ -4,7 +4,6 @@ |
import("../../build/executable_suffix.gni") |
import("../../build/prebuilt_dart_sdk.gni") |
-import("gypi_contents.gni") |
config("libdart_vm_config") { |
if (defined(is_fuchsia) && is_fuchsia) { |
@@ -33,12 +32,30 @@ static_library("libdart_platform") { |
] |
public_configs = [ ":libdart_vm_config" ] |
- sources = rebase_path(processed_gypis.platform_sources, ".", "../platform") |
- |
+ platform_headers_gypi = |
+ exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("../platform/platform_headers.gypi") ], |
+ "scope", |
+ [ "../platform/platform_headers.gypi" ]) |
+ platform_headers = |
+ rebase_path(platform_headers_gypi.sources, ".", "../platform") |
+ |
+ platform_sources_gypi = |
+ exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("../platform/platform_sources.gypi") ], |
+ "scope", |
+ [ "../platform/platform_sources.gypi" ]) |
+ platform_sources = |
+ rebase_path(platform_sources_gypi.sources, ".", "../platform") |
+ |
+ sources = platform_headers + platform_sources |
include_dirs = [ ".." ] |
} |
-vm_sources_list = processed_gypis.vm_sources |
+vm_sources_list = exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("vm_sources.gypi") ], |
+ "scope", |
+ [ "vm_sources.gypi" ]) |
static_library("libdart_vm") { |
configs += [ |
@@ -51,7 +68,7 @@ static_library("libdart_vm") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
@@ -67,7 +84,7 @@ static_library("libdart_vm_noopt") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
@@ -82,7 +99,7 @@ static_library("libdart_vm_precompiled_runtime") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
@@ -98,7 +115,7 @@ static_library("libdart_vm_nosnapshot") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
@@ -114,7 +131,7 @@ static_library("libdart_vm_nosnapshot_precompiled_runtime") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
@@ -130,41 +147,53 @@ static_library("libdart_vm_nosnapshot_with_precompiler") { |
"*_test.cc", |
"*_test.h", |
]) |
- sources = vm_sources_list |
+ sources = vm_sources_list.sources |
include_dirs = [ ".." ] |
} |
template("process_library_source") { |
- assert(defined(invoker.libsources), "Need libsources in $target_name") |
+ assert(defined(invoker.filename), "Need filename in $target_name") |
assert(defined(invoker.output), "Need output in $target_name") |
+ assert(defined(invoker.path), "Need path in $target_name") |
action(target_name) { |
visibility = [ ":*" ] # Only targets in this file can see this. |
- libsources = invoker.libsources |
+ filename = invoker.filename |
+ path = invoker.path |
+ |
+ lib_sources_gypi = |
+ exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("${path}/${filename}_sources.gypi") ], |
+ "scope", |
+ [ "${path}/${filename}_sources.gypi" ]) |
+ lib_sources = rebase_path(lib_sources_gypi.sources, ".", path) |
script = invoker.script |
- inputs = invoker.inputs + libsources |
+ inputs = invoker.inputs + [ script ] |
+ inputs += lib_sources |
outputs = [ |
invoker.output, |
] |
- args = invoker.args + rebase_path(libsources, root_build_dir) |
+ args = invoker.args + rebase_path(lib_sources, root_build_dir) |
} |
} |
template("generate_library_source") { |
assert(defined(invoker.libname), "Need libname in $target_name") |
- assert(defined(invoker.libsources), "Need libsources in $target_name") |
+ assert(defined(invoker.filename), "Need a filename in $target_name") |
assert(defined(invoker.kind), "Need kind in $target_name") |
assert(defined(invoker.output), "Need output in $target_name") |
+ assert(defined(invoker.path), "Need path in $target_name") |
process_library_source(target_name) { |
libname = invoker.libname |
- libsources = invoker.libsources |
+ filename = invoker.filename |
kind = invoker.kind |
+ output = invoker.output |
+ path = invoker.path |
script = "../tools/gen_library_src_paths.py" |
inputs = [ |
"../lib/libgen_in.cc", |
] |
- output = invoker.output |
args = [ |
"--output", |
rebase_path(invoker.output, root_build_dir), |
@@ -180,45 +209,51 @@ template("generate_library_source") { |
} |
} |
-# This templates expects invoker.sources to be a list of lists. |
-# The lists contain the following information about each library: |
-# library name (string) |
-# library sources (list of strings) |
-# library source base path (string) |
-# filename (string) |
-# do_patch (boolean) |
-# |
-# If do_patch is true, the lists additionally contains |
-# patch sources (list of strings) |
-# patch source base path (string) |
+# This templates expects invoker.sources to be a list of pairs of strings. |
+# The pairs of strings mean the following. |
+# library name, file name |
+# e.g. for the "internal" library named "dart:_internal", |
+# with sources listed at sdk/lib/internal/internal_sources.gypi and |
+# lib/internal_sources.gypi, we have: ["_internal", "internal"] |
# |
# The template iterates over the list, and generates generate_library_source |
# actions for each. After that, it generates targets to compile the generated |
-# sources to make libdart_lib_*. |
+# sources to make libdart_lib_nosnapshot and libdart_lib. |
template("generate_core_libraries") { |
assert(defined(invoker.sources), "Need sources in $target_name") |
- assert(defined(invoker.allsources), "Need allsources in $target_name") |
liboutputs = [] |
+ libsources = [] |
libdeps = [] |
foreach(lib, invoker.sources) { |
libname = lib[0] |
- filename = lib[3] |
- do_patch = lib[4] |
+ filename = lib[1] |
+ do_patch = lib[2] |
+ source_path = lib[3] |
generate_library_source("generate_${filename}_cc_file") { |
libname = libname |
- libsources = rebase_path(lib[1], ".", lib[2]) |
+ filename = filename |
kind = "source" |
+ path = source_path |
output = "$target_gen_dir/${filename}_gen.cc" |
} |
if (do_patch) { |
+ patch_path = lib[4] |
generate_library_source("generate_${filename}_patch_cc_file") { |
libname = libname |
- libsources = rebase_path(lib[5], ".", lib[6]) |
+ filename = filename |
kind = "patch" |
+ path = patch_path |
output = "$target_gen_dir/${filename}_patch_gen.cc" |
} |
} |
- |
+ lib_sources_gypi = { |
+ } |
+ lib_sources_gypi = |
+ exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("../lib/${filename}_sources.gypi") ], |
+ "scope", |
+ [ "../lib/${filename}_sources.gypi" ]) |
+ libsources += rebase_path(lib_sources_gypi.sources, ".", "../lib") |
liboutputs += [ "$target_gen_dir/${filename}_gen.cc" ] |
libdeps += [ ":generate_${filename}_cc_file" ] |
if (do_patch) { |
@@ -227,8 +262,6 @@ template("generate_core_libraries") { |
} |
} |
- all_libsources = rebase_path(invoker.allsources, ".", "../lib") |
- |
static_library("libdart_lib_nosnapshot") { |
configs += [ |
"..:dart_config", |
@@ -236,7 +269,7 @@ template("generate_core_libraries") { |
"..:dart_maybe_precompiled_runtime_config", |
] |
deps = libdeps |
- sources = all_libsources + [ "bootstrap.cc" ] + liboutputs |
+ sources = libsources + [ "bootstrap.cc" ] + liboutputs |
include_dirs = [ ".." ] |
} |
static_library("libdart_lib_nosnapshot_precompiled_runtime") { |
@@ -246,7 +279,7 @@ template("generate_core_libraries") { |
"..:dart_precompiled_runtime_config", |
] |
deps = libdeps |
- sources = all_libsources + [ "bootstrap.cc" ] + liboutputs |
+ sources = libsources + [ "bootstrap.cc" ] + liboutputs |
include_dirs = [ ".." ] |
} |
static_library("libdart_lib_nosnapshot_with_precompiler") { |
@@ -256,7 +289,7 @@ template("generate_core_libraries") { |
"..:dart_precompiler_config", |
] |
deps = libdeps |
- sources = all_libsources + [ "bootstrap.cc" ] + liboutputs |
+ sources = libsources + [ "bootstrap.cc" ] + liboutputs |
include_dirs = [ ".." ] |
} |
static_library("libdart_lib") { |
@@ -265,7 +298,7 @@ template("generate_core_libraries") { |
"..:dart_maybe_product_config", |
"..:dart_maybe_precompiled_runtime_config", |
] |
- sources = all_libsources + [ "bootstrap_nocore.cc" ] |
+ sources = libsources + [ "bootstrap_nocore.cc" ] |
include_dirs = [ ".." ] |
} |
static_library("libdart_lib_precompiled_runtime") { |
@@ -274,7 +307,7 @@ template("generate_core_libraries") { |
"..:dart_maybe_product_config", |
"..:dart_precompiled_runtime_config", |
] |
- sources = all_libsources + [ "bootstrap_nocore.cc" ] |
+ sources = libsources + [ "bootstrap_nocore.cc" ] |
include_dirs = [ ".." ] |
} |
} |
@@ -283,125 +316,104 @@ generate_core_libraries("core_libraries") { |
sources = [ |
[ |
"async", |
- processed_gypis.async_sdk_sources, |
- "../../sdk/lib/async", |
"async", |
true, |
- processed_gypis.async_runtime_sources, |
+ "../../sdk/lib/async", |
"../lib", |
], |
[ |
"core", |
- processed_gypis.core_sdk_sources, |
- "../../sdk/lib/core", |
"core", |
true, |
- processed_gypis.core_runtime_sources, |
+ "../../sdk/lib/core", |
"../lib", |
], |
[ |
"collection", |
- processed_gypis.collection_sdk_sources, |
- "../../sdk/lib/collection", |
"collection", |
true, |
- processed_gypis.collection_runtime_sources, |
+ "../../sdk/lib/collection", |
"../lib", |
], |
[ |
"convert", |
- processed_gypis.convert_sdk_sources, |
- "../../sdk/lib/convert", |
"convert", |
true, |
- processed_gypis.convert_runtime_sources, |
+ "../../sdk/lib/convert", |
"../lib", |
], |
[ |
"developer", |
- processed_gypis.developer_sdk_sources, |
- "../../sdk/lib/developer", |
"developer", |
true, |
- processed_gypis.developer_runtime_sources, |
+ "../../sdk/lib/developer", |
"../lib", |
], |
[ |
"_internal", |
- processed_gypis.internal_sdk_sources, |
- "../../sdk/lib/internal", |
"internal", |
true, |
- processed_gypis.internal_runtime_sources, |
+ "../../sdk/lib/internal", |
"../lib", |
], |
[ |
"isolate", |
- processed_gypis.isolate_sdk_sources, |
- "../../sdk/lib/isolate", |
"isolate", |
true, |
- processed_gypis.isolate_runtime_sources, |
+ "../../sdk/lib/isolate", |
"../lib", |
], |
[ |
"math", |
- processed_gypis.math_sdk_sources, |
- "../../sdk/lib/math", |
"math", |
true, |
- processed_gypis.math_runtime_sources, |
+ "../../sdk/lib/math", |
"../lib", |
], |
[ |
"mirrors", |
- processed_gypis.mirrors_sdk_sources, |
- "../../sdk/lib/mirrors", |
"mirrors", |
true, |
- processed_gypis.mirrors_runtime_sources, |
+ "../../sdk/lib/mirrors", |
"../lib", |
], |
[ |
"profiler", |
- processed_gypis.profiler_sdk_sources, |
- "../../sdk/lib/profiler", |
"profiler", |
false, |
+ "../../sdk/lib/profiler", |
], |
[ |
"typed_data", |
- processed_gypis.typed_data_runtime_sources, |
- "../lib", |
"typed_data", |
false, |
+ "../lib", |
], |
[ |
"_vmservice", |
- processed_gypis.vmservice_sdk_sources, |
- "../../sdk/lib/vmservice", |
"vmservice", |
true, |
- processed_gypis.vmservice_runtime_sources, |
+ "../../sdk/lib/vmservice", |
"../lib", |
], |
] |
- allsources = processed_gypis.allsources |
} |
template("concatenate_patch") { |
- assert(defined(invoker.libsources), "Need a sources in $target_name") |
+ assert(defined(invoker.libname), "Need a name in $target_name") |
+ assert(defined(invoker.dir), "Need a dir in $target_name") |
assert(defined(invoker.output), "Need an output in $target_name") |
process_library_source(target_name) { |
- libsources = invoker.libsources |
- inputs = [] |
output = invoker.output |
+ path = "../${invoker.dir}" |
+ filename = invoker.libname |
script = "../tools/concatenate_patches.py" |
args = [ |
"--output", |
rebase_path(output, root_build_dir), |
] |
+ inputs = [] |
} |
} |
@@ -414,11 +426,12 @@ if (!defined(is_fuchsia) || !is_fuchsia) { |
# Concatenate vm library patches. |
foreach(library, invoker.libraries) { |
- name = library[0] |
+ name = library[1] |
target_output = "$target_gen_dir/patches/${name}_patch.dart" |
concatenate_patch("concatenate_${name}_patch") { |
- libsources = library[1] |
+ libname = name |
+ dir = library[0] |
output = target_output |
} |
concatenation_target_names += [ ":concatenate_${name}_patch" ] |
@@ -494,52 +507,52 @@ if (!defined(is_fuchsia) || !is_fuchsia) { |
generate_patched_sdk("patched_sdk") { |
libraries = [ |
[ |
+ "lib", |
"async", |
- processed_gypis.async_runtime_sources, |
], |
[ |
+ "lib", |
"collection", |
- processed_gypis.collection_runtime_sources, |
], |
[ |
+ "lib", |
"convert", |
- processed_gypis.convert_runtime_sources, |
], |
[ |
+ "lib", |
"core", |
- processed_gypis.core_runtime_sources, |
], |
[ |
+ "lib", |
"developer", |
- processed_gypis.developer_runtime_sources, |
], |
[ |
+ "lib", |
"internal", |
- processed_gypis.internal_runtime_sources, |
], |
[ |
+ "lib", |
"isolate", |
- processed_gypis.isolate_runtime_sources, |
], |
[ |
+ "lib", |
"math", |
- processed_gypis.math_runtime_sources, |
], |
[ |
+ "lib", |
"mirrors", |
- processed_gypis.mirrors_runtime_sources, |
], |
[ |
+ "lib", |
"profiler", |
- processed_gypis.profiler_runtime_sources, |
], |
[ |
+ "lib", |
"vmservice", |
- processed_gypis.vmservice_runtime_sources, |
], |
[ |
+ "bin", |
"io", |
- processed_gypis.bin_io_sources, |
], |
] |
} |