blob: 84792e208a0b7576df4b05625cda46138e2c4fe1 [file] [log] [blame]
# Copyright 2021 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/compiled_action.gni")
import("//build/config/zip.gni")
# Creates a CRX3 archive of the inputs
#
# inputs: A list of files that will be placed into the CRX.
# key: An RSA key (DER-encoded PKCS #8 PrivateKeyInfo) to sign the CRX with.
# output: Path to the output CRX.
# base_dir (optional): The CRX paths will be relative to this directory.
#
# Note: you can generate and format a compatible key using openssl:
# `openssl genrsa 4096 | openssl pkcs8 \
# -inform PEM -nocrypt -topk8 -outform DER -out my_file.pkcs8.der`
template("crx3") {
assert(defined(invoker.inputs), "inputs must be defined for $target_name")
_zip_target = target_name + "_zip"
_zip_out = "$target_gen_dir/$_zip_target.zip"
zip(_zip_target) {
inputs = invoker.inputs
output = _zip_out
if (defined(invoker.base_dir)) {
base_dir = invoker.base_dir
}
forward_variables_from(invoker,
[
"data",
"data_deps",
"deps",
"public_deps",
"testonly",
"visibility",
])
}
compiled_action(target_name) {
tool = "//components/crx_file:crx3_build_action"
outputs = [ invoker.output ]
args = [
rebase_path(invoker.output, root_build_dir),
rebase_path(_zip_out, root_build_dir),
rebase_path(invoker.key),
]
inputs = [ _zip_out ]
deps = [ ":$_zip_target" ]
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
}
}