mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:20:31 +00:00
[ddc] Cleanup JavaScript files in packaged SDK
- Removes all versions of `dart_sdk.js` and `dart_sdk.js.map` from the packaged SDK. All supported build systems compile their own versions of these files. - Removes `dart-sdk/lib/dev_compiler/kernel/common/run.js`. No supported build system uses the "common" module system. - Moves `dart-sdk/lib/dev_compiler/kernel/amd/require.js` to `dart-sdk/lib/dev_compiler/amd/require.js` cleaning up the unnecessary `kernel/` sub-directory. Issue: https://github.com/dart-lang/sdk/issues/50700 Change-Id: Id4173ddec31a6c0260009924bf1e1ae3d3f32abf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275482 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
c140324e1e
commit
1b2ecbda40
4 changed files with 33 additions and 72 deletions
|
@ -380,8 +380,8 @@ class TestDriver {
|
|||
if (!File('$dartSdkPath.js').existsSync()) {
|
||||
throw Exception('Unable to find Dart SDK at $dartSdkPath.js');
|
||||
}
|
||||
var requirePath = escaped(p.join(buildDir, 'dart-sdk', 'lib',
|
||||
'dev_compiler', 'kernel', 'amd', 'require.js'));
|
||||
var requirePath = escaped(p.join(
|
||||
buildDir, 'dart-sdk', 'lib', 'dev_compiler', 'amd', 'require.js'));
|
||||
var outputPath = escaped(p.withoutExtension(output.toFilePath()));
|
||||
bootstrapFile.writeAsStringSync('''
|
||||
<script src='$requirePath'></script>
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:front_end/src/compute_platform_binaries_location.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:source_maps/source_maps.dart' as sm;
|
||||
|
||||
void main() async {
|
||||
final binDir = p.dirname(Platform.resolvedExecutable);
|
||||
final sdkDir = p.dirname(binDir);
|
||||
// This test expects to run in a build SDK.
|
||||
Expect.isTrue(binDir.endsWith('bin'));
|
||||
|
||||
final sdkJsMapDir =
|
||||
p.joinAll([sdkDir, 'lib', 'dev_compiler', 'kernel', 'amd']);
|
||||
// This test relies on source maps for the built SDK when working inside the
|
||||
// Dart SDK repo.
|
||||
final buildDir = computePlatformBinariesLocation(forceBuildDir: true);
|
||||
final sdkJsMapDir = buildDir
|
||||
.resolve(p.joinAll(['gen', 'utils', 'dartdevc', 'sound', 'amd']))
|
||||
.toFilePath();
|
||||
final sdkJsMapFile = p.join(sdkJsMapDir, 'dart_sdk.js.map');
|
||||
|
||||
final sdkJsMapText = await File(sdkJsMapFile).readAsString();
|
||||
|
|
78
sdk/BUILD.gn
78
sdk/BUILD.gn
|
@ -530,67 +530,21 @@ copy("copy_dev_compiler_dills") {
|
|||
[ "$root_out_dir/$dart_sdk_output/lib/_internal/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
# This rule copies DDK's JS SDK and require.js to lib/dev_compiler/kernel/amd.
|
||||
copy("copy_dev_compiler_js_amd_kernel") {
|
||||
visibility = [ ":copy_dev_compiler_js" ]
|
||||
deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
|
||||
gen_dir =
|
||||
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
|
||||
sources = [
|
||||
"$gen_dir/kernel/amd/dart_sdk.js",
|
||||
"$gen_dir/kernel/amd/dart_sdk.js.map",
|
||||
"../third_party/requirejs/require.js",
|
||||
]
|
||||
outputs = [ "$root_out_dir/$dart_sdk_output/lib/dev_compiler/kernel/amd/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/common.
|
||||
copy("copy_dev_compiler_js_common_kernel") {
|
||||
visibility = [ ":copy_dev_compiler_js" ]
|
||||
deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
|
||||
gen_dir =
|
||||
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
|
||||
sources = [
|
||||
"$gen_dir/kernel/common/dart_sdk.js",
|
||||
"$gen_dir/kernel/common/dart_sdk.js.map",
|
||||
"../pkg/dev_compiler/lib/js/common/run.js",
|
||||
]
|
||||
outputs = [ "$root_out_dir/$dart_sdk_output/lib/dev_compiler/kernel/common/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/es6.
|
||||
copy("copy_dev_compiler_js_es6_kernel") {
|
||||
visibility = [ ":copy_dev_compiler_js" ]
|
||||
deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
|
||||
gen_dir =
|
||||
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
|
||||
sources = [
|
||||
"$gen_dir/kernel/es6/dart_sdk.js",
|
||||
"$gen_dir/kernel/es6/dart_sdk.js.map",
|
||||
]
|
||||
outputs = [ "$root_out_dir/$dart_sdk_output/lib/dev_compiler/kernel/es6/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
# Copies all of the JS artifacts needed by DDC.
|
||||
group("copy_dev_compiler_js") {
|
||||
visibility = [
|
||||
":copy_dev_compiler_sdk",
|
||||
":copy_dev_compiler_tools",
|
||||
]
|
||||
public_deps = [
|
||||
":copy_dev_compiler_js_amd_kernel",
|
||||
":copy_dev_compiler_js_common_kernel",
|
||||
":copy_dev_compiler_js_es6_kernel",
|
||||
]
|
||||
}
|
||||
|
||||
# This rule copies tools to go along with ddc.
|
||||
copy("copy_dev_compiler_tools") {
|
||||
# Copies require.js to lib/dev_compiler/amd.
|
||||
# Used to load DDC compiled amd modules.
|
||||
copy("copy_dev_compiler_amd_require_js") {
|
||||
visibility = [ ":copy_dev_compiler_sdk" ]
|
||||
deps = [
|
||||
":copy_dev_compiler_js",
|
||||
"../utils/dartdevc:stack_trace_mapper",
|
||||
sources = [ "../third_party/requirejs/require.js" ]
|
||||
outputs = [
|
||||
"$root_out_dir/$dart_sdk_output/lib/dev_compiler/amd/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
# Copies stack_trace_mapper tool to lib/dev_compiler/web.
|
||||
# Used when running DDC compiled applicaations.
|
||||
copy("copy_dev_compiler_stack_trace_mapper") {
|
||||
visibility = [ ":copy_dev_compiler_sdk" ]
|
||||
deps = [ "../utils/dartdevc:stack_trace_mapper" ]
|
||||
dart_out =
|
||||
get_label_info("../utils/dartdevc:stack_trace_mapper", "root_out_dir")
|
||||
sources = [ "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js" ]
|
||||
|
@ -599,13 +553,13 @@ copy("copy_dev_compiler_tools") {
|
|||
]
|
||||
}
|
||||
|
||||
# This is the main rule for copying ddc's dependencies to lib/
|
||||
# Main rule for copying all of DDC's dependencies to lib.
|
||||
group("copy_dev_compiler_sdk") {
|
||||
visibility = [ ":create_full_sdk" ]
|
||||
public_deps = [
|
||||
":copy_dev_compiler_amd_require_js",
|
||||
":copy_dev_compiler_dills",
|
||||
":copy_dev_compiler_js",
|
||||
":copy_dev_compiler_tools",
|
||||
":copy_dev_compiler_stack_trace_mapper",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,14 @@ template("dartdevc_sdk_js") {
|
|||
"--multi-root-scheme",
|
||||
"org-dartlang-sdk",
|
||||
"--multi-root-output-path",
|
||||
rebase_path("$target_gen_dir/../../"),
|
||||
|
||||
# This path is intended to point to a version of source files used to
|
||||
# generate the SDK JavaScript modules.
|
||||
# The intention is that the source map locations can be linked to the
|
||||
# orignal source files while running SDK test suites.
|
||||
# These JavaScript files and source maps are no longer packaged into the
|
||||
# released SDK.
|
||||
rebase_path("$target_gen_dir/../../../dart-sdk"),
|
||||
"--modules",
|
||||
"amd",
|
||||
"-o",
|
||||
|
|
Loading…
Reference in a new issue