Skip to content

Commit 3cf719c

Browse files
committed
pkg.bzl: Significantly restructure codeql_pack rule.
This PR introduces a `codeql_pack_rule` that does the heavy lifting of extracting arch- and common zip files for production dist building. It also factors out the installer targets for individual packs, as well as pack groups. This changes the contract between the internal build system and the pack definition significantly, which is why an accompanying internal PR is required. No backwards compatibility layer is provided, as the PR as complex enough as-is. The individual `codeql_pack` rules are now much simpler, as they mostly stuff their inputs into a new `_CodeQLPackInfo` provider, and let the installer and `codeql_pack_group` rules do the heavy lifting. For working in the external repo with self-contained packs, the per-pack installer targets are still available. Internally, we'll only use the new `codeql_pack_group` targets going forward, both for defining intree-dists and for building the production zip files.
1 parent 3574b9f commit 3cf719c

File tree

5 files changed

+287
-209
lines changed

5 files changed

+287
-209
lines changed

javascript/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ codeql_pack(
3333
"//javascript/extractor:tools-extractor",
3434
"//javascript/resources",
3535
],
36-
visibility = ["//visibility:public"],
3736
zips = {"//javascript/extractor/lib/typescript": "tools"},
3837
)

misc/bazel/internal/install.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
help="Desination directory, relative to `--build-file`")
2222
parser.add_argument("--pkg-install-script", required=True,
2323
help="The wrapped `pkg_install` installation script rlocation")
24-
parser.add_argument("--build-file", required=True,
24+
parser.add_argument("--build-file",
2525
help="BUILD.bazel rlocation relative to which the installation should take place")
2626
parser.add_argument("--ripunzip",
2727
help="ripunzip executable rlocation. Must be provided if `--zip-manifest` is.")
@@ -33,9 +33,13 @@
3333
if opts.zip_manifest and not opts.ripunzip:
3434
parser.error("Provide `--ripunzip` when specifying `--zip-manifest`")
3535

36-
build_file = runfiles.Rlocation(opts.build_file)
36+
if opts.build_file:
37+
build_file = runfiles.Rlocation(opts.build_file)
38+
destdir = pathlib.Path(build_file).resolve().parent / opts.destdir
39+
else:
40+
destdir = pathlib.Path(opts.destdir)
41+
assert destdir.is_absolute(), "Provide `--build-file` to resolve destination directory"
3742
script = runfiles.Rlocation(opts.pkg_install_script)
38-
destdir = pathlib.Path(build_file).resolve().parent / opts.destdir
3943

4044
if destdir.exists() and opts.cleanup:
4145
shutil.rmtree(destdir)

0 commit comments

Comments
 (0)