Skip to content

Commit

Permalink
Reland "[build] Speed up debug and simulator builds by running steps …
Browse files Browse the repository at this point in the history
…on the prebuilt VM."

This reverts commit d948962.

Reason for revert: flutter/engine@04f567b

Original change's description:
> Revert "[build] Speed up debug and simulator builds by running steps on the prebuilt VM."
> 
> This reverts commit 74cff6c as it
> introduces a breakage of flutter build process.
> 
> Revert "[build] Fix application_snapshot.gni for uses outside of utils/xyz."
> 
> This reverts commit 351acd1 as a
> collateral damage.
> 
> Change-Id: Ic175c464c78e76a0adf176b41294344901bfe798
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117063
> Commit-Queue: Alexander Aprelev <aam@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=aam@google.com,rmacnak@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ie27eb455eddd3e60b96eb65bb3dad888b369baf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117286
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
  • Loading branch information
rmacnak-google authored and commit-bot@chromium.org committed Sep 16, 2019
1 parent 07cd62a commit 46f2603
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 41 deletions.
76 changes: 63 additions & 13 deletions utils/application_snapshot.gni
Expand Up @@ -74,11 +74,65 @@ template("_application_snapshot") {
if (defined(invoker.output)) {
output = invoker.output
}

# Build the kernel file using the prebuilt VM to speed up the debug and
# simulator builds.
prebuilt_dart_action(target_name + "_dill") {
deps =
extra_deps + [
"$_dart_root/runtime/vm:kernel_platform_files($dart_host_toolchain)",
"$_dart_root/runtime/vm:vm_platform",
]
gen_kernel_script = "$_dart_root/pkg/vm/bin/gen_kernel.dart"
platform_dill = "$root_out_dir/vm_platform_strong.dill"

inputs = extra_inputs + [
gen_kernel_script,
platform_dill,
main_dart,
dot_packages,
]
output = "$target_gen_dir/$name.dart.dill"
outputs = [
output,
]

depfile = "$output.d"
abs_depfile = rebase_path(depfile)
rebased_output = rebase_path(output, root_build_dir)
vm_args = [
"--depfile=$abs_depfile",
"--depfile_output_filename=$rebased_output",
]

script = gen_kernel_script

args = [
"--packages=" + rebase_path(dot_packages),
"--platform=" + rebase_path(platform_dill),
"--no-aot",
"--no-embed-sources",
"--no-link-platform",
"--output=" + rebase_path(output),
]
# TODO(bytecode): Remove special case for the kernel service once
# interpreter-compiled transitions no longer cause stack overflows in
# the language_2/deep_nesting* tests.
if (dart_platform_bytecode && (name != "kernel-service_snapshot")) {
args += [
"--gen-bytecode",
"--drop-ast",
"--bytecode-options=source-positions",
]
}
args += [ rebase_path(main_dart) ]
}

dart_action(target_name) {
deps = extra_deps
deps = extra_deps + [ ":${target_name}_dill" ]
depfile = "$output.d"

script = main_dart
script = "$target_gen_dir/$name.dart.dill"

inputs = extra_inputs

Expand All @@ -90,16 +144,14 @@ template("_application_snapshot") {
abs_output = rebase_path(output, root_build_dir)

vm_args = [
"--deterministic",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + snapshot_vm_args
"--deterministic",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + snapshot_vm_args

if (dart_snapshot_kind == "kernel") {
vm_args += [
"--snapshot-kind=kernel",
]
vm_args += [ "--snapshot-kind=kernel" ]
assert(training_args != "", "Ignoring unused argument")
args = []
} else if (dart_snapshot_kind == "app-jit") {
Expand Down Expand Up @@ -141,9 +193,7 @@ template("application_snapshot") {
if (!defined(invoker.deps)) {
deps = []
}
deps += [
"$_dart_root/utils/kernel-service:kernel-service"
]
deps += [ "$_dart_root/utils/kernel-service:kernel-service" ]
}
}

Expand Down
9 changes: 2 additions & 7 deletions utils/compiler/BUILD.gn
Expand Up @@ -3,8 +3,8 @@
# BSD-style license that can be found in the LICENSE file.

import("../../utils/compile_platform.gni")
import("../create_timestamp.gni")
import("../application_snapshot.gni")
import("../create_timestamp.gni")

create_timestamp_file("dart2js_files_stamp") {
path = rebase_path("../../pkg/compiler/lib")
Expand All @@ -21,18 +21,13 @@ create_timestamp_file("dartdoc_files_stamp") {
output = "$target_gen_dir/dartdoc_files.stamp"
}

dart_action("dart2js_create_snapshot_entry") {
prebuilt_dart_action("dart2js_create_snapshot_entry") {
deps = [
":dart2js_files_stamp",
":dartdoc_files_stamp",
":runtime_lib_files_stamp",
]

# dart_action() needs kernel service snapshot to run in Dart 2 mode.
# This can't be added as a dependency to dart_action() itself as it will
# create a circular dependency.
deps += [ "../../utils/kernel-service:kernel-service" ]

output_dir = rebase_path(target_gen_dir)

script = "create_snapshot_entry.dart"
Expand Down
26 changes: 12 additions & 14 deletions utils/dartdevc/BUILD.gn
Expand Up @@ -30,7 +30,9 @@ application_snapshot("dartdevc") {
":dartdevc_kernel_sdk_outline",
]

inputs = [ sdk_dill ]
inputs = [
sdk_dill,
]
}

sdk_lib_files = exec_script("../../tools/list_dart_files.py",
Expand Down Expand Up @@ -62,16 +64,11 @@ template("dart2js_compile") {
abs_main = rebase_path(main)
abs_output = rebase_path(out)

dart_action(target_name) {
prebuilt_dart_action(target_name) {
deps = [
"../compiler:compile_dart2js_platform",
]

# dart_action() needs kernel service snapshot to run in Dart 2 mode.
# This can't be added as a dependency to dart_action() itself as it will
# create a circular dependency.
deps += [ "../../utils/kernel-service:kernel-service" ]

inputs = sdk_lib_files + compiler_files + dev_compiler_files + [
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_outline.dill",
Expand All @@ -89,6 +86,7 @@ template("dart2js_compile") {
"-m",
"-o$abs_output",
"--no-source-maps",
"--platform-binaries=" + rebase_path("$root_out_dir"),
]
}
}
Expand Down Expand Up @@ -211,8 +209,8 @@ prebuilt_dart_action("dartdevc_sdk") {
group("dartdevc_test") {
deps = [
":dartdevc",
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_sdk",
":dartdevc_test_pkg",
"../../sdk:create_sdk",
]
Expand All @@ -223,8 +221,8 @@ group("dartdevc_test") {
# building the Dart VM and create_sdk.
group("dartdevc_test_local") {
deps = [
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_sdk",
":dartdevc_test_pkg",
]
}
Expand All @@ -244,10 +242,10 @@ create_timestamp_file("dartdevc_sdk_patch_stamp") {
prebuilt_dart_action("dartdevc_test_pkg") {
deps = [
":dartdevc_files_stamp",
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_kernel_sdk_outline",
":dartdevc_kernel_sdk_libraries_json",
":dartdevc_kernel_sdk_outline",
":dartdevc_sdk",
"../../pkg:pkg_files_stamp",
]

Expand Down Expand Up @@ -319,9 +317,9 @@ prebuilt_dart_action("dartdevc_test_pkg") {

prebuilt_dart_action("dartdevc_kernel_sdk_outline") {
deps = [
"../../pkg:pkg_files_stamp",
":dartdevc_files_stamp",
":dartdevc_sdk_patch_stamp",
"../../pkg:pkg_files_stamp",
]

inputs = [
Expand Down Expand Up @@ -349,7 +347,7 @@ prebuilt_dart_action("dartdevc_kernel_sdk_outline") {
"--output",
rebase_path(sdk_dill),
"--source",
"dart:core"
"dart:core",
]
}

Expand All @@ -365,9 +363,9 @@ copy("dartdevc_kernel_sdk_libraries_json") {
# Compiles the DDC SDK's kernel summary and JS code.
prebuilt_dart_action("dartdevc_kernel_sdk") {
deps = [
"../../pkg:pkg_files_stamp",
":dartdevc_files_stamp",
":dartdevc_sdk_patch_stamp",
"../../pkg:pkg_files_stamp",
]

inputs = [
Expand Down
8 changes: 1 addition & 7 deletions utils/kernel-service/BUILD.gn
Expand Up @@ -10,7 +10,6 @@ import("../application_snapshot.gni")
group("kernel-service") {
if (create_kernel_service_snapshot) {
deps = [
# TODO(rmacnak): Link this into 'dart'.
":copy_kernel-service_snapshot",
]
} else {
Expand All @@ -20,13 +19,8 @@ group("kernel-service") {
}
}

# TODO: Switch this to use kernel based app-jit snapshot
# when we are ready to switch to the kernel based core snapshots.
kernel_application_snapshot("kernel-service_snapshot") {
main_dart = "$root_gen_dir/kernel_service.dill"
deps = [
":kernel_service_dill",
]
main_dart = "../../pkg/vm/bin/kernel_service.dart"
training_args = [
"--train",
# Force triple-slashes both on Windows and otherwise.
Expand Down

0 comments on commit 46f2603

Please sign in to comment.