-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazel: add codeql specific packaging library #16432
base: main
Are you sure you want to change the base?
Conversation
This encapsulate arch specific logic, local installation and separation of zip files into generic and arch-specific parts as required by the internal build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! some initial comments, a lot of them around missing documentation. I'll take a second look at the rule implementation once the documentation is there, so I have a better idea how things are supposed to hang together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more round of review comments, thanks a lot for all the code comments, they've been really useful in following along.
misc/bazel/pkg.bzl
Outdated
the requested `kind`. | ||
""", | ||
attrs = { | ||
"base": attr.label( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to expose this separately from zips
?
Couldn't we just merge the zip files in zips
? I don't see the benefit of a base
argument, but happy to be convinced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, after trying it again I remembered why I had done this. The distinction whether to select a zip or not depends on its prefix containing {CODEQL_PLATFORM}
. The base zip would be added with an empty ""
prefix, which would disqualify it from the arch
zipmerge. So the base_zip
is always included, while zips
are included conditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, then a comment to that effect would be great, to explain that design choice to future us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, I think we're nearly there ❤️
misc/bazel/pkg.bzl
Outdated
srcs = [internal(kind)], | ||
visibility = ["//visibility:private"], | ||
package_dir = name, | ||
package_file_name = name + "-" + (_detect_platform() if kind == "arch" else "generic") + ".zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pull out this logic into a variable in codeql_pack
, and remove the same/similar filename scheme from _zipmerge
? That'd make zipmerge
a little bit more generic, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such an innocent looking comment 😝
I've ended up extracting the whole filtering + plat expansion logic to separate rules with a specific provider. This effectively seems like being on the good path to generalize _zipmerge
now.
This encapsulate arch specific logic, local installation and separation of zip files into generic and arch-specific parts as required by the internal build. The logic behind separating generic and arch-specific files lies in using
{CODEQL_PLATFORM}
in the prefix, which then gets expanded to the appropriate value.Moreover, this PR the ability to import
.zip
files into the pack in a highly optimized way:ripunzip
will be used to unzip the zip file contents to the destination prefixzipmerge
(ported from the internal repository) merges the imported zips into the output, without decompressing.These changes are applied to
swift
as an example.