mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 13:47:50 +00:00
Introduce dart_host_toolchain argument for generate_patch_sdk.gni. This allows for Flutter build to make sure that host_toolchain used for patched_sdk generation word size matches target platform.
Flutter Dart in product configuration doesn't allow --checked option. So remove '--checked' from invocation. R=rmacnak@google.com BUG:https://github.com/flutter/flutter/issues/10841 Review-Url: https://codereview.chromium.org/2944103003 .
This commit is contained in:
parent
dd0a00f581
commit
8cd713bed3
|
@ -66,6 +66,8 @@
|
||||||
# saves unnecessarily compiling your tool for the target platform. But if you
|
# 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.
|
# need a target build of your tool as well, just leave off the if statement.
|
||||||
|
|
||||||
|
import("dart_host_toolchain.gni")
|
||||||
|
|
||||||
if (host_os == "win") {
|
if (host_os == "win") {
|
||||||
_host_executable_suffix = ".exe"
|
_host_executable_suffix = ".exe"
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,7 +99,7 @@ template("compiled_action") {
|
||||||
outputs = invoker.outputs
|
outputs = invoker.outputs
|
||||||
|
|
||||||
# Constuct the host toolchain version of the tool.
|
# 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
|
# 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.
|
# 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
|
outputs = invoker.outputs
|
||||||
|
|
||||||
# Constuct the host toolchain version of the tool.
|
# 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
|
# 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.
|
# does not specify output_name so that the target name is the name to use.
|
||||||
|
|
13
build/dart_host_toolchain.gni
Normal file
13
build/dart_host_toolchain.gni
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import("../../build/executable_suffix.gni")
|
import("../../build/executable_suffix.gni")
|
||||||
import("../../build/prebuilt_dart_sdk.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.
|
# Currently paths here are hard coded for convenience in building Mojo/Flutter.
|
||||||
declare_args() {
|
declare_args() {
|
||||||
|
@ -40,10 +41,10 @@ if (dart_host_pub_exe != "") {
|
||||||
dart_host_pub_exe,
|
dart_host_pub_exe,
|
||||||
]
|
]
|
||||||
} else if (!prebuilt_dart_exe_works) {
|
} 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 =
|
dart_out_dir = get_label_info("../bin:dart_bootstrap($dart_host_toolchain)",
|
||||||
get_label_info("../bin:dart_bootstrap($host_toolchain)", "root_out_dir")
|
"root_out_dir")
|
||||||
dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
dart_bootstrap = rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
||||||
|
|
||||||
pub_build_args = [
|
pub_build_args = [
|
||||||
|
|
|
@ -48,8 +48,7 @@ def main():
|
||||||
print >> sys.stderr, 'ERROR: cannot locate dart executable'
|
print >> sys.stderr, 'ERROR: cannot locate dart executable'
|
||||||
return -1
|
return -1
|
||||||
dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart')
|
dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart')
|
||||||
subprocess.check_call(
|
subprocess.check_call([options.dart_executable, dart_file] + args)
|
||||||
[options.dart_executable, '--checked', dart_file] + args)
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import("../build/prebuilt_dart_sdk.gni")
|
import("../build/prebuilt_dart_sdk.gni")
|
||||||
|
import("../build/dart_host_toolchain.gni")
|
||||||
|
|
||||||
_dart_root = get_path_info("..", "abspath")
|
_dart_root = get_path_info("..", "abspath")
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ template("generate_patched_sdk") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
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"
|
script = "$_dart_root/tools/patch_sdk.py"
|
||||||
|
@ -49,7 +50,7 @@ template("generate_patched_sdk") {
|
||||||
args = [ "--quiet" ]
|
args = [ "--quiet" ]
|
||||||
if (!prebuilt_dart_exe_works) {
|
if (!prebuilt_dart_exe_works) {
|
||||||
dart_out_dir = get_label_info(
|
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")
|
"root_out_dir")
|
||||||
dart_bootstrap =
|
dart_bootstrap =
|
||||||
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import("../application_snapshot.gni")
|
import("../application_snapshot.gni")
|
||||||
|
import("../../build/dart_host_toolchain.gni")
|
||||||
|
|
||||||
application_snapshot("kernel-service") {
|
application_snapshot("kernel-service") {
|
||||||
dfe_script = "kernel-service.dart"
|
dfe_script = "kernel-service.dart"
|
||||||
deps = [
|
deps = [
|
||||||
"../../runtime/vm:patched_sdk($host_toolchain)",
|
"../../runtime/vm:patched_sdk($dart_host_toolchain)",
|
||||||
]
|
]
|
||||||
main_dart = dfe_script
|
main_dart = dfe_script
|
||||||
training_args = [
|
training_args = [
|
||||||
|
|
Loading…
Reference in a new issue