naiveproxy/chrome/browser/resources/media_router/extension/BUILD.gn
2018-08-14 22:19:20 +00:00

87 lines
2.3 KiB
Plaintext

import("src/files.gni")
group("all") {
deps = [
":media_router",
]
}
declare_args() {
# Determines whether JSCompiler should be used to typecheck
# JavaScript code for the Media Router extension.
enable_media_router_jscompile = false
}
if (enable_media_router_jscompile) {
# Run JSCompiler for typechecking.
action("media_router_type_check") {
script = "//third_party/closure_compiler/compile2.py"
inputs = rebase_path(mr_module_files, ".", "src") + [
"src/externs.js",
"src/mojo_externs.js",
]
outputs = [
target_gen_dir + "/$target_name.stamp",
]
args = [
"--out_file",
rebase_path(outputs[0], root_build_dir),
"--closure_args",
"dependency_mode=LOOSE",
"checks_only",
"--",
] + rebase_path(inputs, root_build_dir)
}
}
# Concatentate JS files to produce "module" JS files that can be
# loaded at runtime. This could be done by JSCompiler, but it depends
# on Java, and Java isn't always available.
action("media_router_modules") {
script = "concat_js_modules.py"
module_inputs = rebase_path(mr_module_files, ".", "src")
inputs = module_inputs + [ "prelude.js" ]
outputs = []
foreach(module_name, mr_module_names) {
outputs += [ "${target_gen_dir}/${module_name}.js" ]
}
args = [ "--module-specs" ] + mr_module_specs + [
"--output-dir",
rebase_path(target_gen_dir, root_build_dir),
"--",
] + rebase_path(module_inputs, root_build_dir)
}
copy("copy_prelude") {
sources = [
"prelude.js",
]
outputs = [
"${target_gen_dir}/prelude.js",
]
}
# Produce the Media Router extension. At present, the extension isn't
# included in the Chromium distribution, but it can be sideloaded into
# Chromium for testing.
action("media_router") {
script = "generate_manifest.py"
inputs = [
"manifest.yaml",
]
outputs = [
"$target_gen_dir/manifest.json",
]
deps = [
":copy_prelude",
":media_router_modules",
]
if (enable_media_router_jscompile) {
deps += [ ":media_router_type_check" ]
}
args = [
"--manifest_in=" + rebase_path("manifest.yaml", root_build_dir),
"--output_dir=" + rebase_path(target_gen_dir, root_build_dir),
]
}