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

Unified Diff: runtime/vm/BUILD.gn

Issue 2434123003: Merge more Kernel infrastructure from kernel_sdk SDK fork. (Closed)
Patch Set: Address comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/BUILD.gn
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index d7edae646170d4cf3176eb580da4ab14c809fbe4..2bfbd1ffed0f2c8b6b573e74395a579834bcf59b 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -60,6 +60,7 @@ vm_sources_list = exec_script("../../tools/gypi_to_gn.py",
static_library("libdart_vm") {
+ deps = [":patched_sdk"]
configs += ["..:dart_config",
"..:dart_maybe_product_config",
"..:dart_maybe_precompiled_runtime_config"]
@@ -100,6 +101,7 @@ static_library("libdart_vm_precompiled_runtime") {
static_library("libdart_vm_nosnapshot") {
+ deps = [":patched_sdk"]
configs += ["..:dart_config",
"..:dart_maybe_product_config",
"..:dart_maybe_precompiled_runtime_config",
@@ -128,6 +130,7 @@ static_library("libdart_vm_nosnapshot_precompiled_runtime") {
static_library("libdart_vm_nosnapshot_with_precompiler") {
+ deps = [":patched_sdk"]
configs += ["..:dart_config",
"..:dart_maybe_product_config",
"..:dart_precompiler_config",
@@ -299,3 +302,114 @@ generate_core_libraries("core_libraries") {
["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"],
]
}
+
+group("patched_sdk") {
+ template("concatenate_patch") {
+ 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 a output in $target_name")
+
+ action(target_name) {
+ visibility = [ ":*" ]
+ output = invoker.output
+ dir = invoker.dir
+ libname = invoker.libname
+ sources_gypi = "../${dir}/${libname}_sources.gypi"
+
+ lib_sources_gypi =
+ exec_script("../../tools/gypi_to_gn.py",
+ [rebase_path(sources_gypi)],
+ "scope",
+ [sources_gypi])
+ lib_sources =
+ rebase_path(lib_sources_gypi.sources, ".", "../${dir}")
+
+ script = "../tools/concatenate_patches.py"
+
+ inputs = [ script, sources_gypi ]
+ inputs += lib_sources
+
+ outputs = [ output ]
+
+ args = [ "--output", rebase_path(output, root_build_dir)]
+ args += rebase_path(lib_sources, root_build_dir)
+ }
+ }
+
+ vm_libraries = [ "async", "collection", "convert", "core", "developer",
+ "internal", "isolate", "math", "mirrors", "profiler",
+ "vmservice" ]
+ concatenation_target_names = []
+ concatenation_files = []
+
+ # Concatenate vm library patches.
+ foreach(name, vm_libraries) {
+ target_name = "concatenate_${name}_patch"
+ target_output = "$target_gen_dir/patches/${name}_patch.dart"
+ concatenate_patch(target_name) {
+ libname = name
+ output = target_output
+ dir = "lib"
+ }
+ concatenation_target_names += [ ":${target_name}" ]
+ concatenation_files += [ target_output ]
+ }
+
+ # Concatenate io library patches.
+ name = "io"
+ target_name = "concatenate_${name}_patch"
+ target_output = "$target_gen_dir/patches/${name}_patch.dart"
+ concatenate_patch(target_name) {
+ libname = name
+ output = target_output
+ dir = "bin"
+ }
+ concatenation_target_names += [ ":concatenate_io_patch" ]
+ concatenation_files += [ target_output ]
+
+ # Build the patched sdk out of the concatenated patches and the special
+ # "runtime/bin/{builtin,nativewrappers}.dart" libraries".
+ action("generate_patched_sdk") {
+ deps = concatenation_target_names
+
+ patches_dir = "$target_gen_dir/patches"
+ patched_sdk_dir = "$target_gen_dir/patched_sdk"
+
+ script = "../../tools/patch_sdk.py"
+
+ # We list all files which make up the sdk (modulo patches) and get them back
+ # as a GN list object.
+ shared_sdk_sources = exec_script(
+ "../../tools/list_files.py", ["dart\$", "../../sdk/lib"], "list lines")
+
+ # We list the `patch_sdk.dart` tool here because the [script] (which is
+ # implicitly an input) will call it.
+ inputs = [ "../../tools/patch_sdk.dart" ]
+ # These three are not patches, they will not be in [concatenation_files] but
+ # the `patch_sdk.dart` script will copy them into the patched sdk.
+ inputs += [
+ "../lib/typed_data.dart",
+ "../bin/builtin.dart",
+ "../bin/nativewrappers.dart",
+ "../bin/vmservice/vmservice_io.dart",
+ "../bin/vmservice/loader.dart",
+ "../bin/vmservice/server.dart",
+ ]
+ # Add all the normal sdk sources.
+ inputs += shared_sdk_sources
+ # Add all the concatenated patch files.
+ inputs += concatenation_files
+
+ outputs = [
+ # Instead of listing all outputs we list a single well-known one.
+ "${patched_sdk_dir}/lib/core/core.dart",
+ ]
+
+ args = [
+ "vm",
+ rebase_path("../../sdk"),
+ rebase_path(patches_dir, root_build_dir),
+ rebase_path(patched_sdk_dir, root_build_dir),
+ ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698