diff --git a/build/compiled_action.gni b/build/compiled_action.gni index e4e999ac576..228378dc8a9 100644 --- a/build/compiled_action.gni +++ b/build/compiled_action.gni @@ -66,6 +66,8 @@ # saves unnecessarily compiling your tool for the target platform. But if you # need a target build of your tool as well, just leave off the if statement. +import("dart_host_toolchain.gni") + if (host_os == "win") { _host_executable_suffix = ".exe" } else { @@ -97,7 +99,7 @@ template("compiled_action") { outputs = invoker.outputs # Constuct the host toolchain version of the tool. - host_tool = invoker.tool + "($host_toolchain)" + host_tool = invoker.tool + "($dart_host_toolchain)" # Get the path to the executable. Currently, this assumes that the tool # does not specify output_name so that the target name is the name to use. @@ -150,7 +152,7 @@ template("compiled_action_foreach") { outputs = invoker.outputs # Constuct the host toolchain version of the tool. - host_tool = invoker.tool + "($host_toolchain)" + host_tool = invoker.tool + "($dart_host_toolchain)" # Get the path to the executable. Currently, this assumes that the tool # does not specify output_name so that the target name is the name to use. diff --git a/build/dart_host_toolchain.gni b/build/dart_host_toolchain.gni new file mode 100644 index 00000000000..4100d513b0a --- /dev/null +++ b/build/dart_host_toolchain.gni @@ -0,0 +1,13 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +declare_args() { + # This argument allows to override host_toolchain used to build dart artifacts. + # This is needed to make sure that word size of the code produced on host + # machine matches word size of target architecture. For example, when + # targeting android arm 32-bit while building on linux 64-bit machine, dart vm + # that is used to produce snapshots for that android arm 32, has to be built + # using linux 32-bit toolchain. + dart_host_toolchain = host_toolchain +} diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn index 969d9ee9e5c..a799aa2e2ae 100644 --- a/runtime/observatory/BUILD.gn +++ b/runtime/observatory/BUILD.gn @@ -4,6 +4,7 @@ import("../../build/executable_suffix.gni") import("../../build/prebuilt_dart_sdk.gni") +import("../../build/dart_host_toolchain.gni") # Currently paths here are hard coded for convenience in building Mojo/Flutter. declare_args() { @@ -40,10 +41,10 @@ if (dart_host_pub_exe != "") { dart_host_pub_exe, ] } else if (!prebuilt_dart_exe_works) { - pub_build_deps += [ "../bin:dart_bootstrap($host_toolchain)" ] + pub_build_deps += [ "../bin:dart_bootstrap($dart_host_toolchain)" ] - dart_out_dir = - get_label_info("../bin:dart_bootstrap($host_toolchain)", "root_out_dir") + dart_out_dir = get_label_info("../bin:dart_bootstrap($dart_host_toolchain)", + "root_out_dir") dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix") pub_build_args = [ diff --git a/tools/patch_sdk.py b/tools/patch_sdk.py index 212514a8190..25e553ed8a4 100755 --- a/tools/patch_sdk.py +++ b/tools/patch_sdk.py @@ -48,8 +48,7 @@ def main(): print >> sys.stderr, 'ERROR: cannot locate dart executable' return -1 dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart') - subprocess.check_call( - [options.dart_executable, '--checked', dart_file] + args) + subprocess.check_call([options.dart_executable, dart_file] + args) return 0 if __name__ == '__main__': diff --git a/utils/generate_patch_sdk.gni b/utils/generate_patch_sdk.gni index 4fd74a1c9b8..2009bffc62f 100644 --- a/utils/generate_patch_sdk.gni +++ b/utils/generate_patch_sdk.gni @@ -3,6 +3,7 @@ # BSD-style license that can be found in the LICENSE file. import("../build/prebuilt_dart_sdk.gni") +import("../build/dart_host_toolchain.gni") _dart_root = get_path_info("..", "abspath") @@ -28,7 +29,7 @@ template("generate_patched_sdk") { } if (!prebuilt_dart_exe_works) { - deps += [ "$_dart_root/runtime/bin:dart_bootstrap($host_toolchain)" ] + deps += [ "$_dart_root/runtime/bin:dart_bootstrap_host_arch($dart_host_toolchain)" ] } script = "$_dart_root/tools/patch_sdk.py" @@ -49,7 +50,7 @@ template("generate_patched_sdk") { args = [ "--quiet" ] if (!prebuilt_dart_exe_works) { dart_out_dir = get_label_info( - "$_dart_root/runtime/bin:dart_bootstrap($host_toolchain)", + "$_dart_root/runtime/bin:dart_bootstrap_host_arch($dart_host_toolchain)", "root_out_dir") dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix") diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index f62e0642a82..88ef85a3514 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -3,11 +3,12 @@ # BSD-style license that can be found in the LICENSE file. import("../application_snapshot.gni") +import("../../build/dart_host_toolchain.gni") application_snapshot("kernel-service") { dfe_script = "kernel-service.dart" deps = [ - "../../runtime/vm:patched_sdk($host_toolchain)", + "../../runtime/vm:patched_sdk($dart_host_toolchain)", ] main_dart = dfe_script training_args = [