Skip to content

Commit 7445b2c

Browse files
authored
fix rules_cc for 7.x WORKSPACE/non-bzlmod users (#1549)
only way i could figure to get this to work was to not assist in standing up neither `protobuf_deps()` nor `rules_cc_dependencies()` in `swift_extra_dependencies()` – this works around the ordering issue that breaks transitive dep loading of both rules_python/rules_java and our stardoc configuration
1 parent 37ef09a commit 7445b2c

File tree

30 files changed

+65
-103
lines changed

30 files changed

+65
-103
lines changed

.bazelci/presubmit.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ x_defaults:
4848
- "//tools/..."
4949

5050
tasks:
51-
# macos_7:
52-
# name: "Previous LTS with no bzlmod"
53-
# bazel: 7.x
54-
# build_flags:
55-
# - "--noenable_bzlmod"
56-
# - "--enable_workspace"
57-
# <<: *mac_common
51+
macos_7:
52+
name: "Previous LTS with no bzlmod"
53+
bazel: 7.x
54+
build_flags:
55+
- "--noenable_bzlmod"
56+
- "--enable_workspace"
57+
<<: *mac_common
5858

5959
macos_latest:
6060
name: "Current LTS"
@@ -75,17 +75,17 @@ tasks:
7575
- .bazelci/update_workspace_to_deps_heads.sh
7676
<<: *mac_common
7777

78-
# ubuntu2004_7:
79-
# name: "Previous LTS with no bzlmod"
80-
# bazel: 7.x
81-
# shell_commands:
82-
# - "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
83-
# - "mkdir $SWIFT_HOME"
84-
# - "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
85-
# build_flags:
86-
# - "--noenable_bzlmod"
87-
# - "--enable_workspace"
88-
# <<: *linux_common
78+
ubuntu2004_7:
79+
name: "Previous LTS with no bzlmod"
80+
bazel: 7.x
81+
shell_commands:
82+
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
83+
- "mkdir $SWIFT_HOME"
84+
- "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
85+
build_flags:
86+
- "--noenable_bzlmod"
87+
- "--enable_workspace"
88+
<<: *linux_common
8989

9090
ubuntu2004_latest:
9191
name: "Current LTS"

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports_files(["LICENSE"])
77
# Consumed by Bazel integration tests (such as those defined in rules_apple).
88
filegroup(
99
name = "for_bazel_tests",
10-
testonly = 1,
10+
testonly = True,
1111
srcs = [
1212
"WORKSPACE",
1313
"//swift:for_bazel_tests",

MODULE.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ bazel_dep(name = "apple_support", version = "1.21.0", repo_name = "build_bazel_a
1414
bazel_dep(name = "rules_cc", version = "0.1.2")
1515
bazel_dep(name = "rules_shell", version = "0.3.0")
1616
bazel_dep(name = "platforms", version = "0.0.9")
17-
bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")
18-
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
17+
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")
1918
bazel_dep(name = "nlohmann_json", version = "3.6.1", repo_name = "com_github_nlohmann_json")
2019
bazel_dep(
2120
name = "swift_argument_parser",

doc/rules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ swift_proto_library(<a href="#swift_proto_library-name">name</a>, <a href="#swif
776776
Generates a Swift static library from one or more targets producing `ProtoInfo`.
777777

778778
```python
779-
load("@rules_proto//proto:defs.bzl", "proto_library")
779+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
780780
load("//proto:swift_proto_library.bzl", "swift_proto_library")
781781

782782
proto_library(
@@ -794,7 +794,7 @@ If your protos depend on protos from other targets, add dependencies between the
794794
swift_proto_library targets which mirror the dependencies between the proto targets.
795795

796796
```python
797-
load("@rules_proto//proto:defs.bzl", "proto_library")
797+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
798798
load("//proto:swift_proto_library.bzl", "swift_proto_library")
799799

800800
proto_library(

examples/xplatform/custom_swift_proto_compiler/protos/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
load(
2-
"@rules_proto//proto:defs.bzl",
3-
"proto_library",
4-
)
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
52

63
proto_library(
74
name = "example_proto",

examples/xplatform/grpc/service/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@rules_proto//proto:defs.bzl", "proto_library")
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
22
load("//proto:swift_proto_library.bzl", "swift_proto_library")
33

44
proto_library(

examples/xplatform/proto/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@rules_proto//proto:defs.bzl", "proto_library")
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
22
load("//proto:swift_proto_library.bzl", "swift_proto_library")
33
load("//swift:swift_binary.bzl", "swift_binary")
44

examples/xplatform/proto_files/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
load(
2-
"@rules_proto//proto:defs.bzl",
3-
"proto_library",
4-
)
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
52
load("//proto:swift_proto_library.bzl", "swift_proto_library")
63
load("//swift:swift_binary.bzl", "swift_binary")
74

examples/xplatform/proto_glob/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@rules_proto//proto:defs.bzl", "proto_library")
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
22
load("//proto:swift_proto_library.bzl", "swift_proto_library")
33
load("//swift:swift_binary.bzl", "swift_binary")
44

examples/xplatform/proto_library_group/request/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
load(
2-
"@rules_proto//proto:defs.bzl",
3-
"proto_library",
4-
)
1+
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
52

63
proto_library(
74
name = "request_proto",

0 commit comments

Comments
 (0)