Reapply "Switch on building devtools from source when building the Dart SDK"

This reverts commit 2a93a26d91, which a change to use `defined` so that the GN script does not crash in
Flutter.

Fixes flutter/devtools#9786

See go/moving-devtools-to-dart-sdk-2025.

In this change, we make the source of devtools be configurable, in
actions like build_sdk.

If `build_devtools_from_sources` is true, we build local devtools,
and if false, we continue to use the prebuilt sources.

This may be an intermediate step, while we test out building devtools
from source. Or it may be permanently be a choice, if we keep building
with CIPD.

Change-Id: I9d509b07971942f2c4884224a6efda9001522bd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502120
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2026-05-19 20:55:22 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent efd30a2de0
commit 3de2ddee09
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -13,6 +13,7 @@
# or ":copy_libraries" may delete/overwrite your addition, and the build will
# fail.
import("../build/config/gclient_args.gni")
import("../build/dart/copy_tree.gni")
import("../build/executable_suffix.gni")
import("../sdk_args.gni")
@@ -310,7 +311,8 @@ copy_tree("copy_prebuilt_devtools") {
# This action compiles the devtools app from sources.
action("build_devtools") {
output = "$root_out_dir/$dart_sdk_output/web/devtools_app"
visibility = [ ":create_common_sdk" ]
output = "$root_out_dir/$dart_sdk_output/bin/resources/devtools"
outputs = [ output ]
script = "../tools/build_devtools.py"
args = [
@@ -897,7 +899,6 @@ group("create_common_sdk") {
":copy_headers",
":copy_libraries_specification",
":copy_license",
":copy_prebuilt_devtools",
":copy_readme",
":copy_sdk_packages_yaml",
":copy_vm_dill_files",
@@ -907,6 +908,12 @@ group("create_common_sdk") {
":write_version_file",
]
if (defined(build_devtools_from_sources) && build_devtools_from_sources) {
public_deps += [ ":build_devtools" ]
} else {
public_deps += [ ":copy_prebuilt_devtools" ]
}
# We do not support AOT on ia32 and should therefore not add the
# dart native compilation files since there is no AOT compiler/runtime
# available.