dart-sdk/runtime/observatory/BUILD.gn
Zachary Anderson a99cdabd00 Reland: [GN] Adds dart_host_sdk_toolchain argument
Setting this build argument to something other than host_toolchain will
cause the build target create_host_sdk to be exposed. That target will
build the Dart SDK with the toolchain specified by
dart_host_sdk_toolchain.

Relanding to fix bad toolchain conditions in dart_os_config and
dart_arch_config.

TO-549

Change-Id: I276f47d9071233acb98f6029a4666da0cee33d7d
Reviewed-on: https://dart-review.googlesource.com/18361
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-02 19:02:18 +00:00

217 lines
5.6 KiB
Text

# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../build/dart_host_sdk_toolchain.gni")
import("../../build/executable_suffix.gni")
import("../../build/prebuilt_dart_sdk.gni")
import("observatory_sources.gni")
# Construct arguments to the observatory tool for finding pub.
pub_build_deps = []
pub_build_args = []
if (!prebuilt_dart_exe_works) {
pub_build_deps += [ "../bin:dart_bootstrap($dart_host_toolchain)" ]
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 = [
"--sdk=True",
"--dart-executable",
dart_bootstrap,
]
} else {
pub_build_args = [ "--sdk=True" ]
}
current_dir = rebase_path(".", "//")
# Helper build rules for packaging the Dart observatory resources.
copy("copy_observatory") {
sources = rebase_path(observatory_sources, "", ".")
outputs = [
"$root_gen_dir/observatory_copy/{{source_root_relative_dir}}/{{source_file_part}}",
]
}
action("write_observatory_pubspec_yaml") {
deps = [ ":copy_observatory" ] + pub_build_deps
inputs = [
rebase_path("pubspec.yaml"),
]
script = "../../tools/observatory_tool.py"
args =
pub_build_args + [
"--silent=True",
"--directory",
rebase_path("$root_gen_dir/observatory_copy/$current_dir/"),
"--command",
"rewrite",
rebase_path("../observatory/pubspec.yaml"),
rebase_path("$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml"),
"../../third_party/",
rebase_path("../../third_party/"),
]
outputs = [
"$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml",
]
}
action("copy_observatory_deps") {
deps = [ ":write_observatory_pubspec_yaml" ] + pub_build_deps
inputs = [
"$root_gen_dir/observatory_copy/$current_dir/pubspec.yaml",
]
script = "../../tools/observatory_tool.py"
args = pub_build_args + [
"--silent=True",
"--stamp",
rebase_path(
"$root_gen_dir/observatory_copy/$current_dir/packages.stamp"),
"--directory",
rebase_path("$root_gen_dir/observatory_copy/$current_dir/"),
"--command",
"get",
]
outputs = [
"$root_gen_dir/observatory_copy/$current_dir/packages.stamp",
]
}
action("pub_build_observatory") {
deps = [
":copy_observatory",
":copy_observatory_deps",
] + pub_build_deps
sources = rebase_path(observatory_sources,
"",
"$root_gen_dir/observatory_copy/$current_dir")
inputs =
sources + [ "$root_gen_dir/observatory_copy/$current_dir/packages.stamp" ]
script = "../../tools/observatory_tool.py"
args = pub_build_args + [
"--silent=True",
"--directory",
rebase_path("$root_gen_dir/observatory_copy/$current_dir/"),
"--command",
"build",
rebase_path("$root_out_dir/observatory/build"),
]
outputs = [
"$root_out_dir/observatory/build/web/main.dart.js",
]
}
action("deploy_observatory") {
deps = [ ":pub_build_observatory" ] + pub_build_deps
script = "../../tools/observatory_tool.py"
inputs = [
script,
"$root_out_dir/observatory/build/web/main.dart.js",
]
args = pub_build_args + [
"--silent=True",
"--directory",
rebase_path("$root_out_dir/observatory"),
"--command",
"deploy",
]
outputs = [
"$root_out_dir/observatory/deployed/web/main.dart.js",
]
}
template("observatory_archive") {
assert(defined(invoker.inner_namespace),
"Need inner_namespace in $target_name")
assert(defined(invoker.outer_namespace),
"Need outer_namespace in $target_name")
enable_compression = false
if (defined(invoker.compress) && invoker.compress) {
enable_compression = true
}
action(target_name) {
deps = [
":deploy_observatory",
]
inputs = [
"$root_out_dir/observatory/deployed/web/main.dart.js",
]
inner_namespace = invoker.inner_namespace
outer_namespace = invoker.outer_namespace
output_name = target_name
script = "../tools/create_archive.py"
args = [
"--output",
rebase_path("$root_gen_dir/observatory/${output_name}.cc"),
"--tar_output",
rebase_path("$root_gen_dir/observatory/${output_name}.tar"),
"--outer_namespace",
outer_namespace,
"--inner_namespace",
inner_namespace,
"--name",
"observatory_assets_archive",
"--client_root",
rebase_path("$root_out_dir/observatory/deployed/web/"),
]
if (enable_compression) {
args += [ "--compress" ]
}
outputs = [
"$root_gen_dir/observatory/${output_name}.cc",
"$root_gen_dir/observatory/${output_name}.tar",
]
}
}
observatory_archive("embedded_archive_observatory") {
outer_namespace = "dart"
inner_namespace = "observatory"
}
source_set("embedded_observatory_archive") {
deps = [
":embedded_archive_observatory",
]
sources = [
rebase_path("$root_gen_dir/observatory/embedded_archive_observatory.cc"),
]
}
observatory_archive("standalone_archive_observatory") {
compress = true
outer_namespace = "dart"
inner_namespace = "bin"
}
source_set("standalone_observatory_archive") {
deps = [
":standalone_archive_observatory",
]
sources = [
rebase_path("$root_gen_dir/observatory/standalone_archive_observatory.cc"),
]
}