9847c06e76
Change-Id: I165d5391f8ae36ec4201d25907c90a526d8b8c6b Reviewed-on: https://dart-review.googlesource.com/58360 Commit-Queue: Zach Anderson <zra@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
252 lines
6.2 KiB
Plaintext
252 lines
6.2 KiB
Plaintext
# 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/dart_host_sdk_toolchain.gni")
|
|
import("../../build/dart/prebuilt_dart_sdk.gni")
|
|
import("../../build/executable_suffix.gni")
|
|
import("observatory_sources.gni")
|
|
|
|
# Construct arguments to the observatory tool for finding pub.
|
|
build_deps = []
|
|
build_args = []
|
|
if (!prebuilt_dart_exe_works) {
|
|
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")
|
|
|
|
build_args = [
|
|
"--sdk=True",
|
|
"--dart-executable",
|
|
dart_bootstrap,
|
|
]
|
|
} else {
|
|
build_args = [ "--sdk=True" ]
|
|
}
|
|
|
|
current_dir = rebase_path(".", "//")
|
|
|
|
action("build_observatory") {
|
|
deps = build_deps
|
|
|
|
sources = rebase_path(observatory_sources, "", ".")
|
|
|
|
inputs = sources + [ rebase_path("dart2js.packages") ]
|
|
|
|
script = "../../tools/observatory_tool.py"
|
|
args = build_args + [
|
|
"--silent=True",
|
|
"--directory",
|
|
rebase_path("."),
|
|
"--command",
|
|
"build",
|
|
rebase_path("web/main.dart"),
|
|
rebase_path("$target_gen_dir/observatory/web/main.dart.js"),
|
|
rebase_path("dart2js.packages"),
|
|
]
|
|
|
|
outputs = [
|
|
"$target_gen_dir/observatory/web/main.dart.js",
|
|
]
|
|
}
|
|
|
|
action("deploy_observatory") {
|
|
deps = [ ":build_observatory" ] + build_deps
|
|
|
|
script = "../../tools/observatory_tool.py"
|
|
|
|
inputs = [
|
|
script,
|
|
"$target_gen_dir/observatory/web/main.dart.js",
|
|
]
|
|
|
|
args = build_args + [
|
|
"--silent=True",
|
|
"--directory",
|
|
rebase_path("$target_out_dir/observatory"),
|
|
"--command",
|
|
"deploy",
|
|
rebase_path("$target_out_dir/observatory/deployed"),
|
|
rebase_path("web"),
|
|
rebase_path("lib"),
|
|
rebase_path("$target_gen_dir/observatory/web/main.dart.js"),
|
|
rebase_path("../../third_party/observatory_pub_packages/packages"),
|
|
]
|
|
|
|
outputs = [
|
|
"$target_out_dir/observatory/deployed/web/main.dart.js",
|
|
]
|
|
}
|
|
|
|
template("observatory_archive") {
|
|
enable_compression = false
|
|
if (defined(invoker.compress) && invoker.compress) {
|
|
enable_compression = true
|
|
}
|
|
action(target_name) {
|
|
deps = [
|
|
":deploy_observatory",
|
|
]
|
|
|
|
inputs = [
|
|
"$target_out_dir/observatory/deployed/web/main.dart.js",
|
|
]
|
|
|
|
output_name = target_name
|
|
|
|
output = "$target_gen_dir/${output_name}.tar"
|
|
outputs = [
|
|
output,
|
|
]
|
|
|
|
script = "../tools/create_archive.py"
|
|
args = [
|
|
"--tar_output",
|
|
rebase_path(output),
|
|
"--client_root",
|
|
rebase_path("$target_out_dir/observatory/deployed/web/"),
|
|
]
|
|
if (enable_compression) {
|
|
args += [ "--compress" ]
|
|
}
|
|
}
|
|
}
|
|
|
|
observatory_archive("compressed_observatory_archive") {
|
|
compress = true
|
|
}
|
|
|
|
copy("copy_compressed_observatory_archive") {
|
|
archive_target = ":compressed_observatory_archive"
|
|
deps = [
|
|
archive_target,
|
|
]
|
|
archive_dir = get_label_info(archive_target, "target_gen_dir")
|
|
archive_name = get_label_info(archive_target, "name")
|
|
archive_file = "${archive_dir}/${archive_name}.tar"
|
|
sources = [
|
|
archive_file,
|
|
]
|
|
outputs = [
|
|
"$root_out_dir/${archive_name}.tar",
|
|
]
|
|
}
|
|
|
|
observatory_archive("observatory_archive") {
|
|
compress = false
|
|
}
|
|
|
|
copy("copy_observatory_archive") {
|
|
archive_target = ":observatory_archive"
|
|
deps = [
|
|
archive_target,
|
|
]
|
|
archive_dir = get_label_info(archive_target, "target_gen_dir")
|
|
archive_name = get_label_info(archive_target, "name")
|
|
archive_file = "${archive_dir}/${archive_name}.tar"
|
|
sources = [
|
|
archive_file,
|
|
]
|
|
outputs = [
|
|
"$root_out_dir/${archive_name}.tar",
|
|
]
|
|
}
|
|
|
|
# Generates a .cc file containing the bytes of the observatory archive in a C
|
|
# array.
|
|
#
|
|
# Parameters:
|
|
# inner_namespace (required):
|
|
# The inner C++ namespace that the C array lives in.
|
|
#
|
|
# outer_namespace (required):
|
|
# The outer C++ namespace that the C array lives in.
|
|
#
|
|
# archive_file (required):
|
|
# The path to the observatory archive.
|
|
#
|
|
template("observatory_archive_source") {
|
|
assert(defined(invoker.inner_namespace),
|
|
"Need inner_namespace in $target_name")
|
|
assert(defined(invoker.outer_namespace),
|
|
"Need outer_namespace in $target_name")
|
|
assert(defined(invoker.archive_file), "Need archive_file in $target_name")
|
|
|
|
action(target_name) {
|
|
forward_variables_from(invoker, [ "deps" ])
|
|
|
|
inputs = [
|
|
invoker.archive_file,
|
|
]
|
|
|
|
output = "$target_gen_dir/${target_name}.cc"
|
|
outputs = [
|
|
output,
|
|
]
|
|
|
|
script = "../tools/create_archive.py"
|
|
args = [
|
|
"--tar_input",
|
|
rebase_path(invoker.archive_file),
|
|
"--output",
|
|
rebase_path(output),
|
|
"--outer_namespace",
|
|
invoker.outer_namespace,
|
|
"--inner_namespace",
|
|
invoker.inner_namespace,
|
|
"--name",
|
|
"observatory_assets_archive",
|
|
]
|
|
}
|
|
}
|
|
|
|
observatory_archive_source("embedded_archive_observatory") {
|
|
outer_namespace = "dart"
|
|
inner_namespace = "observatory"
|
|
|
|
# TODO(zra): In a Fuchsia build, use a prebuilt Observatory archive.
|
|
archive_target = ":observatory_archive"
|
|
deps = [
|
|
archive_target,
|
|
]
|
|
archive_dir = get_label_info(archive_target, "target_gen_dir")
|
|
archive_name = get_label_info(archive_target, "name")
|
|
archive_file = "${archive_dir}/${archive_name}.tar"
|
|
}
|
|
|
|
source_set("embedded_observatory_archive") {
|
|
deps = [
|
|
":embedded_archive_observatory",
|
|
]
|
|
|
|
sources = [
|
|
rebase_path("$target_gen_dir/embedded_archive_observatory.cc"),
|
|
]
|
|
}
|
|
|
|
observatory_archive_source("standalone_archive_observatory") {
|
|
outer_namespace = "dart"
|
|
inner_namespace = "bin"
|
|
|
|
# TODO(zra): In a Fuchsia build, use a prebuilt Observatory archive.
|
|
archive_target = ":compressed_observatory_archive"
|
|
deps = [
|
|
archive_target,
|
|
]
|
|
archive_dir = get_label_info(archive_target, "target_gen_dir")
|
|
archive_name = get_label_info(archive_target, "name")
|
|
archive_file = "${archive_dir}/${archive_name}.tar"
|
|
}
|
|
|
|
source_set("standalone_observatory_archive") {
|
|
deps = [
|
|
":standalone_archive_observatory",
|
|
]
|
|
|
|
sources = [
|
|
rebase_path("$target_gen_dir/standalone_archive_observatory.cc"),
|
|
]
|
|
}
|