1 # Copyright 2021 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/compiled_action.gni")
6 import("//build/config/zip.gni")
8 # Creates a CRX3 archive of the inputs
10 # inputs: A list of files that will be placed into the CRX.
11 # key: Path to a file containing an RSA key (DER-encoded PKCS #8 PrivateKeyInfo)
12 # to sign the CRX with.
13 # output: Path to the output CRX.
14 # base_dir (optional): The CRX paths will be relative to this directory.
16 # Note: you can generate and format a compatible key using openssl:
17 # `openssl genrsa 4096 | openssl pkcs8 \
18 # -inform PEM -nocrypt -topk8 -outform DER -out my_file.pkcs8.der`
20 assert(defined(invoker.inputs), "inputs must be defined for $target_name")
22 _zip_target = target_name + "_zip"
23 _zip_out = "$target_gen_dir/$_zip_target.zip"
25 inputs = invoker.inputs
27 if (defined(invoker.base_dir)) {
28 base_dir = invoker.base_dir
30 forward_variables_from(invoker,
41 compiled_action(target_name) {
42 tool = "//components/crx_file:crx3_build_action"
43 outputs = [ invoker.output ]
45 rebase_path(invoker.output, root_build_dir),
46 rebase_path(_zip_out, root_build_dir),
47 rebase_path(invoker.key, root_build_dir),
50 deps = [ ":$_zip_target" ]
51 forward_variables_from(invoker,