2019-06-02 20:03:03 +00:00
|
|
|
import("../npm.gni")
|
|
|
|
|
|
|
|
template("webpack_build") {
|
|
|
|
assert(defined(invoker.config_file), "Need webpack config file to run")
|
|
|
|
assert(defined(invoker.out_file), "Need output file to run")
|
|
|
|
assert(defined(invoker.inputs), "Need webpack inputs to run")
|
|
|
|
|
|
|
|
npm_action(target_name) {
|
|
|
|
forward_variables_from(invoker,
|
|
|
|
[
|
|
|
|
"deps",
|
|
|
|
"public_deps",
|
|
|
|
])
|
|
|
|
script = "webpack"
|
|
|
|
|
|
|
|
inputs = [
|
|
|
|
invoker.config_file,
|
|
|
|
"//electron/build/webpack/webpack.config.base.js",
|
|
|
|
"//electron/tsconfig.json",
|
|
|
|
"//electron/yarn.lock",
|
|
|
|
"//electron/typings/internal-ambient.d.ts",
|
|
|
|
"//electron/typings/internal-electron.d.ts",
|
|
|
|
] + invoker.inputs
|
|
|
|
|
2021-04-08 22:56:59 +00:00
|
|
|
mode = "development"
|
|
|
|
if (is_official_build) {
|
|
|
|
mode = "production"
|
|
|
|
}
|
|
|
|
|
2019-06-02 20:03:03 +00:00
|
|
|
args = [
|
2020-10-20 19:10:15 +00:00
|
|
|
"--config",
|
2019-06-02 20:03:03 +00:00
|
|
|
rebase_path(invoker.config_file),
|
2022-08-03 14:42:50 +00:00
|
|
|
"--output-filename",
|
|
|
|
get_path_info(invoker.out_file, "file"),
|
|
|
|
"--output-path",
|
|
|
|
rebase_path(get_path_info(invoker.out_file, "dir")),
|
|
|
|
"--env",
|
|
|
|
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
|
|
|
"--env",
|
|
|
|
"mode=" + mode,
|
2019-06-02 20:03:03 +00:00
|
|
|
]
|
2021-08-05 18:03:50 +00:00
|
|
|
deps += [ "//electron/buildflags" ]
|
2019-06-02 20:03:03 +00:00
|
|
|
|
2020-01-17 18:41:52 +00:00
|
|
|
outputs = [ invoker.out_file ]
|
2019-06-02 20:03:03 +00:00
|
|
|
}
|
|
|
|
}
|