Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ build:aarch64 --cpu=aarch64
build:aarch64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64

common --noenable_bzlmod
common --enable_workspace
1 change: 1 addition & 0 deletions .bazelversion
64 changes: 42 additions & 22 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ http_archive(
# Export .x files.
"//tools:rules_go_export.patch",
],
sha256 = "af47f30e9cbd70ae34e49866e201b3f77069abb111183f2c0297e7e74ba6bbc0",
sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.47.0/rules_go-v0.47.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.47.0/rules_go-v0.47.0.zip",
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
"https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip",
],
)

Expand All @@ -89,12 +89,32 @@ switched_rules_by_language(
go = False, # Disable building proto Go libraries; use org_golang_google_genproto instead.
)

# rules_python needed by bazel_gazelle
http_archive(
name = "rules_python",
sha256 = "fa532d635f29c038a64c8062724af700c30cf6b31174dd4fac120bc561a1a560",
strip_prefix = "rules_python-1.5.1",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.1/rules_python-1.5.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

# Load C++ rules. Needs to come early because something else pulls in an older
# version of rules_cc which is incompatible with Bazel 8.
http_archive(
name = "rules_cc",
sha256 = "0d3b4f984c4c2e1acfd1378e0148d35caf2ef1d9eb95b688f8e19ce0c41bdf5b",
strip_prefix = "rules_cc-0.1.4",
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.1.4/rules_cc-0.1.4.tar.gz",
)

http_archive(
name = "bazel_gazelle",
sha256 = "32938bda16e6700063035479063d9d24c60eda8d79fd4739563f50d331cb3209",
sha256 = "49b14c691ceec841f445f8642d28336e99457d1db162092fd5082351ea302f1d",
urls = [
"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",
"https://github.com/bazel-contrib/bazel-gazelle/releases/download/v0.44.0/bazel-gazelle-v0.44.0.tar.gz"
],
)

Expand Down Expand Up @@ -386,19 +406,14 @@ go_repository(
version = "v1.67.1",
)

# Load C++ rules.
http_archive(
name = "rules_cc",
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
strip_prefix = "rules_cc-0.0.17",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
)

# Load C++ cross-compilation toolchains.
# # Load C++ cross-compilation toolchains.
http_archive(
name = "coral_crosstool",
patch_args = ["-p1"],
patches = ["//tools:crosstool-arm-dirs.patch"],
patches = [
"//tools:crosstool-arm-dirs.patch",
"//tools:remove_windows_deps.patch",
],
sha256 = "f86d488ca353c5ee99187579fe408adb73e9f2bb1d69c6e3a42ffb904ce3ba01",
strip_prefix = "crosstool-8e885509123395299bed6a5f9529fdc1b9751599",
urls = [
Expand Down Expand Up @@ -429,9 +444,9 @@ http_archive(
)

# Load LLVM dependencies.
LLVM_COMMIT = "926f85db98aae66ab8f57b9981f47ddddb868c51"
LLVM_COMMIT = "cbcb48a88c3a6227cfc09f91880d5cb92a26f5f9"

LLVM_SHA256 = "c78c94b2a03b2cf6ef1ba035c31a6f1b0bb7913da8af5aa8d5c2061f6499d589"
LLVM_SHA256 = "356cb88e5975104628494bd02b8edef1889ea30a7dbe96b5abe6ad74ed8ba74b"

http_archive(
name = "llvm-raw",
Expand Down Expand Up @@ -479,6 +494,15 @@ http_archive(
],
)

# rules_java needed for rules_proto and grpc both.
http_archive(
name = "rules_java",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/8.6.2/rules_java-8.6.2.tar.gz",
],
sha256 = "a64ab04616e76a448c2c2d8165d836f0d2fb0906200d0b7c7376f46dd62e59cc",
)

http_archive(
name = "com_google_protobuf",
sha256 = "e7a50ac2a8ae3754c6f1ab6123424627920e4abddd894ee4bc47d6506e86aeb9",
Expand Down Expand Up @@ -1759,10 +1783,6 @@ go_repository(
version = "v56.0.0",
)

rules_proto_dependencies()

rules_proto_toolchains()

http_archive(
name = "rules_pkg",
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
Expand Down
3 changes: 2 additions & 1 deletion images/default/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud
ln -s /google-cloud-sdk/bin/gcloud /usr/bin/gcloud

# Download the official bazel binary. The APT repository isn't used because there is not packages for arm64.
RUN sh -c 'curl -o /usr/local/bin/bazel https://releases.bazel.build/7.5.0/release/bazel-7.5.0-linux-$(uname -m | sed s/aarch64/arm64/) && chmod ugo+x /usr/local/bin/bazel'
COPY bazelversion .
RUN sh -c 'curl -o /usr/local/bin/bazel https://releases.bazel.build/$(cat ./bazelversion)/release/bazel-$(cat ./bazelversion)-linux-$(uname -m | sed s/aarch64/arm64/) && chmod ugo+x /usr/local/bin/bazel'
WORKDIR /workspace
ENTRYPOINT ["/usr/local/bin/bazel"]
1 change: 1 addition & 0 deletions images/default/bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.3.1
4 changes: 2 additions & 2 deletions tools/bazeldefs/cc.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""C++ rules."""

load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", _cc_grpc_library = "cc_grpc_library")
load("@rules_cc//cc:defs.bzl", _cc_binary = "cc_binary", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test")
load("@com_google_protobuf//bazel:cc_proto_library.bzl", _cc_proto_library = "cc_proto_library")
load("@rules_cc//cc:defs.bzl", _cc_binary = "cc_binary", _cc_library = "cc_library", _cc_test = "cc_test")

cc_library = _cc_library
cc_proto_library = _cc_proto_library
Expand All @@ -11,7 +12,6 @@ gtest = "@com_google_googletest//:gtest"
gbenchmark = "@com_google_benchmark//:benchmark"
gbenchmark_internal = "@com_google_benchmark//:benchmark"
grpcpp = "@com_github_grpc_grpc//:grpc++"
vdso_linker_option = "-fuse-ld=gold "

def _cc_flags_supplier_impl(ctx):
variables = platform_common.TemplateVariableInfo({
Expand Down
2 changes: 1 addition & 1 deletion tools/bazeldefs/go.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def go_context(ctx, goos = None, goarch = None, std = False):
goos = goos,
gotags = go_ctx.tags,
nogo_args = [],
runfiles = depset([go_ctx.go] + go_ctx.sdk.srcs + go_ctx.sdk.tools + go_ctx.stdlib.libs),
runfiles = depset([go_ctx.go] + go_ctx.sdk.srcs.to_list() + go_ctx.sdk.tools.to_list() + go_ctx.stdlib.libs.to_list()),
stdlib_srcs = go_ctx.sdk.srcs,
)

Expand Down
2 changes: 1 addition & 1 deletion tools/bigquery/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ go_library(
"//:sandbox",
],
deps = [
"@com_google_cloud_go//bigquery:go_default_library",
"@com_google_cloud_go_bigquery//:go_default_library",
"@org_golang_google_api//option:go_default_library",
"@org_golang_x_oauth2//:go_default_library",
],
Expand Down
3 changes: 1 addition & 2 deletions tools/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ automagically creating cc_ and go_ proto targets) and act as a single point of
change for Google-internal and bazel-compatible rules.
"""

load("//tools/bazeldefs:cc.bzl", _cc_binary = "cc_binary", _cc_flags_supplier = "cc_flags_supplier", _cc_grpc_library = "cc_grpc_library", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test", _cc_toolchain = "cc_toolchain", _gbenchmark = "gbenchmark", _gbenchmark_internal = "gbenchmark_internal", _grpcpp = "grpcpp", _gtest = "gtest", _select_gtest = "select_gtest", _vdso_linker_option = "vdso_linker_option")
load("//tools/bazeldefs:cc.bzl", _cc_binary = "cc_binary", _cc_flags_supplier = "cc_flags_supplier", _cc_grpc_library = "cc_grpc_library", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test", _cc_toolchain = "cc_toolchain", _gbenchmark = "gbenchmark", _gbenchmark_internal = "gbenchmark_internal", _grpcpp = "grpcpp", _gtest = "gtest", _select_gtest = "select_gtest")
load("//tools/bazeldefs:defs.bzl", _BuildSettingInfo = "BuildSettingInfo", _bool_flag = "bool_flag", _bpf_program = "bpf_program", _build_test = "build_test", _bzl_library = "bzl_library", _coreutil = "coreutil", _default_net_util = "default_net_util", _more_shards = "more_shards", _most_shards = "most_shards", _proto_library = "proto_library", _select_system = "select_system", _short_path = "short_path", _version = "version")
load("//tools/bazeldefs:go.bzl", _gazelle = "gazelle", _go_binary = "go_binary", _go_grpc_and_proto_libraries = "go_grpc_and_proto_libraries", _go_library = "go_library", _go_path = "go_path", _go_proto_library = "go_proto_library", _go_test = "go_test", _gotsan_flag_values = "gotsan_flag_values", _gotsan_values = "gotsan_values", _select_goarch = "select_goarch", _select_goos = "select_goos")
load("//tools/bazeldefs:pkg.bzl", _pkg_deb = "pkg_deb", _pkg_tar = "pkg_tar")
Expand Down Expand Up @@ -39,7 +39,6 @@ gbenchmark = _gbenchmark
gbenchmark_internal = _gbenchmark_internal
gtest = _gtest
grpcpp = _grpcpp
vdso_linker_option = _vdso_linker_option
select_gtest = _select_gtest

# Go rules.
Expand Down
12 changes: 6 additions & 6 deletions tools/go_types_memoize.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
diff --git a/src/go/types/scope.go b/src/go/types/scope.go
index 010727eb72..0f134b872e 100644
index e3fb7b6eff..683f844b42 100644
--- a/src/go/types/scope.go
+++ b/src/go/types/scope.go
@@ -25,6 +25,7 @@ type Scope struct {
@@ -27,6 +27,7 @@ type Scope struct {
children []*Scope
number int // parent.children[number-1] is this scope; 0 if there is no parent
elems map[string]Object // lazily allocated
+ sorted []string // lazily allocated
pos, end token.Pos // scope extent; may be invalid
comment string // for debugging only
isFunc bool // set if this is a function scope (internal use only)
@@ -33,7 +34,7 @@ type Scope struct {
@@ -35,7 +36,7 @@ type Scope struct {
// NewScope returns a new, empty scope contained in the given parent
// scope, if any. The comment is for debugging only.
func NewScope(parent *Scope, pos, end token.Pos, comment string) *Scope {
Expand All @@ -19,7 +19,7 @@ index 010727eb72..0f134b872e 100644
// don't add children to Universe scope!
if parent != nil && parent != Universe {
parent.children = append(parent.children, s)
@@ -50,14 +51,16 @@ func (s *Scope) Len() int { return len(s.elems) }
@@ -52,14 +53,16 @@ func (s *Scope) Len() int { return len(s.elems) }

// Names returns the scope's element names in sorted order.
func (s *Scope) Names() []string {
Expand All @@ -35,9 +35,9 @@ index 010727eb72..0f134b872e 100644
+ s.sorted[i] = name
+ i++
+ }
+ sort.Strings(s.sorted)
+ slices.Sort(s.sorted)
}
- sort.Strings(names)
- slices.Sort(names)
- return names
+ return s.sorted
}
Expand Down
5 changes: 3 additions & 2 deletions tools/nogo/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ def _nogo_stdlib_impl(ctx):
# Build the analyzer command.
facts_file = ctx.actions.declare_file(ctx.label.name + ".facts")
findings_file = ctx.actions.declare_file(ctx.label.name + ".raw_findings")
stdlib_srcs = go_ctx.stdlib_srcs if type(go_ctx.stdlib_srcs) == "list" else go_ctx.stdlib_srcs.to_list()
ctx.actions.run(
# For the standard library, we need to include the full set of Go
# sources in the inputs.
inputs = inputs + go_ctx.stdlib_srcs,
inputs = inputs + stdlib_srcs,
outputs = [facts_file, findings_file],
tools = depset(go_ctx.runfiles.to_list() + ctx.files._nogo),
executable = ctx.files._nogo[0],
Expand All @@ -90,7 +91,7 @@ def _nogo_stdlib_impl(ctx):
"-findings=%s" % findings_file.path,
"-facts=%s" % facts_file.path,
"-root=.*?/src/",
] + [f.path for f in go_ctx.stdlib_srcs],
] + [f.path for f in stdlib_srcs],
toolchain = None,
)

Expand Down
Loading
Loading