Skip to content

Commit 1d44936

Browse files
luispadroncopybara-github
authored andcommitted
Update rules_apple dependency to support rules_swift 3.x (#25437)
rules_swift 3.x requires a compat level of `3` which was only supported in rules_apple 4.x+. Closes #25437 PiperOrigin-RevId: 862515654
1 parent e3dc329 commit 1d44936

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

MODULE.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ module(
1414
# Thus the highest version in their module graph is resolved.
1515

1616
# These dependencies must be declared before the other rules dependencies.
17-
bazel_dep(name = "rules_apple", version = "3.16.0", repo_name = "build_bazel_rules_apple")
17+
# Workaround rules_apple having a default dependency on rules_swift 2.4.0, which in turn has a
18+
# hard dependency on the presence of swiftc.exe on Windows.
19+
bazel_dep(name = "rules_swift", version = "3.0.2", repo_name = "build_bazel_rules_swift")
20+
# TODO: Can rules_apple be removed, and thus allow rules_swift to be removed?
21+
bazel_dep(name = "rules_apple", version = "4.0.0", repo_name = "build_bazel_rules_apple")
1822
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
1923

2024
# Keep apple_support on 1.15.1 for now to avoid this issue:

cmake/dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16)
1010
include_guard()
1111
endif()
1212

13-
set(rules_apple-version "3.16.0")
13+
set(rules_apple-version "4.0.0")
1414
set(apple_support-version "1.15.1")
1515
set(abseil-cpp-version "20250512.1")
1616
set(rules_cc-version "0.0.17")

protobuf_deps.bzl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,21 @@ def protobuf_deps():
171171
sha256 = "d20c951960ed77cb7b341c2a59488534e494d5ad1d30c4818c736d57772a9fef",
172172
)
173173

174+
# Workaround rules_apple having a default dependency on rules_swift 2.4.0, which in turn has a
175+
# hard dependency on the presence of swiftc.exe on Windows.
176+
if not native.existing_rule("build_bazel_rules_swift"):
177+
http_archive(
178+
name = "build_bazel_rules_swift",
179+
sha256 = "b17bdad10f3996cffc1ae3634e426d5280848cdb25ae5351f39357599938f5c6",
180+
url = "https://github.com/bazelbuild/rules_swift/releases/download/3.0.2/rules_swift.3.0.2.tar.gz",
181+
)
182+
183+
# TODO: Can rules_apple be removed, and thus allow rules_swift to be removed?
174184
if not native.existing_rule("build_bazel_rules_apple"):
175185
http_archive(
176186
name = "build_bazel_rules_apple",
177-
sha256 = "86ff9c3a2c7bc308fef339bcd5b3819aa735215033886cc281eb63f10cd17976",
178-
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.16.0/rules_apple.3.16.0.tar.gz",
187+
sha256 = "70b0fb2aec1055c978109199bf58ccb5008aba8e242f3305194045c271ca3cae",
188+
url = "https://github.com/bazelbuild/rules_apple/releases/download/4.0.0/rules_apple.4.0.0.tar.gz",
179189
)
180190

181191
if not native.existing_rule("build_bazel_apple_support"):

0 commit comments

Comments
 (0)