[vm] Ensure create_sdk GN build has working dart2native iff AOT is supported

This CL

   * adds a GN flag "include_dart2native" off by-default (switched on explicitly for our GN build)
   * ensures every GN build of the "create_sdk" target has a working dart2native (except ia32)
   * removes not-working dart2native script from ia32 dart-sdk (no AOT support in ia32)
   * removes the "dartaotruntime" GN target, since it is the same as "dart_precompiled_runtime"

This should ensure every downstream consumer of the "create_sdk" GN target will
have a working version of dart2native.

For the particular "dart-sdk" we create on dart-sdk-{linux,windows,mac}
we will override the default AOT compiler&runtime with the product mode,
which produces smaller AOT snapshots and has smaller AOT runtime (making
the native executables significantly smaller)

Change-Id: Ib5042589297cdb055c41dc56abdff86a4612ef5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123724
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
This commit is contained in:
Martin Kustermann 2019-11-04 12:01:56 +00:00 committed by commit-bot@chromium.org
parent d2bd6df607
commit ab5cf0f854
5 changed files with 68 additions and 66 deletions

View file

@ -917,26 +917,6 @@ dart_executable("dart_precompiled_runtime") {
}
}
dart_executable("dartaotruntime") {
extra_configs = [ "..:dart_precompiled_runtime_config" ]
extra_deps = [
"..:libdart_precompiled_runtime",
"../platform:libdart_platform_precompiled_runtime",
]
extra_sources = [
"builtin.cc",
"gzip.cc",
"gzip.h",
"loader.cc",
"loader.h",
"main.cc",
"observatory_assets_empty.cc",
"snapshot_empty.cc",
]
extra_deps += [ ":elf_loader" ]
}
executable("process_test") {
sources = [
"process_test.cc",

View file

@ -20,9 +20,12 @@ declare_args() {
# Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.
dart_platform_sdk = true
# Whether to include dart2native in the "create_sdk" target.
include_dart2native = false
# Path to stripped dart binaries relative to build output directory.
dart_stripped_binary = "dart"
dartaotruntime_stripped_binary = "dartaotruntime"
dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime"
gen_snapshot_stripped_binary = "gen_snapshot"
}
@ -35,11 +38,11 @@ declare_args() {
# ......dartaotruntime or dartaotruntime.exe (executable)
# ......dartdoc
# ......dartfmt
# ......dart2native
# ......dart2native (if `include_dart2native` and not on ia32)
# ......dart2js
# ......dartanalyzer
# ......dartdevc
# ......utils/gen_snapshot or utils/gen_snapshot.exe (executable)
# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32)
# ......pub
# ......snapshots/
# ........analysis_server.dart.snapshot
@ -48,7 +51,8 @@ declare_args() {
# ........dartdoc.dart.snapshot
# ........dartfmt.dart.snapshot
# ........dartdevc.dart.snapshot
# ........gen_kernel.dart.snapshot
# ........gen_kernel.dart.snapshot (if `include_dart2native` and not on ia32)
# ........dart2native.dart.snapshot (if `include_dart2native` and not on ia32)
# ........kernel_worker.dart.snapshot
# ........pub.dart.snapshot
# ......resources/
@ -116,10 +120,6 @@ _platform_sdk_snapshots = [
"dartanalyzer",
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
"dart2native",
"../utils/dart2native:generate_dart2native_snapshot",
],
[
"dartdoc",
"../utils/dartdoc",
@ -133,6 +133,12 @@ _platform_sdk_snapshots = [
"../utils/pub",
],
]
if (include_dart2native && dart_target_arch != "ia32") {
_platform_sdk_snapshots += [ [
"dart2native",
"../utils/dart2native:generate_dart2native_snapshot",
] ]
}
if (create_kernel_service_snapshot) {
_platform_sdk_snapshots += [ [
"kernel-service",
@ -155,10 +161,6 @@ _full_sdk_snapshots = [
"dartanalyzer",
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
"dart2native",
"../utils/dart2native:generate_dart2native_snapshot",
],
[
"dartdevc",
"../utils/dartdevc",
@ -180,6 +182,12 @@ _full_sdk_snapshots = [
"../utils/pub",
],
]
if (include_dart2native && dart_target_arch != "ia32") {
_full_sdk_snapshots += [ [
"dart2native",
"../utils/dart2native:generate_dart2native_snapshot",
] ]
}
if (create_kernel_service_snapshot) {
_full_sdk_snapshots += [ [
"kernel-service",
@ -394,25 +402,25 @@ if (target_os != current_os && target_os == "fuchsia") {
copy("copy_dartaotruntime") {
deps = [
"../runtime/bin:dartaotruntime",
"../runtime/bin:dart_precompiled_runtime",
]
dartaotruntime_out =
get_label_info("../runtime/bin:dartaotruntime", "root_out_dir")
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
if (is_win) {
sources = [
"$dartaotruntime_out/dartaotruntime.exe",
"$dartaotruntime_out/dart_precompiled_runtime.exe",
]
outputs = [
"$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
]
} else {
sources = [
"$dartaotruntime_out/$dartaotruntime_stripped_binary",
"$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary",
]
outputs = [
"$root_out_dir/dart-sdk/bin/dartaotruntime",
]
}
if (is_win) {
sources += [ "$dartaotruntime_out/dartaotruntime.lib" ]
}
outputs = [
"$root_out_dir/dart-sdk/bin/{{source_file_part}}",
]
}
copy("copy_gen_snapshot") {
@ -437,6 +445,7 @@ copy("copy_gen_snapshot") {
copy("copy_dart2native") {
deps = [
":copy_dartaotruntime",
":copy_gen_kernel_snapshot",
":copy_gen_snapshot",
]
@ -987,7 +996,6 @@ group("create_common_sdk") {
":copy_analysis_summaries",
":copy_api_readme",
":copy_dart",
":copy_dart2native",
":copy_dartdoc_files",
":copy_headers",
":copy_libraries_dart",
@ -999,6 +1007,13 @@ group("create_common_sdk") {
":write_revision_file",
":write_version_file",
]
# We do not support AOT on ia32 and should therefore not add the
# dart2native script (since there is no AOT compiler/runtime available)
if (include_dart2native && dart_target_arch != "ia32") {
public_deps += [ ":copy_dart2native" ]
}
if (is_win) {
public_deps += [ ":copy_7zip" ]
}

View file

@ -22,7 +22,7 @@ declare_args() {
# Path to stripped dart binaries relative to build output directory.
dart_stripped_binary = "dart"
dartaotruntime_stripped_binary = "dartaotruntime"
dart_precompiled_runtime_stripped = "dart_precompiled_runtime_stripped"
gen_snapshot_stripped_binary = "gen_snapshot"
}
@ -35,7 +35,7 @@ declare_args() {
# ......dartaotruntime or dartaotruntime.exe (executable)
# ......dartdoc
# ......dartfmt
# ......dart2native
# ......dart2native (on all configurations except ia32)
# ......dart2js
# ......dartanalyzer
# ......dartdevc
@ -68,13 +68,13 @@ declare_args() {
# ....lib/
# ......libraries.json
# ......_internal/
#.........strong.sum
#.........dart2js_platform.dill
#.........dart2js_server_platform.dill
#.........dart2js_platform_strong.dill
#.........dart2js_server_platform_strong.dill
#.........vm_platform_strong.dill
#.........dev_compiler/
# ........strong.sum
# ........dart2js_platform.dill
# ........dart2js_server_platform.dill
# ........dart2js_platform_strong.dill
# ........dart2js_server_platform_strong.dill
# ........vm_platform_strong.dill
# ........dev_compiler/
# ......async/
# ......collection/
# ......convert/
@ -394,25 +394,25 @@ if (target_os != current_os && target_os == "fuchsia") {
copy("copy_dartaotruntime") {
deps = [
"../runtime/bin:dartaotruntime",
"../runtime/bin:dart_precompiled_runtime",
]
dartaotruntime_out =
get_label_info("../runtime/bin:dartaotruntime", "root_out_dir")
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
if (is_win) {
sources = [
"$dartaotruntime_out/dartaotruntime.exe",
"$dartaotruntime_out/dart_precompiled_runtime.exe",
]
outputs = [
"$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
]
} else {
sources = [
"$dartaotruntime_out/$dartaotruntime_stripped_binary",
"$dartaotruntime_out/$dart_precompiled_runtime_stripped",
]
outputs = [
"$root_out_dir/dart-sdk/bin/dartaotruntime",
]
}
if (is_win) {
sources += [ "$dartaotruntime_out/dartaotruntime.lib" ]
}
outputs = [
"$root_out_dir/dart-sdk/bin/{{source_file_part}}",
]
}
copy("copy_gen_snapshot") {
@ -437,6 +437,7 @@ copy("copy_gen_snapshot") {
copy("copy_dart2native") {
deps = [
":copy_dartaotruntime",
":copy_gen_kernel_snapshot",
":copy_gen_snapshot",
]
@ -987,7 +988,6 @@ group("create_common_sdk") {
":copy_analysis_summaries",
":copy_api_readme",
":copy_dart",
":copy_dart2native",
":copy_dartdoc_files",
":copy_headers",
":copy_libraries_dart",
@ -999,6 +999,13 @@ group("create_common_sdk") {
":write_revision_file",
":write_version_file",
]
# We do not support AOT on ia32 and should therefore not add the
# dart2native script (since there is no AOT compiler/runtime available)
if (dart_target_arch != "ia32") {
public_deps += [ ":copy_dart2native" ]
}
if (is_win) {
public_deps += [ ":copy_7zip" ]
}

View file

@ -10,9 +10,7 @@
// run the resulting AOT blob with the AOT runtime.
import 'dart:io';
import 'dart:convert';
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';

View file

@ -246,11 +246,13 @@ def ToGnArgs(args, mode, arch, target_os, use_nnbd):
gn_args['is_msan'] = args.msan
gn_args['is_tsan'] = args.tsan
gn_args['is_ubsan'] = args.ubsan
gn_args['include_dart2native'] = True
if not args.platform_sdk and not gn_args['target_cpu'].startswith('arm'):
gn_args['dart_platform_sdk'] = args.platform_sdk
gn_args['dart_stripped_binary'] = 'exe.stripped/dart'
gn_args['dartaotruntime_stripped_binary'] = 'exe.stripped/dartaotruntime'
gn_args[
'dart_precompiled_runtime_stripped_binary'] = 'exe.stripped/dart_precompiled_runtime'
gn_args['gen_snapshot_stripped_binary'] = 'exe.stripped/gen_snapshot'
# Setup the user-defined sysroot.