Skip to content

Commit 08ccf16

Browse files
authored
Migrate to Bzlmod (#1019)
* Migrate to Bzlmod * Add more files * Fix load * Remove load-on-top * Update workflow * Update config * Fix BUILD files * Add missing deps
1 parent 16b635e commit 08ccf16

12 files changed

Lines changed: 21 additions & 100 deletions

File tree

.bazelci/presubmit.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
---
22
buildifier:
33
version: latest
4-
# Check for issues with the format of our bazel config files.
5-
# All warnings from https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md
6-
# are enabled except:
7-
# rule-impl-return,uninitialized,return-value,rule-impl-return,unsorted-dict-items,out-of-order-load
8-
# TODO (suvanjan): Re-enable once issues and https://github.com/bazelbuild/buildtools/issues/575
9-
# are fixed.
10-
warnings: "attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,confusing-name,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,function-docstring,git-repository,http-archive,integer-division,load,load-on-top,module-docstring,name-conventions,native-build,native-package,no-effect,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,same-origin-load,string-iteration,unreachable,unused-variable"
114
tasks:
125
presubmit:
13-
platform: ubuntu1604
6+
platform: ubuntu2204
147
build_targets:
158
- "--"
169
- "..."

.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@
1515
# Defaults to auto which means off for Windows, explicitly enable for sh tests
1616
build --enable_runfiles=yes
1717

18-
# Explicitly enable WORKSPACE
19-
# See https://github.com/bazelbuild/bazel/issues/23023
20-
common --enable_workspace

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.x

.github/workflows/pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ jobs:
4141
go test ./cmd/... ./pkg/...
4242
# Upload the config generation binaries for easy sharing.
4343
- name: Upload Artifact Linux AMD64
44-
uses: actions/upload-artifact@v2
44+
uses: actions/upload-artifact@v4
4545
with:
4646
name: rbe_configs_gen_linux_amd64
4747
path: rbe_configs_gen_linux_amd64
4848
- name: Upload Artifact Windows AMD64
49-
uses: actions/upload-artifact@v2
49+
uses: actions/upload-artifact@v4
5050
with:
5151
name: rbe_configs_gen_windows_amd64.exe
52-
path: rbe_configs_gen_windows_amd64.exe
52+
path: rbe_configs_gen_windows_amd64.exe

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
*.pyc
2323

2424
# Go binaries built natively by the Go toolchain
25-
/rbe_configs_gen
25+
/rbe_configs_gen
26+
MODULE.bazel.lock
Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
# Copyright 2017 The Bazel Authors. All rights reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
workspace(name = "bazel_toolchains")
1+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
2+
bazel_dep(name = "rules_java", version = "8.7.2")
3+
bazel_dep(name = "rules_cc", version = "0.0.17")
154

165
# Use pre-generated toolchain configs for the latest Bazel and latest Ubuntu 16.04
176
# container. Pre-generated configs are only provided as a convenience for
@@ -22,7 +11,7 @@ workspace(name = "bazel_toolchains")
2211
# toolchain configs in production because they may break without warning.
2312
# For more information and alternatives, please visit:
2413
# https://github.com/bazelbuild/bazel-toolchains#rbe_configs_gen---cli-tool-to-generate-configs
25-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
14+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2615

2716
http_archive(
2817
name = "rbe_default",
@@ -31,10 +20,3 @@ http_archive(
3120
# on how to generate your own configs.
3221
urls = ["https://storage.googleapis.com/rbe-toolchain/bazel-configs/rbe-ubuntu1604/latest/rbe_default.tar"],
3322
)
34-
35-
load(
36-
"//repositories:repositories.bzl",
37-
bazel_toolchains_repositories = "repositories",
38-
)
39-
40-
bazel_toolchains_repositories()

examples/remotebuildexecution/hello_world/cc/BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
16+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
17+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
18+
1519
package(default_visibility = ["//visibility:public"])
1620

1721
cc_library(

examples/remotebuildexecution/hello_world/java/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
load("@rules_java//java:java_binary.bzl", "java_binary")
16+
1517
java_binary(
1618
name = "hello_java",
1719
srcs = ["HelloWorld.java"],

examples/remotebuildexecution/rbe_system_check/cc/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
16+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
17+
1518
package(default_visibility = ["//visibility:public"])
1619

1720
cc_binary(

repositories/BUILD

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)