From a88a328b7f5afb887baee0e5d7c2db681e52efd6 Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Mon, 15 Jun 2020 15:17:35 +0000 Subject: [PATCH] [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 --- 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, 194 insertions(+), 199 deletions(-) diff --git a/pkg/dart2native/bin/dart2native.dart b/pkg/dart2native/bin/dart2native.dart index bfe7ec8fe56..19015f6e88b 100644 --- a/pkg/dart2native/bin/dart2native.dart +++ b/pkg/dart2native/bin/dart2native.dart @@ -19,8 +19,6 @@ 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'); @@ -45,20 +43,8 @@ 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, - platformFileToUse, sourceFile, kernelFile, packages, defines); + productPlatformDill, 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 34e123818ae..bbabc7cd05e 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -40,8 +40,16 @@ 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 3ec3471714a..427fe0bfc31 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -69,6 +69,7 @@ build_libdart_builtin("libdart_builtin_product") { extra_configs = [ "..:dart_product_config", "..:dart_os_config", + "..:dart_arch_config", ] } @@ -136,7 +137,11 @@ template("build_elf_loader") { } build_elf_loader("elf_loader") { - deps = [ ":libdart_builtin" ] + if (dart_runtime_mode == "release") { + deps = [ ":libdart_builtin_product" ] + } else { + deps = [ ":libdart_builtin" ] + } } build_elf_loader("elf_loader_product") { @@ -512,6 +517,12 @@ 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" @@ -732,6 +743,11 @@ 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 @@ -761,8 +777,12 @@ 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 @@ -775,12 +795,17 @@ template("dart_executable") { } deps = [ - ":standalone_dart_io", - "//third_party/boringssl", - "//third_party/zlib", - ":crashpad", - ":generate_abi_version_cc_file", - ] + extra_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 defines = extra_defines if (exclude_kernel_service) { @@ -888,6 +913,27 @@ 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 971d24220ef..94ee5d3fd23 100644 --- a/runtime/configs.gni +++ b/runtime/configs.gni @@ -66,66 +66,77 @@ _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 }, ] @@ -174,6 +185,14 @@ 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, @@ -196,6 +215,11 @@ 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 e7908684c56..b16ec11c3c7 100644 --- a/runtime/third_party/double-conversion/src/BUILD.gn +++ b/runtime/third_party/double-conversion/src/BUILD.gn @@ -3,6 +3,12 @@ # 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 395b15fbc3f..c35366cc7d1 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -63,7 +63,14 @@ config("libdart_vm_config") { library_for_all_configs("libdart_vm") { target_type = "source_set" - extra_deps = [ "//third_party/icu" ] + 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", + ] if (is_fuchsia) { if (using_fuchsia_sdk) { extra_deps += [ @@ -147,6 +154,10 @@ 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)) { @@ -166,7 +177,6 @@ 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", @@ -193,6 +203,16 @@ 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 812565a0373..7a5a283e3e9 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -14,6 +14,7 @@ # fail. import("../build/dart/copy_tree.gni") +import("../build/executable_suffix.gni") import("../runtime/runtime_args.gni") import("../sdk_args.gni") @@ -21,13 +22,10 @@ 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" - gen_snapshot_stripped_binary = "gen_snapshot" + dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime_product" + gen_snapshot_stripped_binary = "gen_snapshot_product" } # The directory layout of the SDK is as follows: @@ -39,11 +37,11 @@ declare_args() { # ......dartaotruntime or dartaotruntime.exe (executable) # ......dartdoc # ......dartfmt -# ......dart2native (if `include_dart2native` and not on ia32) +# ......dart2native (if not on ia32) # ......dart2js # ......dartanalyzer # ......dartdevc -# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32) +# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32) # ......pub # ......snapshots/ # ........analysis_server.dart.snapshot @@ -53,8 +51,8 @@ declare_args() { # ........dartdoc.dart.snapshot # ........dartfmt.dart.snapshot # ........dartdevc.dart.snapshot -# ........gen_kernel.dart.snapshot (if `include_dart2native` and not on ia32) -# ........dart2native.dart.snapshot (if `include_dart2native` and not on ia32) +# ........gen_kernel.dart.snapshot (if not on ia32) +# ........dart2native.dart.snapshot (if not on ia32) # ........kernel_worker.dart.snapshot # ........pub.dart.snapshot # ........frontend_server.dart.snapshot @@ -140,7 +138,7 @@ _platform_sdk_snapshots = [ "../utils/pub", ], ] -if (include_dart2native && dart_target_arch != "ia32") { +if (dart_target_arch != "ia32") { _platform_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -197,7 +195,7 @@ _full_sdk_snapshots = [ "../utils/kernel-service:frontend_server", ], ] -if (include_dart2native && dart_target_arch != "ia32") { +if (dart_target_arch != "ia32") { _full_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -411,11 +409,7 @@ 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") - if (is_win) { - sources = [ "$dart_out/dart.exe" ] - } else { - sources = [ "$dart_out/$dart_stripped_binary" ] - } + sources = [ "$dart_out/${dart_stripped_binary}${executable_suffix}" ] if (is_win) { sources += [ "$dart_out/dart.lib" ] } @@ -424,29 +418,32 @@ if (target_os != current_os && target_os == "fuchsia") { } copy("copy_dartaotruntime") { - 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" ] - } + 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}" ] } copy("copy_gen_snapshot") { - 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}}" ] + 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}}" ] } copy("copy_dart2native") { @@ -454,6 +451,7 @@ copy("copy_dart2native") { ":copy_dartaotruntime", ":copy_gen_kernel_snapshot", ":copy_gen_snapshot", + ":copy_vm_platform_strong_product", ] ext = "" if (is_win) { @@ -464,6 +462,7 @@ 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}}" ] @@ -873,7 +872,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 (include_dart2native && dart_target_arch != "ia32") { + if (dart_target_arch != "ia32") { public_deps += [ ":copy_dart2native" ] } diff --git a/sdk_nnbd/BUILD.gn b/sdk_nnbd/BUILD.gn index 5354079d5f6..368cc9bee25 100644 --- a/sdk_nnbd/BUILD.gn +++ b/sdk_nnbd/BUILD.gn @@ -14,6 +14,7 @@ # fail. import("../build/dart/copy_tree.gni") +import("../build/executable_suffix.gni") import("../runtime/runtime_args.gni") import("../sdk_args.gni") @@ -21,13 +22,10 @@ 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" - gen_snapshot_stripped_binary = "gen_snapshot" + dart_precompiled_runtime_stripped_binary = "dart_precompiled_runtime_product" + gen_snapshot_stripped_binary = "gen_snapshot_product" } # The directory layout of the SDK is as follows: @@ -39,11 +37,11 @@ declare_args() { # ......dartaotruntime or dartaotruntime.exe (executable) # ......dartdoc # ......dartfmt -# ......dart2native (if `include_dart2native` and not on ia32) +# ......dart2native (if not on ia32) # ......dart2js # ......dartanalyzer # ......dartdevc -# ......utils/gen_snapshot or utils/gen_snapshot.exe (if `include_dart2native` and not on ia32) +# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32) # ......pub # ......snapshots/ # ........analysis_server.dart.snapshot @@ -53,8 +51,8 @@ declare_args() { # ........dartdoc.dart.snapshot # ........dartfmt.dart.snapshot # ........dartdevc.dart.snapshot -# ........gen_kernel.dart.snapshot (if `include_dart2native` and not on ia32) -# ........dart2native.dart.snapshot (if `include_dart2native` and not on ia32) +# ........gen_kernel.dart.snapshot (if not on ia32) +# ........dart2native.dart.snapshot (if not on ia32) # ........kernel_worker.dart.snapshot # ........pub.dart.snapshot # ........frontend_server.dart.snapshot @@ -140,7 +138,7 @@ _platform_sdk_snapshots = [ "../utils/pub", ], ] -if (include_dart2native && dart_target_arch != "ia32") { +if (dart_target_arch != "ia32") { _platform_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -197,7 +195,7 @@ _full_sdk_snapshots = [ "../utils/kernel-service:frontend_server", ], ] -if (include_dart2native && dart_target_arch != "ia32") { +if (dart_target_arch != "ia32") { _full_sdk_snapshots += [ [ "dart2native", "../utils/dart2native:generate_dart2native_snapshot", @@ -424,29 +422,32 @@ if (target_os != current_os && target_os == "fuchsia") { } copy("copy_dartaotruntime") { - 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" ] - } + 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}" ] } copy("copy_gen_snapshot") { - 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}}" ] + 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}}" ] } copy("copy_dart2native") { @@ -454,6 +455,7 @@ copy("copy_dart2native") { ":copy_dartaotruntime", ":copy_gen_kernel_snapshot", ":copy_gen_snapshot", + ":copy_vm_platform_strong_product", ] ext = "" if (is_win) { @@ -464,6 +466,7 @@ 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}}" ] @@ -890,7 +893,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 (include_dart2native && dart_target_arch != "ia32") { + if (dart_target_arch != "ia32") { public_deps += [ ":copy_dart2native" ] } diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py index 94fe2eaabcf..f152233926c 100755 --- a/tools/bots/dart_sdk.py +++ b/tools/bots/dart_sdk.py @@ -74,22 +74,6 @@ 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) @@ -261,15 +245,8 @@ 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 31eea7f3b7f..7aa3a63e804 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -2732,26 +2732,6 @@ "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" @@ -2797,26 +2777,6 @@ "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" @@ -2848,26 +2808,6 @@ "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 f0cd314f099..59d568de216 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -226,15 +226,18 @@ 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 - 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' + + # 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') # 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 c6893d78b34..da3ff23f99b 100755 --- a/tools/linux_dist_support/debian/rules +++ b/tools/linux_dist_support/debian/rules @@ -36,22 +36,6 @@ 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 @@ -74,7 +58,6 @@ 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.