From 21222b64c41c5331f2bbe30c6fe0fb0d26a4ee90 Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Tue, 16 Jun 2020 10:41:27 +0000 Subject: [PATCH] Revert "[vm] Build dart2native dependencies with the normal "create_sdk" target" This reverts commit a88a328b7f5afb887baee0e5d7c2db681e52efd6. Reason for revert: Auto roller hasn't rolled previous changes from Dart yet. Those changes updated DEPS for icu/boringssl. We have to wait with this CL until the DEPS changes have been done in the engine. Original change's description: > [vm] Build dart2native dependencies with the normal "create_sdk" target > > This removes special logic for creating the `dart-sdk` we distribute > which used to build release and product mode and copied some binaries > from the latter into the former, before the SDK was actuallly ready to > test and distribute. > > This changes the GN build rules to build the necessary > gen_snapshot/dart_precompiled_runtime product binaries during the normal > release build. > > Normally during --mode=product builds the global build config in > //build/config/BUILDCONFIG.gn will set `-fvisibility=false`. > > => Doing so results in much smaller binaries - because only explicitly > exported symbols are visible, the rest can be tree shaken by the linker. > > Since we are building --mode=release, the `-fvisibility=false` will not > be set. In order to set the flag for the 2 special product-mode binaries > we need to add -fvisibility=hidden manually, in: > > * dart_product_config: Which is used for compiling VM sources. > * 3rd party double-conversion library > * 3rd party boringssl library > * 3rd party icu library > > The upstream CLs are: > > * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482 > * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407 > > Issue https://github.com/dart-lang/sdk/issues/42230 > > Change-Id: I3e47664d9fadb9ed1ad033bb17d46e769442f741 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150524 > Commit-Queue: Martin Kustermann > Reviewed-by: Alexander Thomas > Reviewed-by: Zach Anderson TBR=kustermann@google.com,zra@google.com,athom@google.com,asiva@google.com Change-Id: Ied0f2f5b58dceb2b59bc2ac6e11e5fd717c8885e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151382 Reviewed-by: Martin Kustermann Commit-Queue: Martin Kustermann --- pkg/dart2native/bin/dart2native.dart | 16 +++- runtime/BUILD.gn | 8 -- runtime/bin/BUILD.gn | 62 ++-------------- runtime/configs.gni | 24 ------ .../double-conversion/src/BUILD.gn | 6 -- runtime/vm/BUILD.gn | 24 +----- sdk/BUILD.gn | 73 ++++++++++--------- sdk_nnbd/BUILD.gn | 67 ++++++++--------- tools/bots/dart_sdk.py | 23 ++++++ tools/bots/test_matrix.json | 60 +++++++++++++++ tools/gn.py | 13 ++-- tools/linux_dist_support/debian/rules | 17 +++++ 12 files changed, 199 insertions(+), 194 deletions(-) diff --git a/pkg/dart2native/bin/dart2native.dart b/pkg/dart2native/bin/dart2native.dart index 19015f6e88b..bfe7ec8fe56 100644 --- a/pkg/dart2native/bin/dart2native.dart +++ b/pkg/dart2native/bin/dart2native.dart @@ -19,6 +19,8 @@ final String dartaotruntime = path.join(binDir, 'dartaotruntime${executableSuffix}'); final String genSnapshot = path.join(binDir, 'utils', 'gen_snapshot${executableSuffix}'); +final String platformDill = + path.join(sdkDir, 'lib', '_internal', 'vm_platform_strong.dill'); final String productPlatformDill = path.join(sdkDir, 'lib', '_internal', 'vm_platform_strong_product.dill'); @@ -43,8 +45,20 @@ Future generateNative( print('Generating AOT kernel dill.'); } + // Prefer to use the product platform file, if available. Fall back to the + // normal one (this happens if `out//dart-sdk` is used). + // + // Background information: For the `dart-sdk` we distribute we build release + // and product mode configurations. Then we have an extra bundling step + // which will add product-mode + // gen_snapshot/dartaotruntime/vm_platform_strong_product.dill to the + // release SDK (see tools/bots/dart_sdk.py:CopyAotBinaries) + final String platformFileToUse = File(productPlatformDill).existsSync() + ? productPlatformDill + : platformDill; + final kernelResult = await generateAotKernel(dart, genKernel, - productPlatformDill, sourceFile, kernelFile, packages, defines); + platformFileToUse, sourceFile, kernelFile, packages, defines); if (kernelResult.exitCode != 0) { stderr.writeln(kernelResult.stdout); stderr.writeln(kernelResult.stderr); diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index bbabc7cd05e..34e123818ae 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -40,16 +40,8 @@ config("dart_maybe_product_config") { # If a DEBUG build has been specified it will be ignored. config("dart_product_config") { defines = [] - cflags = [] if (!dart_debug) { defines += [ "PRODUCT" ] - if (is_posix) { - cflags = [ - # This is the equivalent from `build/config/BUILDCONFIG.gn` which includes - # `build/config/gcc:symbol_visibility_hidden` in product mode. - "-fvisibility=hidden", - ] - } } } diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 427fe0bfc31..3ec3471714a 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -69,7 +69,6 @@ build_libdart_builtin("libdart_builtin_product") { extra_configs = [ "..:dart_product_config", "..:dart_os_config", - "..:dart_arch_config", ] } @@ -137,11 +136,7 @@ template("build_elf_loader") { } build_elf_loader("elf_loader") { - if (dart_runtime_mode == "release") { - deps = [ ":libdart_builtin_product" ] - } else { - deps = [ ":libdart_builtin" ] - } + deps = [ ":libdart_builtin" ] } build_elf_loader("elf_loader_product") { @@ -517,12 +512,6 @@ dart_io("standalone_dart_io") { extra_deps = [ ":libdart_builtin" ] } -dart_io("standalone_dart_io_product") { - extra_configs = [ "..:dart_product_config" ] - extra_sources = [] - extra_deps = [ ":libdart_builtin_product" ] -} - gen_snapshot_action("generate_snapshot_bin") { deps = [ "../vm:vm_platform_stripped" ] vm_snapshot_data = "$target_gen_dir/vm_snapshot_data.bin" @@ -743,11 +732,6 @@ action("generate_abi_version_cc_file") { } template("dart_executable") { - use_product_mode = dart_runtime_mode == "release" - if (defined(invoker.use_product_mode)) { - use_product_mode = invoker.use_product_mode - } - extra_configs = [] if (defined(invoker.extra_configs)) { extra_configs += invoker.extra_configs @@ -777,12 +761,8 @@ template("dart_executable") { "..:dart_arch_config", "..:dart_config", "..:dart_os_config", + "..:dart_maybe_product_config", ] + extra_configs - if (use_product_mode) { - configs += [ "..:dart_product_config" ] - } else { - configs += [ "..:dart_maybe_product_config" ] - } if (target_os != current_os && target_os == "fuchsia") { # We already have these in the standalone build, but Fuchsia doesn't # have them. They are needed for running Fuchsia binaries built for the @@ -795,17 +775,12 @@ template("dart_executable") { } deps = [ - ":crashpad", - ":generate_abi_version_cc_file", - "//third_party/boringssl", - "//third_party/zlib", - ] - if (use_product_mode) { - deps += [ ":standalone_dart_io_product" ] - } else { - deps += [ ":standalone_dart_io" ] - } - deps += extra_deps + ":standalone_dart_io", + "//third_party/boringssl", + "//third_party/zlib", + ":crashpad", + ":generate_abi_version_cc_file", + ] + extra_deps defines = extra_defines if (exclude_kernel_service) { @@ -913,27 +888,6 @@ dart_executable("dart_precompiled_runtime") { } } -dart_executable("dart_precompiled_runtime_product") { - use_product_mode = true - extra_configs = [ "..:dart_precompiled_runtime_config" ] - extra_deps = [ - "..:libdart_precompiled_runtime_product", - "../platform:libdart_platform_precompiled_runtime_product", - ] - 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_product" ] -} - executable("process_test") { sources = [ "process_test.cc" ] } diff --git a/runtime/configs.gni b/runtime/configs.gni index 94ee5d3fd23..971d24220ef 100644 --- a/runtime/configs.gni +++ b/runtime/configs.gni @@ -66,77 +66,66 @@ _all_configs = [ configs = _jit_config snapshot = true compiler = true - is_product = false }, { suffix = "_jit_product" configs = _jit_product_config snapshot = true compiler = true - is_product = true }, { suffix = "_precompiled_runtime" configs = _precompiled_runtime_config snapshot = true compiler = false - is_product = false }, { suffix = "_precompiled_runtime_product" configs = _precompiled_runtime_product_config snapshot = true compiler = false - is_product = true }, { suffix = "_precompiler" configs = _precompiler_config snapshot = false compiler = true - is_product = false }, { suffix = "_precompiler_product" configs = _precompiler_product_config snapshot = false compiler = true - is_product = true }, { suffix = "_precompiler_fuchsia" configs = _precompiler_fuchsia_config snapshot = false compiler = true - is_product = false }, { suffix = "_precompiler_product_fuchsia" configs = _precompiler_product_fuchsia_config snapshot = false compiler = true - is_product = true }, { suffix = "_precompiler_host_targeting_host" configs = _precompiler_host_targeting_host_config snapshot = false compiler = true - is_product = false }, { suffix = "_precompiler_product_host_targeting_host" configs = _precompiler_product_host_targeting_host_config snapshot = false compiler = true - is_product = true }, { suffix = "_libfuzzer" configs = _libfuzzer_config snapshot = true compiler = true - is_product = false }, ] @@ -185,14 +174,6 @@ template("library_for_all_configs") { if (defined(invoker.extra_deps)) { extra_deps += invoker.extra_deps } - extra_product_deps = [] - if (defined(invoker.extra_product_deps)) { - extra_product_deps += invoker.extra_product_deps - } - extra_nonproduct_deps = [] - if (defined(invoker.extra_nonproduct_deps)) { - extra_nonproduct_deps += invoker.extra_nonproduct_deps - } foreach(conf, _all_configs) { target(invoker.target_type, "${target_name}${conf.suffix}") { forward_variables_from(invoker, @@ -215,11 +196,6 @@ template("library_for_all_configs") { } } deps = configured_deps + extra_deps - if (conf.is_product) { - deps += extra_product_deps - } else { - deps += extra_nonproduct_deps - } if (conf.snapshot) { if (defined(snapshot_sources)) { sources += snapshot_sources diff --git a/runtime/third_party/double-conversion/src/BUILD.gn b/runtime/third_party/double-conversion/src/BUILD.gn index b16ec11c3c7..e7908684c56 100644 --- a/runtime/third_party/double-conversion/src/BUILD.gn +++ b/runtime/third_party/double-conversion/src/BUILD.gn @@ -3,12 +3,6 @@ # BSD-style license that can be found in the LICENSE file. source_set("libdouble_conversion") { - # We are only interested in exposing the exported symbols (for size reasons). - cflags = [] - if (is_posix) { - cflags += [ "-fvisibility=hidden" ] - } - configs += [ "../../..:dart_arch_config", "../../..:dart_config", diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn index c35366cc7d1..395b15fbc3f 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -63,14 +63,7 @@ config("libdart_vm_config") { library_for_all_configs("libdart_vm") { target_type = "source_set" - extra_product_deps = [ - "//third_party/icu:icui18n_hidden_visibility", - "//third_party/icu:icuuc_hidden_visibility", - ] - extra_nonproduct_deps = [ - "//third_party/icu:icui18n", - "//third_party/icu:icuuc", - ] + extra_deps = [ "//third_party/icu" ] if (is_fuchsia) { if (using_fuchsia_sdk) { extra_deps += [ @@ -154,10 +147,6 @@ library_for_all_configs("libdart_lib") { template("gen_vm_platform") { assert(defined(invoker.output_postfix), "Must define output postfix (e.g., '_strong'") - is_product_flag = dart_runtime_mode == "release" - if (defined(invoker.product_mode)) { - is_product_flag = invoker.product_mode - } compile_platform(target_name) { output_postfix = invoker.output_postfix if (defined(invoker.add_implicit_vm_platform_dependency)) { @@ -177,6 +166,7 @@ template("gen_vm_platform") { "$root_out_dir/vm_outline" + output_postfix + ".dill", ] args = [ "dart:core" ] + is_product_flag = dart_runtime_mode == "release" allow_causal_async_stacks = !is_product_flag args += [ "-Ddart.vm.product=$is_product_flag", @@ -203,16 +193,6 @@ gen_vm_platform("vm_platform") { output_postfix = "_strong" } -gen_vm_platform("vm_platform_product") { - add_implicit_vm_platform_dependency = false - exclude_source = false - output_postfix = "_strong_product" - - # In Debug mode we use debug binaries for dart2native. - # (see also the "dart_product_config" config) - product_mode = !is_debug -} - gen_vm_platform("vm_platform_stripped") { add_implicit_vm_platform_dependency = false exclude_source = true diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 7a5a283e3e9..812565a0373 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -14,7 +14,6 @@ # fail. import("../build/dart/copy_tree.gni") -import("../build/executable_suffix.gni") import("../runtime/runtime_args.gni") import("../sdk_args.gni") @@ -22,10 +21,13 @@ 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" - dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime_product" - gen_snapshot_stripped_binary = "gen_snapshot_product" + dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime" + gen_snapshot_stripped_binary = "gen_snapshot" } # The directory layout of the SDK is as follows: @@ -37,11 +39,11 @@ declare_args() { # ......dartaotruntime or dartaotruntime.exe (executable) # ......dartdoc # ......dartfmt -# ......dart2native (if not on ia32) +# ......dart2native (if `include_dart2native` and not on ia32) # ......dart2js # ......dartanalyzer # ......dartdevc -# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32) +# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32) # ......pub # ......snapshots/ # ........analysis_server.dart.snapshot @@ -51,8 +53,8 @@ declare_args() { # ........dartdoc.dart.snapshot # ........dartfmt.dart.snapshot # ........dartdevc.dart.snapshot -# ........gen_kernel.dart.snapshot (if not on ia32) -# ........dart2native.dart.snapshot (if not on ia32) +# ........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 # ........frontend_server.dart.snapshot @@ -138,7 +140,7 @@ _platform_sdk_snapshots = [ "../utils/pub", ], ] -if (dart_target_arch != "ia32") { +if (include_dart2native && dart_target_arch != "ia32") { _platform_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -195,7 +197,7 @@ _full_sdk_snapshots = [ "../utils/kernel-service:frontend_server", ], ] -if (dart_target_arch != "ia32") { +if (include_dart2native && dart_target_arch != "ia32") { _full_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -409,7 +411,11 @@ if (target_os != current_os && target_os == "fuchsia") { visibility = [ ":create_common_sdk" ] deps = [ "../runtime/bin:dart" ] dart_out = get_label_info("../runtime/bin:dart", "root_out_dir") - sources = [ "$dart_out/${dart_stripped_binary}${executable_suffix}" ] + if (is_win) { + sources = [ "$dart_out/dart.exe" ] + } else { + sources = [ "$dart_out/$dart_stripped_binary" ] + } if (is_win) { sources += [ "$dart_out/dart.lib" ] } @@ -418,32 +424,29 @@ if (target_os != current_os && target_os == "fuchsia") { } copy("copy_dartaotruntime") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/bin:dart_precompiled_runtime_product" ] - src_dir = get_label_info("../runtime/bin:dart_precompiled_runtime_product", - "root_out_dir") - sources = [ - "$src_dir/${dart_precompiled_runtime_stripped_binary}${executable_suffix}", - ] - outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime${executable_suffix}" ] + deps = [ "../runtime/bin:dart_precompiled_runtime" ] + dartaotruntime_out = + get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir") + if (is_win) { + sources = [ "$dartaotruntime_out/dart_precompiled_runtime.exe" ] + outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime.exe" ] + } else { + sources = + [ "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary" ] + outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime" ] + } } copy("copy_gen_snapshot") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/bin:gen_snapshot_product" ] - src_dir = - get_label_info("../runtime/bin:gen_snapshot_product", "root_out_dir") - sources = [ "$src_dir/${gen_snapshot_stripped_binary}${executable_suffix}" ] - outputs = - [ "$root_out_dir/dart-sdk/bin/utils/gen_snapshot${executable_suffix}" ] -} - -copy("copy_vm_platform_strong_product") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/vm:vm_platform_product" ] - src_dir = get_label_info("../runtime/vm:vm_platform_product", "root_out_dir") - sources = [ "$src_dir/vm_platform_strong_product.dill" ] - outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ] + deps = [ "../runtime/bin:gen_snapshot" ] + gen_snapshot_out = + get_label_info("../runtime/bin:gen_snapshot", "root_out_dir") + if (is_win) { + sources = [ "$gen_snapshot_out/gen_snapshot.exe" ] + } else { + sources = [ "$gen_snapshot_out/$gen_snapshot_stripped_binary" ] + } + outputs = [ "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}" ] } copy("copy_dart2native") { @@ -451,7 +454,6 @@ copy("copy_dart2native") { ":copy_dartaotruntime", ":copy_gen_kernel_snapshot", ":copy_gen_snapshot", - ":copy_vm_platform_strong_product", ] ext = "" if (is_win) { @@ -462,7 +464,6 @@ copy("copy_dart2native") { } copy("copy_gen_kernel_snapshot") { - visibility = [ ":copy_dart2native" ] deps = [ "../utils/gen_kernel" ] sources = [ "$root_gen_dir/gen_kernel.dart.snapshot" ] outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ] @@ -872,7 +873,7 @@ group("create_common_sdk") { # 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") { + if (include_dart2native && dart_target_arch != "ia32") { public_deps += [ ":copy_dart2native" ] } diff --git a/sdk_nnbd/BUILD.gn b/sdk_nnbd/BUILD.gn index 368cc9bee25..5354079d5f6 100644 --- a/sdk_nnbd/BUILD.gn +++ b/sdk_nnbd/BUILD.gn @@ -14,7 +14,6 @@ # fail. import("../build/dart/copy_tree.gni") -import("../build/executable_suffix.gni") import("../runtime/runtime_args.gni") import("../sdk_args.gni") @@ -22,10 +21,13 @@ 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" - dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime_product" - gen_snapshot_stripped_binary = "gen_snapshot_product" + dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime" + gen_snapshot_stripped_binary = "gen_snapshot" } # The directory layout of the SDK is as follows: @@ -37,11 +39,11 @@ declare_args() { # ......dartaotruntime or dartaotruntime.exe (executable) # ......dartdoc # ......dartfmt -# ......dart2native (if not on ia32) +# ......dart2native (if `include_dart2native` and not on ia32) # ......dart2js # ......dartanalyzer # ......dartdevc -# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32) +# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32) # ......pub # ......snapshots/ # ........analysis_server.dart.snapshot @@ -51,8 +53,8 @@ declare_args() { # ........dartdoc.dart.snapshot # ........dartfmt.dart.snapshot # ........dartdevc.dart.snapshot -# ........gen_kernel.dart.snapshot (if not on ia32) -# ........dart2native.dart.snapshot (if not on ia32) +# ........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 # ........frontend_server.dart.snapshot @@ -138,7 +140,7 @@ _platform_sdk_snapshots = [ "../utils/pub", ], ] -if (dart_target_arch != "ia32") { +if (include_dart2native && dart_target_arch != "ia32") { _platform_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -195,7 +197,7 @@ _full_sdk_snapshots = [ "../utils/kernel-service:frontend_server", ], ] -if (dart_target_arch != "ia32") { +if (include_dart2native && dart_target_arch != "ia32") { _full_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -422,32 +424,29 @@ if (target_os != current_os && target_os == "fuchsia") { } copy("copy_dartaotruntime") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/bin:dart_precompiled_runtime_product" ] - src_dir = get_label_info("../runtime/bin:dart_precompiled_runtime_product", - "root_out_dir") - sources = [ - "$src_dir/${dart_precompiled_runtime_stripped_binary}${executable_suffix}", - ] - outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime${executable_suffix}" ] + deps = [ "../runtime/bin:dart_precompiled_runtime" ] + dartaotruntime_out = + get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir") + if (is_win) { + sources = [ "$dartaotruntime_out/dart_precompiled_runtime.exe" ] + outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime.exe" ] + } else { + sources = + [ "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary" ] + outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime" ] + } } copy("copy_gen_snapshot") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/bin:gen_snapshot_product" ] - src_dir = - get_label_info("../runtime/bin:gen_snapshot_product", "root_out_dir") - sources = [ "$src_dir/${gen_snapshot_stripped_binary}${executable_suffix}" ] - outputs = - [ "$root_out_dir/dart-sdk/bin/utils/gen_snapshot${executable_suffix}" ] -} - -copy("copy_vm_platform_strong_product") { - visibility = [ ":copy_dart2native" ] - deps = [ "../runtime/vm:vm_platform_product" ] - src_dir = get_label_info("../runtime/vm:vm_platform_product", "root_out_dir") - sources = [ "$src_dir/vm_platform_strong_product.dill" ] - outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ] + deps = [ "../runtime/bin:gen_snapshot" ] + gen_snapshot_out = + get_label_info("../runtime/bin:gen_snapshot", "root_out_dir") + if (is_win) { + sources = [ "$gen_snapshot_out/gen_snapshot.exe" ] + } else { + sources = [ "$gen_snapshot_out/$gen_snapshot_stripped_binary" ] + } + outputs = [ "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}" ] } copy("copy_dart2native") { @@ -455,7 +454,6 @@ copy("copy_dart2native") { ":copy_dartaotruntime", ":copy_gen_kernel_snapshot", ":copy_gen_snapshot", - ":copy_vm_platform_strong_product", ] ext = "" if (is_win) { @@ -466,7 +464,6 @@ copy("copy_dart2native") { } copy("copy_gen_kernel_snapshot") { - visibility = [ ":copy_dart2native" ] deps = [ "../utils/gen_kernel" ] sources = [ "$root_gen_dir/gen_kernel.dart.snapshot" ] outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ] @@ -893,7 +890,7 @@ group("create_common_sdk") { # 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") { + if (include_dart2native && dart_target_arch != "ia32") { public_deps += [ ":copy_dart2native" ] } diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py index f152233926c..94fe2eaabcf 100755 --- a/tools/bots/dart_sdk.py +++ b/tools/bots/dart_sdk.py @@ -74,6 +74,22 @@ def CreateAndUploadSDKZip(arch, sdk_path): DartArchiveUploadSDKs(BUILD_OS, arch, sdk_zip) +def CopyAotBinaries(arch, sdk_path): + product_sdk_path = BuildRootPath( + 'dart-sdk', arch=arch, build_mode='product') + # We don't support precompilation on ia32. + if arch != 'ia32': + with bot.BuildStep('Patching in PRODUCT built AOT binaries'): + CopyBetween(product_sdk_path, sdk_path, 'bin', 'utils', + GuessExtension('gen_snapshot')) + CopyBetween(product_sdk_path, sdk_path, 'bin', + GuessExtension('dartaotruntime')) + shutil.copy2( + os.path.join(product_sdk_path, 'lib', '_internal', + 'vm_platform_strong.dill'), + os.path.join(sdk_path, 'lib', '_internal', + 'vm_platform_strong_product.dill')) + def DartArchiveUploadSDKs(system, arch, sdk_zip): namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) @@ -245,8 +261,15 @@ if __name__ == '__main__': elif CHANNEL != bot_utils.Channel.TRY: for arch in BuildArchitectures(): sdk_path = BuildRootPath('dart-sdk', arch=arch) + # Patch in all the PRODUCT built AOT binaries. + CopyAotBinaries(arch, sdk_path) with bot.BuildStep('Create and upload sdk zip for ' + arch): CreateAndUploadSDKZip(arch, sdk_path) DartArchiveUnstrippedBinaries() if BUILD_OS == 'linux': CreateUploadVersionFile() + else: # CHANNEL == bot_utils.Channel.TRY + # Patch in all the PRODUCT built AOT binaries. + for arch in BuildArchitectures(): + sdk_path = BuildRootPath('dart-sdk', arch=arch) + CopyAotBinaries(arch, sdk_path) diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index 1c07e067ed9..005734cd11c 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -2742,6 +2742,26 @@ "create_sdk" ] }, + { + "name": "build gen_kernel.dart.snapshot", + "script": "tools/build.py", + "arguments": [ + "--arch=x64,arm,arm64", + "--mode=release", + "copy_gen_kernel_snapshot" + ] + }, + { + "name": "build gen_snapshot and dartaotruntime", + "script": "tools/build.py", + "arguments": [ + "--arch=x64,arm,arm64", + "--mode=product", + "copy_gen_snapshot", + "copy_dartaotruntime", + "copy_vm_dill_files" + ] + }, { "name": "upload sdk", "script": "tools/bots/dart_sdk.py" @@ -2787,6 +2807,26 @@ "create_sdk" ] }, + { + "name": "build gen_kernel.dart.snapshot", + "script": "tools/build.py", + "arguments": [ + "--arch=x64", + "--mode=release", + "copy_gen_kernel_snapshot" + ] + }, + { + "name": "build gen_snapshot and dartaotruntime", + "script": "tools/build.py", + "arguments": [ + "--arch=x64", + "--mode=product", + "copy_gen_snapshot", + "copy_dartaotruntime", + "copy_vm_dill_files" + ] + }, { "name": "upload sdk", "script": "tools/bots/dart_sdk.py" @@ -2818,6 +2858,26 @@ "runtime_kernel" ] }, + { + "name": "build gen_kernel.dart.snapshot", + "script": "tools/build.py", + "arguments": [ + "--arch=x64", + "--mode=release", + "copy_gen_kernel_snapshot" + ] + }, + { + "name": "build gen_snapshot and dartaotruntime", + "script": "tools/build.py", + "arguments": [ + "--arch=x64", + "--mode=product", + "copy_gen_snapshot", + "copy_dartaotruntime", + "copy_vm_dill_files" + ] + }, { "name": "upload sdk", "script": "tools/bots/dart_sdk.py" diff --git a/tools/gn.py b/tools/gn.py index 59d568de216..f0cd314f099 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -226,18 +226,15 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, dont_use_nnbd): gn_args['is_msan'] = sanitizer == 'msan' gn_args['is_tsan'] = sanitizer == 'tsan' gn_args['is_ubsan'] = sanitizer == 'ubsan' + gn_args['include_dart2native'] = True gn_args['is_qemu'] = args.use_qemu if not args.platform_sdk and not gn_args['target_cpu'].startswith('arm'): gn_args['dart_platform_sdk'] = args.platform_sdk - - # We don't support stripping on Windows - if host_os != 'win': - gn_args['dart_stripped_binary'] = 'exe.stripped/dart' - gn_args['dart_precompiled_runtime_stripped_binary'] = ( - 'exe.stripped/dart_precompiled_runtime_product') - gn_args['gen_snapshot_stripped_binary'] = ( - 'exe.stripped/gen_snapshot_product') + gn_args['dart_stripped_binary'] = 'exe.stripped/dart' + 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. if UseSysroot(args, gn_args): diff --git a/tools/linux_dist_support/debian/rules b/tools/linux_dist_support/debian/rules index da3ff23f99b..c6893d78b34 100755 --- a/tools/linux_dist_support/debian/rules +++ b/tools/linux_dist_support/debian/rules @@ -36,6 +36,22 @@ endif endif endif +# Only run AOT builds for supported archs. +ifneq (,$(findstring $(DEB_HOST_ARCH_CPU),$(AOT_SUPPORTED_ARCHS))) +AOT_BUILD_CMD := \ +python tools/build.py -v -m release -a $(ARCH) $(TOOLCHAIN) \ + copy_gen_kernel_snapshot; \ +python tools/build.py -v -m product -a $(ARCH) $(TOOLCHAIN) \ + copy_gen_snapshot copy_dartaotruntime; \ +mkdir -p out/$(BUILD_TYPE)/dart-sdk/bin/utils; \ +cp out/$(BUILD_TYPE_PRODUCT)/dart-sdk/bin/utils/gen_snapshot \ + out/$(BUILD_TYPE)/dart-sdk/bin/utils/gen_snapshot; \ +cp out/$(BUILD_TYPE_PRODUCT)/dart-sdk/bin/dartaotruntime \ + out/$(BUILD_TYPE)/dart-sdk/bin/dartaotruntime +else +AOT_BUILD_CMD := # empty +endif + # Verbose? ifeq (1,$(DH_VERBOSE)) BUILD_ARGS += V=1 @@ -58,6 +74,7 @@ override_dh_auto_configure: override_dh_auto_build: cd dart; \ python tools/build.py -v -m release -a $(ARCH) $(TOOLCHAIN) create_sdk; \ + $(AOT_BUILD_CMD); \ cd .. # Building the Dart SDK will already strip all binaries.