mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 09:46:09 +03:00
136 lines
3.7 KiB
Plaintext
136 lines
3.7 KiB
Plaintext
|
# Copyright 2017 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.
|
||
|
|
||
|
assert(is_fuchsia)
|
||
|
|
||
|
template("generate_runner_script") {
|
||
|
# This runtime_deps file is used at runtime and thus cannot go in
|
||
|
# target_gen_dir.
|
||
|
_target_dir_name = get_label_info(invoker.exe_target, "dir")
|
||
|
_target_shortname = get_label_info(invoker.exe_target, "name")
|
||
|
_runtime_deps_file = "$root_out_dir/gen.runtime/$_target_dir_name/$_target_shortname.runtime_deps"
|
||
|
_runtime_deps_target = "${_target_shortname}__write_deps"
|
||
|
group(_runtime_deps_target) {
|
||
|
forward_variables_from(invoker,
|
||
|
[
|
||
|
"data",
|
||
|
"data_deps",
|
||
|
"deps",
|
||
|
"public_deps",
|
||
|
"testonly",
|
||
|
])
|
||
|
write_runtime_deps = _runtime_deps_file
|
||
|
}
|
||
|
|
||
|
action(target_name) {
|
||
|
forward_variables_from(invoker,
|
||
|
[
|
||
|
"data_deps",
|
||
|
"deps",
|
||
|
"runner_script",
|
||
|
"target",
|
||
|
"testonly",
|
||
|
])
|
||
|
if (!defined(deps)) {
|
||
|
deps = []
|
||
|
}
|
||
|
if (!defined(data_deps)) {
|
||
|
data_deps = []
|
||
|
}
|
||
|
|
||
|
script = "//build/fuchsia/create_runner_script.py"
|
||
|
depfile = "$target_gen_dir/$target_name.d"
|
||
|
|
||
|
data = []
|
||
|
runner_args = []
|
||
|
|
||
|
generated_script = "$root_build_dir/bin/run_${_target_shortname}"
|
||
|
outputs = [
|
||
|
generated_script,
|
||
|
]
|
||
|
data += [
|
||
|
generated_script,
|
||
|
"//build/fuchsia/exe_runner.py",
|
||
|
"//build/fuchsia/test_runner.py",
|
||
|
"//build/fuchsia/runner_common.py",
|
||
|
"//build/util/lib/",
|
||
|
"//third_party/fuchsia-sdk/",
|
||
|
]
|
||
|
|
||
|
runner_args += [
|
||
|
"--runner-script",
|
||
|
runner_script,
|
||
|
"--output-directory",
|
||
|
rebase_path(root_build_dir, root_build_dir),
|
||
|
"--target-cpu",
|
||
|
target_cpu,
|
||
|
]
|
||
|
|
||
|
deps += [
|
||
|
":$_runtime_deps_target",
|
||
|
"//testing/buildbot/filters:fuchsia_filters",
|
||
|
]
|
||
|
data += [ _runtime_deps_file ]
|
||
|
runner_args += [
|
||
|
"--runtime-deps-path",
|
||
|
rebase_path(_runtime_deps_file, root_build_dir),
|
||
|
]
|
||
|
|
||
|
if (defined(args)) {
|
||
|
args = []
|
||
|
}
|
||
|
args = [
|
||
|
"--depfile",
|
||
|
rebase_path(depfile, root_build_dir),
|
||
|
"--script-output-path",
|
||
|
rebase_path(generated_script, root_build_dir),
|
||
|
"--exe-name",
|
||
|
_target_shortname,
|
||
|
]
|
||
|
|
||
|
if (defined(invoker.use_test_server) && invoker.use_test_server) {
|
||
|
args += [ "--enable-test-server" ]
|
||
|
}
|
||
|
|
||
|
args += runner_args
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# This template is used to generate a runner script for test binaries into the
|
||
|
# build dir for Fuchsia. It's generally used from the "test" template.
|
||
|
template("test_runner_script") {
|
||
|
generate_runner_script(target_name) {
|
||
|
testonly = true
|
||
|
runner_script = "test_runner.py"
|
||
|
exe_target = invoker.test_name
|
||
|
forward_variables_from(invoker, "*")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# This template is used to generate a runner script for arbitrary executables
|
||
|
# into the build dir for Fuchsia. The template should reference an "executable"
|
||
|
# target using the "exe_target" attribute.
|
||
|
#
|
||
|
# Example usage:
|
||
|
#
|
||
|
# executable("foo") {
|
||
|
# sources = [ "foo_main.cc" ]
|
||
|
# }
|
||
|
# fuchsia_executable_runner("foo_fuchsia") {
|
||
|
# exe_target = ":foo"
|
||
|
# }
|
||
|
template("fuchsia_executable_runner") {
|
||
|
generate_runner_script(target_name) {
|
||
|
forward_variables_from(invoker,
|
||
|
[
|
||
|
"testonly",
|
||
|
"exe_target",
|
||
|
])
|
||
|
runner_script = "exe_runner.py"
|
||
|
data_deps = [
|
||
|
exe_target,
|
||
|
]
|
||
|
}
|
||
|
}
|