Skip to content

Commit

Permalink
add bzlmod
Browse files Browse the repository at this point in the history
  • Loading branch information
fardream committed Feb 4, 2024
1 parent 959427f commit 51b8a3f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ build:release -c opt --stamp --workspace_status_command="$PWD/status.py"
# file should be able to overwrite flags from the root configuration.
try-import %workspace%/.bazelrc.user

# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
# https://github.com/bazelbuild/buildtools/issues/1204
common --noenable_bzlmod

common --enable_bzlmod --lockfile_mode=off
42 changes: 40 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
# https://github.com/bazelbuild/buildtools/issues/1204
"""buildtools"""

module(
name = "buildtools",
repo_name = "com_github_bazelbuild_buildtools",
)

bazel_dep(name = "rules_go", version = "0.45.1", repo_name = "io_bazel_rules_go")

go_sdk = use_extension("@io_bazel_rules_go//go:extension.bzl", "go_sdk")
go_sdk.download(version = "1.20.3")

bazel_dep(name = "gazelle", version = "0.30.0", repo_name = "bazel_gazelle")

# cannot use from_file method in go_deps due to go 1.15 in go.mod
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.module(
path = "github.com/golang/protobuf",
version = "v1.4.3",
)
go_deps.module(
path = "go.starlark.net",
sum = "h1:Qoe+9POtDT51UBQ8XEnS9QKeHDQzEl2QRh3eok9R4aw=",
version = "v0.0.0-20210223155950-e043a3d3c984",
)
go_deps.module(
path = "google.golang.org/protobuf",
sum = "h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=",
version = "v1.25.0",
)
use_repo(
go_deps,
"com_github_golang_protobuf",
"net_starlark_go",
"org_golang_google_protobuf",
)

# protobuf 24.4 is not in BCR
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
2 changes: 1 addition & 1 deletion buildozer/buildozer_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ die () {
[[ "$1" =~ external/* ]] && buildozer="${{1#external/}}" || buildozer="$TEST_WORKSPACE/$1"
buildozer="$(rlocation "$buildozer")"

source $TEST_SRCDIR/buildtools/buildozer/test_common.sh
source $(rlocation "$TEST_WORKSPACE/buildozer/test_common.sh")

## TEST INPUTS

Expand Down

0 comments on commit 51b8a3f

Please sign in to comment.