Skip to content

Commit

Permalink
bazel: adding bzlmod
Browse files Browse the repository at this point in the history
Bumping only the needed rules to make the setup work, making sure both
bzlmod and non bzlmod still builds and test as expected
  • Loading branch information
manuelnaranjo committed Dec 22, 2023
1 parent 0353ab1 commit e32e42c
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 27 deletions.
24 changes: 24 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module(
name = "bazeldnf",
version = "0.6.0",
)

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_go", version = "0.44.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.35.0", repo_name = "bazel_gazelle")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")

use_repo(
go_deps,
"com_github_bazelbuild_buildtools",
"com_github_crillab_gophersat",
"com_github_onsi_gomega",
"com_github_sassoftware_go_rpmutils",
"com_github_sirupsen_logrus",
"com_github_spf13_cobra",
"io_k8s_sigs_yaml",
"org_golang_x_crypto"
)
13 changes: 6 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ protobuf_deps()

http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
sha256 = "c8035e8ae248b56040a65ad3f0b7434712e2037e5dfdcebfe97576e620422709",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.44.0/rules_go-v0.44.0.zip"
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "efbbba6ac1a4fd342d5122cbdfdb82aeb2cf2862e35022c752eaddffada7c3f3",
sha256 = "32938bda16e6700063035479063d9d24c60eda8d79fd4739563f50d331cb3209",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
],
)

Expand All @@ -58,7 +57,7 @@ bazeldnf_dependencies()

go_rules_dependencies()

go_register_toolchains(version = "1.19.2")
go_register_toolchains(version = "1.21.1")

gazelle_dependencies()

Expand Down
8 changes: 4 additions & 4 deletions cmd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ go_library(
"//pkg/sat",
"//pkg/xattr",
"@com_github_bazelbuild_buildtools//build:go_default_library",
"@com_github_sassoftware_go_rpmutils//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_spf13_cobra//:go_default_library",
"@org_golang_x_crypto//openpgp:go_default_library",
"@com_github_sassoftware_go_rpmutils//:go-rpmutils",
"@com_github_sirupsen_logrus//:logrus",
"@com_github_spf13_cobra//:cobra",
"@org_golang_x_crypto//openpgp",
],
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/bazel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ go_test(
deps = [
"//pkg/api",
"//pkg/api/bazeldnf",
"@com_github_onsi_gomega//:go_default_library",
"@com_github_onsi_gomega//:gomega",
],
)
4 changes: 2 additions & 2 deletions pkg/order/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/rpm",
"@com_github_sassoftware_go_rpmutils//cpio:go_default_library",
"@com_github_sassoftware_go_rpmutils//cpio",
],
)

go_test(
name = "order_test",
srcs = ["order_test.go"],
embed = [":order"],
deps = ["@com_github_onsi_gomega//:go_default_library"],
deps = ["@com_github_onsi_gomega//:gomega"],
)
2 changes: 1 addition & 1 deletion pkg/reducer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ go_library(
"//pkg/api",
"//pkg/api/bazeldnf",
"//pkg/repo",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//:logrus",
],
)
4 changes: 2 additions & 2 deletions pkg/repo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ go_library(
"//pkg/api",
"//pkg/api/bazeldnf",
"//pkg/rpm",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_k8s_sigs_yaml//:go_default_library",
"@com_github_sirupsen_logrus//:logrus",
"@io_k8s_sigs_yaml//:yaml",
],
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/rpm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ go_library(
deps = [
"//pkg/api",
"//pkg/xattr",
"@com_github_sassoftware_go_rpmutils//:go_default_library",
"@com_github_sassoftware_go_rpmutils//cpio:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sassoftware_go_rpmutils//:go-rpmutils",
"@com_github_sassoftware_go_rpmutils//cpio",
"@com_github_sirupsen_logrus//:logrus",
],
)

Expand All @@ -28,6 +28,6 @@ go_test(
embed = [":rpm"],
deps = [
"//pkg/api",
"@com_github_onsi_gomega//:go_default_library",
"@com_github_onsi_gomega//:gomega",
],
)
10 changes: 5 additions & 5 deletions pkg/sat/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ go_library(
"//pkg/api",
"//pkg/reducer",
"//pkg/rpm",
"@com_github_crillab_gophersat//bf:go_default_library",
"@com_github_crillab_gophersat//explain:go_default_library",
"@com_github_crillab_gophersat//maxsat:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_crillab_gophersat//bf",
"@com_github_crillab_gophersat//explain",
"@com_github_crillab_gophersat//maxsat",
"@com_github_sirupsen_logrus//:logrus",
],
)

Expand All @@ -23,6 +23,6 @@ go_test(
embed = [":sat"],
deps = [
"//pkg/api",
"@com_github_onsi_gomega//:go_default_library",
"@com_github_onsi_gomega//:gomega",
],
)
2 changes: 1 addition & 1 deletion pkg/xattr/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ go_test(
srcs = ["xattr_test.go"],
data = glob(["testdata/**"]),
embed = [":xattr"],
deps = ["@com_github_onsi_gomega//:go_default_library"],
deps = ["@com_github_onsi_gomega//:gomega"],
)

0 comments on commit e32e42c

Please sign in to comment.