[gn] Clean up some vestiges of building in the Fuchsia tree

Part of https://github.com/flutter/flutter/issues/144430

Change-Id: I6103f5a7fec76b82209845cb027c23bdb86da5ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355624
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Zach Anderson 2024-03-05 15:02:49 +00:00 committed by Commit Queue
parent 6d69d56307
commit bcb253faf9
2 changed files with 46 additions and 106 deletions

View file

@ -3,13 +3,6 @@
# BSD-style license that can be found in the LICENSE file.
import("../executable_suffix.gni")
import("prebuilt_dart_sdk.gni")
_is_fuchsia = defined(is_fuchsia_tree) && is_fuchsia_tree
if (_is_fuchsia) {
import("//build/dart/dart.gni")
}
# This file defines templates for running and compiling Dart code during
# Dart's build.
@ -99,8 +92,6 @@ template("_compiled_action") {
template("_prebuilt_tool_action") {
assert(defined(invoker.binary),
"The path to where the prebuilt binary lives must be defined")
assert(_is_fuchsia || prebuilt_dart_exe_works,
"A pre built dart executable needs to be present")
vm_args = []
if (defined(invoker.vm_args)) {
@ -180,22 +171,8 @@ template("prebuilt_dart_action") {
_prebuilt_tool_action(target_name) {
forward_variables_from(invoker, "*")
if (_is_fuchsia) {
binary = prebuilt_dart
dfe = "$prebuilt_dart_sdk/bin/snapshots/kernel-service.dart.snapshot"
} else {
binary = "$_dart_root/tools/sdks/dart-sdk/bin/dart$executable_suffix"
dfe = "$_dart_root/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot"
}
}
}
if (_is_fuchsia) {
template("_prebuilt_gen_snapshot_action") {
_prebuilt_tool_action(target_name) {
forward_variables_from(invoker, "*")
binary = prebuilt_gen_snapshot
}
binary = "$_dart_root/tools/sdks/dart-sdk/bin/dart$executable_suffix"
dfe = "$_dart_root/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot"
}
}
@ -298,39 +275,33 @@ template("_built_tool_action") {
# visibility
template("dart_action") {
assert(defined(invoker.script), "script must be defined for $target_name")
if (!_is_fuchsia || !use_prebuilt_dart_sdk) {
_built_tool_action(target_name) {
tool = "$_dart_root/runtime/bin:dart"
forward_variables_from(invoker,
[
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"pool",
"script",
"testonly",
"tool",
"visibility",
"vm_args",
])
_built_tool_action(target_name) {
tool = "$_dart_root/runtime/bin:dart"
forward_variables_from(invoker,
[
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"pool",
"script",
"testonly",
"tool",
"visibility",
"vm_args",
])
# Dart has an implicit dependency on the kernel service so unless DFE is
# passed, we need to add this dep.
if (defined(invoker.dfe)) {
vm_args += [ "--dfe=" + rebase_path(invoker.dfe, root_build_dir) ]
} else {
if (!defined(invoker.deps)) {
deps = []
}
deps += [ "$_dart_root/utils/kernel-service:kernel-service" ]
# Dart has an implicit dependency on the kernel service so unless DFE is
# passed, we need to add this dep.
if (defined(invoker.dfe)) {
vm_args += [ "--dfe=" + rebase_path(invoker.dfe, root_build_dir) ]
} else {
if (!defined(invoker.deps)) {
deps = []
}
}
} else {
prebuilt_dart_action(target_name) {
forward_variables_from(invoker, "*")
deps += [ "$_dart_root/utils/kernel-service:kernel-service" ]
}
}
}
@ -365,31 +336,25 @@ template("gen_snapshot_action") {
assert(
!defined(invoker.script),
"script must not be defined for $target_name. If there is a script use args instead.")
if (!_is_fuchsia || !use_prebuilt_dart_sdk) {
_built_tool_action(target_name) {
if (product_mode) {
tool = "$_dart_root/runtime/bin:gen_snapshot_product"
} else {
tool = "$_dart_root/runtime/bin:gen_snapshot"
}
forward_variables_from(invoker,
[
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"pool",
"testonly",
"tool",
"visibility",
"vm_args",
])
}
} else {
_prebuilt_gen_snapshot_action(target_name) {
forward_variables_from(invoker, "*")
_built_tool_action(target_name) {
if (product_mode) {
tool = "$_dart_root/runtime/bin:gen_snapshot_product"
} else {
tool = "$_dart_root/runtime/bin:gen_snapshot"
}
forward_variables_from(invoker,
[
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"pool",
"testonly",
"tool",
"visibility",
"vm_args",
])
}
}

View file

@ -1,25 +0,0 @@
# Copyright (c) 2016, 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.
import("../executable_suffix.gni")
_dart_root = rebase_path("../..")
_prebuilt_dart_exe =
"$_dart_root/tools/sdks/dart-sdk/bin/dart$executable_suffix"
# When the first argument is "exec_script", gn_run_binary.py always exits with
# status 0, but gives non-empty output when the command it is given fails.
_prebuilt_dart_exe_trial = exec_script("../gn_run_binary.py",
[
"exec_script",
_prebuilt_dart_exe,
"--version",
],
"string")
if (_prebuilt_dart_exe_trial == "") {
prebuilt_dart_exe_works = true
} else {
prebuilt_dart_exe_works = false
}