Skip to content

Commit

Permalink
pkg.bzl: Significantly restructure codeql_pack rule.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
criemen committed Jun 11, 2024
1 parent 3574b9f commit 3cf719c
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 209 deletions.
1 change: 0 additions & 1 deletion javascript/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ codeql_pack(
"//javascript/extractor:tools-extractor",
"//javascript/resources",
],
visibility = ["//visibility:public"],
zips = {"//javascript/extractor/lib/typescript": "tools"},
)
10 changes: 7 additions & 3 deletions misc/bazel/internal/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
help="Desination directory, relative to `--build-file`")
parser.add_argument("--pkg-install-script", required=True,
help="The wrapped `pkg_install` installation script rlocation")
parser.add_argument("--build-file", required=True,
parser.add_argument("--build-file",
help="BUILD.bazel rlocation relative to which the installation should take place")
parser.add_argument("--ripunzip",
help="ripunzip executable rlocation. Must be provided if `--zip-manifest` is.")
Expand All @@ -33,9 +33,13 @@
if opts.zip_manifest and not opts.ripunzip:
parser.error("Provide `--ripunzip` when specifying `--zip-manifest`")

build_file = runfiles.Rlocation(opts.build_file)
if opts.build_file:
build_file = runfiles.Rlocation(opts.build_file)
destdir = pathlib.Path(build_file).resolve().parent / opts.destdir
else:
destdir = pathlib.Path(opts.destdir)
assert destdir.is_absolute(), "Provide `--build-file` to resolve destination directory"
script = runfiles.Rlocation(opts.pkg_install_script)
destdir = pathlib.Path(build_file).resolve().parent / opts.destdir

if destdir.exists() and opts.cleanup:
shutil.rmtree(destdir)
Expand Down
Loading

0 comments on commit 3cf719c

Please sign in to comment.