-
Notifications
You must be signed in to change notification settings - Fork 40
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
Bzlmod support #50
Merged
thesayyn
merged 11 commits into
GoogleContainerTools:main
from
jacobshirley:support-bzlmod
Jun 17, 2024
Merged
Bzlmod support #50
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7db191a
feat: bzlmod now working
jacobshirley bf12343
refactor: don't use index.bzl as we'd need to document a bzlmod argum…
jacobshirley b126af6
chore: remove rules_distroless version from bzlmod example
jacobshirley abab026
fix: lock updating under bzlmod
jacobshirley 9fbedeb
fix: resolve transitive dependencies with package lock by default und…
jacobshirley f3b8915
Merge branch 'GoogleContainerTools:main' into support-bzlmod
jacobshirley f06d81a
chore: buildifier
jacobshirley 52eb886
fix: get package_name to build package index function name. Now works…
jacobshirley 153d51a
refactor: cleanup setting lockfile repo under bzlmod
jacobshirley 880a1ff
chore: remove bzlmod example and add it into e2e/smoke
jacobshirley 38325b2
chore: buildifier
jacobshirley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"extensions for bzlmod" | ||
|
||
load("//apt/private:index.bzl", _deb_package_index = "deb_package_index", _deb_package_index_bzlmod = "deb_package_index_bzlmod") | ||
load("//apt/private:resolve.bzl", _deb_resolve = "deb_resolve") | ||
|
||
deb_index = tag_class(attrs = { | ||
"name": attr.string(doc = "Name of the generated repository"), | ||
"lock": attr.label(doc = """The lock file to use for the index."""), | ||
"manifest": attr.label(doc = """The file used to generate the lock file"""), | ||
"resolve_transitive": attr.bool( | ||
doc = """Whether dependencies of dependencies should be resolved and added to the lockfile.""", | ||
default = True, | ||
), | ||
}) | ||
|
||
def _distroless_extension(module_ctx): | ||
for mod in module_ctx.modules: | ||
for deb_index in mod.tags.deb_index: | ||
_deb_package_index_bzlmod( | ||
module_ctx = module_ctx, | ||
name = deb_index.name, | ||
lock = deb_index.lock, | ||
) | ||
|
||
_deb_resolve( | ||
name = deb_index.name + "_resolution", | ||
manifest = deb_index.manifest, | ||
resolve_transitive = deb_index.resolve_transitive, | ||
) | ||
|
||
if not deb_index.lock: | ||
# buildifier: disable=print | ||
print("\nNo lockfile was given, please run `bazel run @%s//:lock` to create the lockfile." % deb_index.name) | ||
|
||
_deb_package_index( | ||
name = deb_index.name, | ||
lock = deb_index.lock if deb_index.lock else "@" + deb_index.name + "_resolution//:lock.json", | ||
bzlmod = True, | ||
) | ||
|
||
apt = module_extension( | ||
implementation = _distroless_extension, | ||
tag_classes = { | ||
"deb_index": deb_index, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
common --enable_bzlmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6.4.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I also had to get the last component of the path, as otherwise it would put ~ in the function name and then error:
syntax error at '~': expected (