-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: bzlmod now working * refactor: don't use index.bzl as we'd need to document a bzlmod argument. Buildifier checks now passing * chore: remove rules_distroless version from bzlmod example * fix: lock updating under bzlmod * fix: resolve transitive dependencies with package lock by default under bzlmod * chore: buildifier * fix: get package_name to build package index function name. Now works under bzlmod and workspace * refactor: cleanup setting lockfile repo under bzlmod * chore: remove bzlmod example and add it into e2e/smoke * chore: buildifier
- Loading branch information
1 parent
ab410d1
commit 9da4ee5
Showing
18 changed files
with
6,599 additions
and
383 deletions.
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.