Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ab5cf0f

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[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>
1 parent d2bd6df commit ab5cf0f

File tree

5 files changed

+68
-66
lines changed

5 files changed

+68
-66
lines changed

runtime/bin/BUILD.gn

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -917,26 +917,6 @@ dart_executable("dart_precompiled_runtime") {
917917
}
918918
}
919919

920-
dart_executable("dartaotruntime") {
921-
extra_configs = [ "..:dart_precompiled_runtime_config" ]
922-
extra_deps = [
923-
"..:libdart_precompiled_runtime",
924-
"../platform:libdart_platform_precompiled_runtime",
925-
]
926-
extra_sources = [
927-
"builtin.cc",
928-
"gzip.cc",
929-
"gzip.h",
930-
"loader.cc",
931-
"loader.h",
932-
"main.cc",
933-
"observatory_assets_empty.cc",
934-
"snapshot_empty.cc",
935-
]
936-
937-
extra_deps += [ ":elf_loader" ]
938-
}
939-
940920
executable("process_test") {
941921
sources = [
942922
"process_test.cc",

sdk/BUILD.gn

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ declare_args() {
2020
# Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.
2121
dart_platform_sdk = true
2222

23+
# Whether to include dart2native in the "create_sdk" target.
24+
include_dart2native = false
25+
2326
# Path to stripped dart binaries relative to build output directory.
2427
dart_stripped_binary = "dart"
25-
dartaotruntime_stripped_binary = "dartaotruntime"
28+
dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime"
2629
gen_snapshot_stripped_binary = "gen_snapshot"
2730
}
2831

@@ -35,11 +38,11 @@ declare_args() {
3538
# ......dartaotruntime or dartaotruntime.exe (executable)
3639
# ......dartdoc
3740
# ......dartfmt
38-
# ......dart2native
41+
# ......dart2native (if `include_dart2native` and not on ia32)
3942
# ......dart2js
4043
# ......dartanalyzer
4144
# ......dartdevc
42-
# ......utils/gen_snapshot or utils/gen_snapshot.exe (executable)
45+
# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32)
4346
# ......pub
4447
# ......snapshots/
4548
# ........analysis_server.dart.snapshot
@@ -48,7 +51,8 @@ declare_args() {
4851
# ........dartdoc.dart.snapshot
4952
# ........dartfmt.dart.snapshot
5053
# ........dartdevc.dart.snapshot
51-
# ........gen_kernel.dart.snapshot
54+
# ........gen_kernel.dart.snapshot (if `include_dart2native` and not on ia32)
55+
# ........dart2native.dart.snapshot (if `include_dart2native` and not on ia32)
5256
# ........kernel_worker.dart.snapshot
5357
# ........pub.dart.snapshot
5458
# ......resources/
@@ -116,10 +120,6 @@ _platform_sdk_snapshots = [
116120
"dartanalyzer",
117121
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
118122
],
119-
[
120-
"dart2native",
121-
"../utils/dart2native:generate_dart2native_snapshot",
122-
],
123123
[
124124
"dartdoc",
125125
"../utils/dartdoc",
@@ -133,6 +133,12 @@ _platform_sdk_snapshots = [
133133
"../utils/pub",
134134
],
135135
]
136+
if (include_dart2native && dart_target_arch != "ia32") {
137+
_platform_sdk_snapshots += [ [
138+
"dart2native",
139+
"../utils/dart2native:generate_dart2native_snapshot",
140+
] ]
141+
}
136142
if (create_kernel_service_snapshot) {
137143
_platform_sdk_snapshots += [ [
138144
"kernel-service",
@@ -155,10 +161,6 @@ _full_sdk_snapshots = [
155161
"dartanalyzer",
156162
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
157163
],
158-
[
159-
"dart2native",
160-
"../utils/dart2native:generate_dart2native_snapshot",
161-
],
162164
[
163165
"dartdevc",
164166
"../utils/dartdevc",
@@ -180,6 +182,12 @@ _full_sdk_snapshots = [
180182
"../utils/pub",
181183
],
182184
]
185+
if (include_dart2native && dart_target_arch != "ia32") {
186+
_full_sdk_snapshots += [ [
187+
"dart2native",
188+
"../utils/dart2native:generate_dart2native_snapshot",
189+
] ]
190+
}
183191
if (create_kernel_service_snapshot) {
184192
_full_sdk_snapshots += [ [
185193
"kernel-service",
@@ -394,25 +402,25 @@ if (target_os != current_os && target_os == "fuchsia") {
394402

395403
copy("copy_dartaotruntime") {
396404
deps = [
397-
"../runtime/bin:dartaotruntime",
405+
"../runtime/bin:dart_precompiled_runtime",
398406
]
399407
dartaotruntime_out =
400-
get_label_info("../runtime/bin:dartaotruntime", "root_out_dir")
408+
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
401409
if (is_win) {
402410
sources = [
403-
"$dartaotruntime_out/dartaotruntime.exe",
411+
"$dartaotruntime_out/dart_precompiled_runtime.exe",
412+
]
413+
outputs = [
414+
"$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
404415
]
405416
} else {
406417
sources = [
407-
"$dartaotruntime_out/$dartaotruntime_stripped_binary",
418+
"$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary",
419+
]
420+
outputs = [
421+
"$root_out_dir/dart-sdk/bin/dartaotruntime",
408422
]
409423
}
410-
if (is_win) {
411-
sources += [ "$dartaotruntime_out/dartaotruntime.lib" ]
412-
}
413-
outputs = [
414-
"$root_out_dir/dart-sdk/bin/{{source_file_part}}",
415-
]
416424
}
417425

418426
copy("copy_gen_snapshot") {
@@ -437,6 +445,7 @@ copy("copy_gen_snapshot") {
437445

438446
copy("copy_dart2native") {
439447
deps = [
448+
":copy_dartaotruntime",
440449
":copy_gen_kernel_snapshot",
441450
":copy_gen_snapshot",
442451
]
@@ -987,7 +996,6 @@ group("create_common_sdk") {
987996
":copy_analysis_summaries",
988997
":copy_api_readme",
989998
":copy_dart",
990-
":copy_dart2native",
991999
":copy_dartdoc_files",
9921000
":copy_headers",
9931001
":copy_libraries_dart",
@@ -999,6 +1007,13 @@ group("create_common_sdk") {
9991007
":write_revision_file",
10001008
":write_version_file",
10011009
]
1010+
1011+
# We do not support AOT on ia32 and should therefore not add the
1012+
# dart2native script (since there is no AOT compiler/runtime available)
1013+
if (include_dart2native && dart_target_arch != "ia32") {
1014+
public_deps += [ ":copy_dart2native" ]
1015+
}
1016+
10021017
if (is_win) {
10031018
public_deps += [ ":copy_7zip" ]
10041019
}

sdk_nnbd/BUILD.gn

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ declare_args() {
2222

2323
# Path to stripped dart binaries relative to build output directory.
2424
dart_stripped_binary = "dart"
25-
dartaotruntime_stripped_binary = "dartaotruntime"
25+
dart_precompiled_runtime_stripped = "dart_precompiled_runtime_stripped"
2626
gen_snapshot_stripped_binary = "gen_snapshot"
2727
}
2828

@@ -35,7 +35,7 @@ declare_args() {
3535
# ......dartaotruntime or dartaotruntime.exe (executable)
3636
# ......dartdoc
3737
# ......dartfmt
38-
# ......dart2native
38+
# ......dart2native (on all configurations except ia32)
3939
# ......dart2js
4040
# ......dartanalyzer
4141
# ......dartdevc
@@ -68,13 +68,13 @@ declare_args() {
6868
# ....lib/
6969
# ......libraries.json
7070
# ......_internal/
71-
#.........strong.sum
72-
#.........dart2js_platform.dill
73-
#.........dart2js_server_platform.dill
74-
#.........dart2js_platform_strong.dill
75-
#.........dart2js_server_platform_strong.dill
76-
#.........vm_platform_strong.dill
77-
#.........dev_compiler/
71+
# ........strong.sum
72+
# ........dart2js_platform.dill
73+
# ........dart2js_server_platform.dill
74+
# ........dart2js_platform_strong.dill
75+
# ........dart2js_server_platform_strong.dill
76+
# ........vm_platform_strong.dill
77+
# ........dev_compiler/
7878
# ......async/
7979
# ......collection/
8080
# ......convert/
@@ -394,25 +394,25 @@ if (target_os != current_os && target_os == "fuchsia") {
394394

395395
copy("copy_dartaotruntime") {
396396
deps = [
397-
"../runtime/bin:dartaotruntime",
397+
"../runtime/bin:dart_precompiled_runtime",
398398
]
399399
dartaotruntime_out =
400-
get_label_info("../runtime/bin:dartaotruntime", "root_out_dir")
400+
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
401401
if (is_win) {
402402
sources = [
403-
"$dartaotruntime_out/dartaotruntime.exe",
403+
"$dartaotruntime_out/dart_precompiled_runtime.exe",
404+
]
405+
outputs = [
406+
"$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
404407
]
405408
} else {
406409
sources = [
407-
"$dartaotruntime_out/$dartaotruntime_stripped_binary",
410+
"$dartaotruntime_out/$dart_precompiled_runtime_stripped",
411+
]
412+
outputs = [
413+
"$root_out_dir/dart-sdk/bin/dartaotruntime",
408414
]
409415
}
410-
if (is_win) {
411-
sources += [ "$dartaotruntime_out/dartaotruntime.lib" ]
412-
}
413-
outputs = [
414-
"$root_out_dir/dart-sdk/bin/{{source_file_part}}",
415-
]
416416
}
417417

418418
copy("copy_gen_snapshot") {
@@ -437,6 +437,7 @@ copy("copy_gen_snapshot") {
437437

438438
copy("copy_dart2native") {
439439
deps = [
440+
":copy_dartaotruntime",
440441
":copy_gen_kernel_snapshot",
441442
":copy_gen_snapshot",
442443
]
@@ -987,7 +988,6 @@ group("create_common_sdk") {
987988
":copy_analysis_summaries",
988989
":copy_api_readme",
989990
":copy_dart",
990-
":copy_dart2native",
991991
":copy_dartdoc_files",
992992
":copy_headers",
993993
":copy_libraries_dart",
@@ -999,6 +999,13 @@ group("create_common_sdk") {
999999
":write_revision_file",
10001000
":write_version_file",
10011001
]
1002+
1003+
# We do not support AOT on ia32 and should therefore not add the
1004+
# dart2native script (since there is no AOT compiler/runtime available)
1005+
if (dart_target_arch != "ia32") {
1006+
public_deps += [ ":copy_dart2native" ]
1007+
}
1008+
10021009
if (is_win) {
10031010
public_deps += [ ":copy_7zip" ]
10041011
}

tools/bots/aot_smoke_tests.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
// run the resulting AOT blob with the AOT runtime.
1111

1212
import 'dart:io';
13-
import 'dart:convert';
1413

15-
import 'package:args/args.dart';
1614
import 'package:path/path.dart' as path;
1715
import 'package:test/test.dart';
1816

tools/gn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,13 @@ def ToGnArgs(args, mode, arch, target_os, use_nnbd):
246246
gn_args['is_msan'] = args.msan
247247
gn_args['is_tsan'] = args.tsan
248248
gn_args['is_ubsan'] = args.ubsan
249+
gn_args['include_dart2native'] = True
249250

250251
if not args.platform_sdk and not gn_args['target_cpu'].startswith('arm'):
251252
gn_args['dart_platform_sdk'] = args.platform_sdk
252253
gn_args['dart_stripped_binary'] = 'exe.stripped/dart'
253-
gn_args['dartaotruntime_stripped_binary'] = 'exe.stripped/dartaotruntime'
254+
gn_args[
255+
'dart_precompiled_runtime_stripped_binary'] = 'exe.stripped/dart_precompiled_runtime'
254256
gn_args['gen_snapshot_stripped_binary'] = 'exe.stripped/gen_snapshot'
255257

256258
# Setup the user-defined sysroot.

0 commit comments

Comments
 (0)