2016-09-29 20:23:00 +00:00
|
|
|
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
import("../../build/dart/dart_action.gni")
|
2016-11-10 19:16:24 +00:00
|
|
|
import("../application_snapshot.gni")
|
2017-06-29 20:45:55 +00:00
|
|
|
import("../create_timestamp.gni")
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2017-11-20 23:24:07 +00:00
|
|
|
patched_sdk_dir = "$target_gen_dir/patched_sdk"
|
|
|
|
sdk_summary = "$target_gen_dir/ddc_sdk.sum"
|
2018-01-10 17:56:14 +00:00
|
|
|
sdk_dill = "$target_gen_dir/kernel/ddc_sdk.dill"
|
2018-12-04 18:39:46 +00:00
|
|
|
sdk_libraries_json = "$target_gen_dir/libraries.json"
|
2017-11-20 23:24:07 +00:00
|
|
|
|
2016-09-29 20:23:00 +00:00
|
|
|
application_snapshot("dartdevc") {
|
|
|
|
main_dart = "../../pkg/dev_compiler/bin/dartdevc.dart"
|
2017-11-20 23:24:07 +00:00
|
|
|
|
2016-10-26 17:48:14 +00:00
|
|
|
training_args = [
|
|
|
|
"--dart-sdk",
|
|
|
|
rebase_path("../../sdk"),
|
2016-11-03 21:51:00 +00:00
|
|
|
"--dart-sdk-summary",
|
2019-05-29 16:17:10 +00:00
|
|
|
rebase_path(sdk_dill),
|
2019-02-22 01:02:05 +00:00
|
|
|
"-k",
|
2017-04-21 23:19:55 +00:00
|
|
|
"-o",
|
|
|
|
"dartdevc.js",
|
|
|
|
rebase_path("../../pkg/dev_compiler/bin/dartdevc.dart"),
|
2016-10-26 17:48:14 +00:00
|
|
|
]
|
2017-11-20 23:24:07 +00:00
|
|
|
|
|
|
|
deps = [
|
2019-07-11 02:05:37 +00:00
|
|
|
":dartdevc_kernel_sdk",
|
|
|
|
":dartdevc_kernel_sdk_outline",
|
2017-11-20 23:24:07 +00:00
|
|
|
]
|
|
|
|
|
2019-07-11 02:05:37 +00:00
|
|
|
inputs = [ sdk_dill ]
|
2016-09-29 20:23:00 +00:00
|
|
|
}
|
2017-05-19 20:21:49 +00:00
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
sdk_lib_files = exec_script("../../tools/list_dart_files.py",
|
|
|
|
[
|
|
|
|
"absolute",
|
|
|
|
rebase_path("../../sdk/lib"),
|
|
|
|
],
|
|
|
|
"list lines")
|
2017-05-19 20:21:49 +00:00
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
compiler_files = exec_script("../../tools/list_dart_files.py",
|
|
|
|
[
|
|
|
|
"absolute",
|
|
|
|
rebase_path("../../pkg/compiler"),
|
|
|
|
],
|
|
|
|
"list lines")
|
2017-05-19 20:21:49 +00:00
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
dev_compiler_files = exec_script("../../tools/list_dart_files.py",
|
|
|
|
[
|
|
|
|
"absolute",
|
|
|
|
rebase_path("../../pkg/dev_compiler"),
|
|
|
|
],
|
|
|
|
"list lines")
|
2017-05-19 20:21:49 +00:00
|
|
|
|
|
|
|
template("dart2js_compile") {
|
|
|
|
assert(defined(invoker.main), "Must specify the main file")
|
|
|
|
main = invoker.main
|
|
|
|
assert(defined(invoker.out), "Must specify the out file")
|
|
|
|
out = invoker.out
|
|
|
|
abs_main = rebase_path(main)
|
|
|
|
abs_output = rebase_path(out)
|
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
dart_action(target_name) {
|
2018-03-15 12:10:23 +00:00
|
|
|
deps = [
|
|
|
|
"../compiler:compile_dart2js_platform",
|
|
|
|
]
|
2018-06-21 22:09:13 +00:00
|
|
|
|
|
|
|
# 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.
|
2018-08-21 20:28:06 +00:00
|
|
|
deps += [ "../../utils/kernel-service:kernel-service" ]
|
2018-06-21 22:09:13 +00:00
|
|
|
|
2018-03-15 12:10:23 +00:00
|
|
|
inputs = sdk_lib_files + compiler_files + dev_compiler_files + [
|
|
|
|
"$root_out_dir/dart2js_platform.dill",
|
|
|
|
"$root_out_dir/dart2js_outline.dill",
|
|
|
|
]
|
2017-05-19 20:21:49 +00:00
|
|
|
outputs = [
|
|
|
|
out,
|
|
|
|
]
|
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
script = "../../pkg/compiler/lib/src/dart2js.dart"
|
|
|
|
|
|
|
|
packages = "../../.packages"
|
2017-05-19 20:21:49 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"$abs_main",
|
|
|
|
"-m",
|
|
|
|
"-o$abs_output",
|
2019-06-21 14:20:46 +00:00
|
|
|
"--no-source-maps",
|
2017-05-19 20:21:49 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dart2js_compile("dartdevc_web") {
|
|
|
|
main = rebase_path("../../pkg/dev_compiler/web/main.dart")
|
|
|
|
out = "$root_out_dir/dev_compiler/build/web/ddc_web_compiler.js"
|
|
|
|
}
|
|
|
|
|
|
|
|
dart2js_compile("stack_trace_mapper") {
|
|
|
|
main = rebase_path("../../pkg/dev_compiler/web/stack_trace_mapper.dart")
|
|
|
|
out = "$root_out_dir/dev_compiler/build/web/dart_stack_trace_mapper.js"
|
|
|
|
}
|
2017-06-29 20:45:55 +00:00
|
|
|
|
2017-11-20 23:24:07 +00:00
|
|
|
# Apply dev_compiler's patch files to create the Dart version of the dartdevc
|
|
|
|
# SDK.
|
2018-06-18 20:31:44 +00:00
|
|
|
prebuilt_dart_action("dartdevc_patch_sdk") {
|
2017-11-20 23:24:07 +00:00
|
|
|
# TODO(rnystrom): Unfork DDC's patch_sdk.dart script with the
|
|
|
|
# tools/patch_sdk.dart and then change this to use generate_patch_sdk().
|
|
|
|
deps = [
|
|
|
|
":dartdevc_files_stamp",
|
2018-06-08 19:18:34 +00:00
|
|
|
":dartdevc_sdk_patch_stamp",
|
2017-11-20 23:24:07 +00:00
|
|
|
|
|
|
|
# The patch script uses several packages, including analyzer, so consider
|
|
|
|
# it dirty if any of those change.
|
|
|
|
"../../pkg:pkg_files_stamp",
|
|
|
|
]
|
|
|
|
|
2018-02-06 21:51:13 +00:00
|
|
|
script = "../../pkg/dev_compiler/tool/patch_sdk.dart"
|
2017-11-20 23:24:07 +00:00
|
|
|
|
|
|
|
# The main SDK library sources.
|
2018-02-06 21:51:13 +00:00
|
|
|
inputs = sdk_lib_files
|
2017-11-20 23:24:07 +00:00
|
|
|
|
|
|
|
# dev_compiler's additional sources and patch files.
|
|
|
|
inputs += exec_script("../../tools/list_dart_files.py",
|
|
|
|
[
|
|
|
|
"absolute",
|
2019-06-04 13:47:29 +00:00
|
|
|
rebase_path("../../sdk/lib/_internal/js_dev_runtime"),
|
2017-11-20 23:24:07 +00:00
|
|
|
],
|
|
|
|
"list lines")
|
|
|
|
|
|
|
|
# Arbitrarily use the version file as a token file to check against to see if
|
|
|
|
# the sources have changed.
|
|
|
|
# TODO(rnystrom): List the outputs more precisely?
|
|
|
|
outputs = [
|
|
|
|
"$patched_sdk_dir/version",
|
|
|
|
]
|
|
|
|
|
2018-02-06 21:51:13 +00:00
|
|
|
args = [
|
2017-11-20 23:24:07 +00:00
|
|
|
rebase_path("../../"),
|
2019-06-04 13:47:29 +00:00
|
|
|
rebase_path("../../sdk/lib/_internal/js_dev_runtime"),
|
2017-11-20 23:24:07 +00:00
|
|
|
rebase_path(patched_sdk_dir),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Compiles the Dart core libraries and DDC runtime to an analyzer summary and
|
|
|
|
# JS.
|
2018-06-18 20:31:44 +00:00
|
|
|
prebuilt_dart_action("dartdevc_sdk") {
|
2017-11-20 23:24:07 +00:00
|
|
|
deps = [
|
|
|
|
":dartdevc_files_stamp",
|
|
|
|
":dartdevc_patch_sdk",
|
|
|
|
"../../pkg:pkg_files_stamp",
|
|
|
|
]
|
|
|
|
|
2018-02-06 21:51:13 +00:00
|
|
|
script = "../../pkg/dev_compiler/tool/build_sdk.dart"
|
2017-11-20 23:24:07 +00:00
|
|
|
|
|
|
|
inputs = [
|
|
|
|
"../../pkg/dev_compiler/tool/build_sdk.dart",
|
|
|
|
|
|
|
|
# Since the entire patched SDK is built in one step, if any file changes,
|
|
|
|
# they all will. Instead of listing them all as outputs of
|
|
|
|
# dartdevc_patch_sdk (which would require something like a depfile), just
|
|
|
|
# use version as the token file whose timestamp we track.
|
|
|
|
# TODO(rnystrom): Do something better?
|
|
|
|
"$patched_sdk_dir/version",
|
|
|
|
|
|
|
|
# If dev_compiler itself changes, it can affect the generated SDK.
|
|
|
|
"$target_gen_dir/dartdevc_files.stamp",
|
|
|
|
|
|
|
|
# Likewise, the packages dev_compiler depends on may affect its output.
|
|
|
|
"$root_gen_dir/pkg_files.stamp",
|
|
|
|
]
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
sdk_summary,
|
|
|
|
"$target_gen_dir/js/amd/dart_sdk.js",
|
|
|
|
"$target_gen_dir/js/amd/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/js/common/dart_sdk.js",
|
|
|
|
"$target_gen_dir/js/common/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/js/es6/dart_sdk.js",
|
|
|
|
"$target_gen_dir/js/es6/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/js/legacy/dart_sdk.js",
|
|
|
|
"$target_gen_dir/js/legacy/dart_sdk.js.map",
|
|
|
|
]
|
2018-02-06 21:51:13 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"--dart-sdk",
|
|
|
|
rebase_path(patched_sdk_dir),
|
|
|
|
"--dart-sdk-summary=build",
|
|
|
|
"--summary-out",
|
|
|
|
rebase_path(sdk_summary),
|
|
|
|
"--source-map",
|
|
|
|
"--source-map-comment",
|
|
|
|
"--modules=amd",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/js/amd/dart_sdk.js"),
|
|
|
|
"--modules=es6",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/js/es6/dart_sdk.js"),
|
|
|
|
"--modules=common",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/js/common/dart_sdk.js"),
|
|
|
|
"--modules=legacy",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/js/legacy/dart_sdk.js"),
|
|
|
|
]
|
2017-11-20 23:24:07 +00:00
|
|
|
}
|
|
|
|
|
2019-01-04 17:19:52 +00:00
|
|
|
# Builds everything needed to run dartdevc tests using test.dart.
|
2017-06-29 20:45:55 +00:00
|
|
|
group("dartdevc_test") {
|
|
|
|
deps = [
|
|
|
|
":dartdevc",
|
2017-11-20 23:24:07 +00:00
|
|
|
":dartdevc_sdk",
|
2019-01-04 17:19:52 +00:00
|
|
|
":dartdevc_kernel_sdk",
|
2017-06-29 20:45:55 +00:00
|
|
|
":dartdevc_test_pkg",
|
|
|
|
"../../sdk:create_sdk",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-01-04 17:19:52 +00:00
|
|
|
# Builds everything needed to run dartdevc tests locally using test.dart without
|
|
|
|
# --use-sdk. This is the same as dartdevc_test, but skips things rely on
|
|
|
|
# building the Dart VM and create_sdk.
|
2018-05-30 21:14:01 +00:00
|
|
|
group("dartdevc_test_local") {
|
|
|
|
deps = [
|
|
|
|
":dartdevc_sdk",
|
2019-01-04 17:19:52 +00:00
|
|
|
":dartdevc_kernel_sdk",
|
2018-05-30 21:14:01 +00:00
|
|
|
":dartdevc_test_pkg",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
create_timestamp_file("dartdevc_files_stamp") {
|
|
|
|
path = rebase_path("../../pkg/dev_compiler/lib")
|
|
|
|
output = "$target_gen_dir/dartdevc_files.stamp"
|
|
|
|
}
|
|
|
|
|
2018-06-08 19:18:34 +00:00
|
|
|
create_timestamp_file("dartdevc_sdk_patch_stamp") {
|
2019-06-04 13:47:29 +00:00
|
|
|
path = rebase_path("../../sdk/lib/_internal/js_dev_runtime")
|
2018-06-08 19:18:34 +00:00
|
|
|
output = "$target_gen_dir/dartdevc_sdk_patch_stamp.stamp"
|
|
|
|
}
|
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
# Compiles the packages used by the tests to JS with dartdevc so that they are
|
|
|
|
# available for loading by the tests.
|
2018-06-18 20:31:44 +00:00
|
|
|
prebuilt_dart_action("dartdevc_test_pkg") {
|
2017-06-29 20:45:55 +00:00
|
|
|
deps = [
|
|
|
|
":dartdevc_files_stamp",
|
2017-11-20 23:24:07 +00:00
|
|
|
":dartdevc_sdk",
|
2019-01-04 17:19:52 +00:00
|
|
|
":dartdevc_kernel_sdk",
|
2019-07-11 02:05:37 +00:00
|
|
|
":dartdevc_kernel_sdk_outline",
|
|
|
|
":dartdevc_kernel_sdk_libraries_json",
|
2017-11-20 23:24:07 +00:00
|
|
|
"../../pkg:pkg_files_stamp",
|
2017-06-29 20:45:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
inputs = [
|
2018-01-10 17:56:14 +00:00
|
|
|
sdk_dill,
|
2018-12-04 18:39:46 +00:00
|
|
|
sdk_libraries_json,
|
2017-11-20 23:24:07 +00:00
|
|
|
sdk_summary,
|
2017-06-29 20:45:55 +00:00
|
|
|
"$target_gen_dir/dartdevc_files.stamp",
|
|
|
|
"$root_gen_dir/pkg_files.stamp",
|
|
|
|
]
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"$target_gen_dir/pkg/async_helper.js",
|
|
|
|
"$target_gen_dir/pkg/async_helper.sum",
|
|
|
|
"$target_gen_dir/pkg/collection.js",
|
|
|
|
"$target_gen_dir/pkg/collection.sum",
|
|
|
|
"$target_gen_dir/pkg/expect.js",
|
|
|
|
"$target_gen_dir/pkg/expect.sum",
|
|
|
|
"$target_gen_dir/pkg/js.js",
|
|
|
|
"$target_gen_dir/pkg/js.sum",
|
|
|
|
"$target_gen_dir/pkg/matcher.js",
|
|
|
|
"$target_gen_dir/pkg/matcher.sum",
|
|
|
|
"$target_gen_dir/pkg/meta.js",
|
|
|
|
"$target_gen_dir/pkg/meta.sum",
|
|
|
|
"$target_gen_dir/pkg/path.js",
|
|
|
|
"$target_gen_dir/pkg/path.sum",
|
|
|
|
"$target_gen_dir/pkg/stack_trace.js",
|
|
|
|
"$target_gen_dir/pkg/stack_trace.sum",
|
|
|
|
|
|
|
|
# TODO(rnystrom): Remove this when unittest is no longer used. Also remove
|
|
|
|
# any of the above packages that are only here because unittest uses them.
|
|
|
|
"$target_gen_dir/pkg/unittest.js",
|
|
|
|
"$target_gen_dir/pkg/unittest.sum",
|
2018-06-28 16:15:18 +00:00
|
|
|
|
|
|
|
"$target_gen_dir/pkg_kernel/async_helper.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/async_helper.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/collection.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/collection.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/expect.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/expect.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/js.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/js.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/matcher.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/matcher.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/meta.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/meta.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/path.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/path.js",
|
|
|
|
"$target_gen_dir/pkg_kernel/stack_trace.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/stack_trace.js",
|
|
|
|
|
|
|
|
# TODO(rnystrom): Remove this when unittest is no longer used. Also remove
|
|
|
|
# any of the above packages that are only here because unittest uses them.
|
|
|
|
"$target_gen_dir/pkg_kernel/unittest.dill",
|
|
|
|
"$target_gen_dir/pkg_kernel/unittest.js",
|
2017-06-29 20:45:55 +00:00
|
|
|
]
|
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
script = "../../pkg/dev_compiler/tool/build_pkgs.dart"
|
|
|
|
|
2017-06-29 20:45:55 +00:00
|
|
|
args = [
|
2017-11-20 23:24:07 +00:00
|
|
|
"--analyzer-sdk",
|
|
|
|
rebase_path(sdk_summary),
|
|
|
|
"--kernel-sdk",
|
2018-01-10 17:56:14 +00:00
|
|
|
rebase_path(sdk_dill),
|
2017-11-20 23:24:07 +00:00
|
|
|
"--output",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
rebase_path("$target_gen_dir"),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-07-11 02:05:37 +00:00
|
|
|
prebuilt_dart_action("dartdevc_kernel_sdk_outline") {
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
deps = [
|
2018-06-18 21:24:41 +00:00
|
|
|
"../../pkg:pkg_files_stamp",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
":dartdevc_files_stamp",
|
2018-06-08 19:18:34 +00:00
|
|
|
":dartdevc_sdk_patch_stamp",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
inputs = [
|
2019-07-11 02:05:37 +00:00
|
|
|
"../../utils/bazel/kernel_worker.dart",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
"$target_gen_dir/dartdevc_files.stamp",
|
2018-06-18 21:24:41 +00:00
|
|
|
"$root_gen_dir/pkg_files.stamp",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
outputs = [
|
2018-01-10 17:56:14 +00:00
|
|
|
sdk_dill,
|
2019-07-11 02:05:37 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
script = "../../utils/bazel/kernel_worker.dart"
|
|
|
|
|
|
|
|
args = [
|
|
|
|
"--summary-only",
|
|
|
|
"--target",
|
|
|
|
"ddc",
|
|
|
|
"--multi-root-scheme",
|
|
|
|
"org-dartlang-sdk",
|
|
|
|
"--multi-root",
|
|
|
|
rebase_path("../../sdk"),
|
|
|
|
"--libraries-file",
|
|
|
|
"file:///" + rebase_path("../../sdk/lib/libraries.json"),
|
|
|
|
"--output",
|
|
|
|
rebase_path(sdk_dill),
|
|
|
|
"--source",
|
|
|
|
"dart:core"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
copy("dartdevc_kernel_sdk_libraries_json") {
|
|
|
|
sources = [
|
|
|
|
rebase_path("../../sdk/lib/libraries.json"),
|
|
|
|
]
|
|
|
|
outputs = [
|
2018-12-04 18:39:46 +00:00
|
|
|
sdk_libraries_json,
|
2019-07-11 02:05:37 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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",
|
|
|
|
]
|
|
|
|
|
|
|
|
inputs = [
|
|
|
|
"$target_gen_dir/dartdevc_files.stamp",
|
|
|
|
"$root_gen_dir/pkg_files.stamp",
|
|
|
|
]
|
|
|
|
|
|
|
|
outputs = [
|
2018-01-10 17:56:14 +00:00
|
|
|
"$target_gen_dir/kernel/amd/dart_sdk.js",
|
|
|
|
"$target_gen_dir/kernel/amd/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/kernel/common/dart_sdk.js",
|
|
|
|
"$target_gen_dir/kernel/common/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/kernel/es6/dart_sdk.js",
|
|
|
|
"$target_gen_dir/kernel/es6/dart_sdk.js.map",
|
|
|
|
"$target_gen_dir/kernel/legacy/dart_sdk.js",
|
|
|
|
"$target_gen_dir/kernel/legacy/dart_sdk.js.map",
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
]
|
|
|
|
|
2019-07-11 02:05:37 +00:00
|
|
|
script = "../../pkg/dev_compiler/bin/dartdevc.dart"
|
2018-05-03 21:07:13 +00:00
|
|
|
|
Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:
- Add support to build_pkgs.dart to build the kernel summaries for each
test package (in addition to the analyzer summaries it already
builds).
- Plumb that through the dartdevc_test target in the GN build as well.
- While we're at it, use GN to build the ddc_sdk.dill file and have
test.dart load that one instead of the manually built one from calling
./tool/kernel_sdk.dart.
- Add command-line arguments to dartdevk for passing in the path to the
SDK summary and the other summaries to compile against.
- Fix a little typo in processed_options.dart that was preventing it
from resolving "package:" URIs.
- In test.dart, when compiling a test, link in the summaries for all of
the test packages.
At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.
With all of this, if I change a test to:
import "package:expect/expect.dart";
main() {
Expect.equals("a", "b");
}
Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:
- In _libraryToModule(), the Library we get from kernel has a null
fileUri, so this returns an empty string. That in turn means the
generated JS tries to use "$" as the module name.
Using this works around it temporarily:
if (moduleName.isEmpty) moduleName = library.name;
- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
NamedNode is a static method on a class. It just generates the library
and method name, skipping the class, so "Expect.equals(1, 2)" gets
compiled to "expect.equals(1, 2)" instead of
"expect.Expect.equals(1, 2)".
Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
|
|
|
args = [
|
2019-07-11 02:05:37 +00:00
|
|
|
"-k",
|
|
|
|
"--compile-sdk",
|
|
|
|
"dart:core",
|
|
|
|
"--no-summarize",
|
|
|
|
"--multi-root-scheme",
|
|
|
|
"org-dartlang-sdk",
|
|
|
|
"--multi-root",
|
2019-07-15 16:11:04 +00:00
|
|
|
"file:///" + rebase_path("../../sdk"),
|
2019-07-11 02:05:37 +00:00
|
|
|
"--multi-root-output-path",
|
|
|
|
rebase_path("$target_gen_dir/../../"),
|
|
|
|
"--libraries-file",
|
2019-07-15 16:11:04 +00:00
|
|
|
"org-dartlang-sdk:///lib/libraries.json",
|
2019-07-11 02:05:37 +00:00
|
|
|
"--modules",
|
|
|
|
"amd",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/kernel/amd/dart_sdk.js"),
|
|
|
|
"--modules",
|
|
|
|
"common",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/kernel/common/dart_sdk.js"),
|
|
|
|
"--modules",
|
|
|
|
"es6",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/kernel/es6/dart_sdk.js"),
|
|
|
|
"--modules",
|
|
|
|
"legacy",
|
|
|
|
"-o",
|
|
|
|
rebase_path("$target_gen_dir/kernel/legacy/dart_sdk.js"),
|
2017-06-29 20:45:55 +00:00
|
|
|
]
|
|
|
|
}
|