Skip to content

Commit f637c74

Browse files
committed
Remove direct dependency on rules_apple
This was only used for 2 apple_binary targets that we can replace with cc_binary. There is a difference here that previously these binary targets would transitively set the macOS version being targeted via a transition, this is no longer the case and now that setting is inherited from the including project's config instead. If unset it uses the host OS version which isn't ideal.
1 parent d5d6d4c commit f637c74

File tree

5 files changed

+9
-43
lines changed

5 files changed

+9
-43
lines changed

MODULE.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ module(
1313
# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
1414
# Thus the highest version in their module graph is resolved.
1515

16-
# These dependencies must be declared before the other rules dependencies.
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-
21-
# TODO: Can rules_apple be removed, and thus allow rules_swift to be removed?
22-
bazel_dep(name = "rules_apple", version = "4.0.0", repo_name = "build_bazel_rules_apple")
2316
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
2417

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

WORKSPACE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
114114

115115
rules_pkg_dependencies()
116116

117-
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
118-
119-
apple_rules_dependencies()
120-
121117
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
122118

123119
apple_support_dependencies()

cmake/dependencies.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16)
1010
include_guard()
1111
endif()
1212

13-
set(rules_swift-version "3.0.2")
14-
set(rules_apple-version "4.0.0")
1513
set(apple_support-version "1.15.1")
1614
set(abseil-cpp-version "20250512.1")
1715
set(rules_cc-version "0.0.17")

protobuf_deps.bzl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,6 @@ 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?
184-
if not native.existing_rule("build_bazel_rules_apple"):
185-
http_archive(
186-
name = "build_bazel_rules_apple",
187-
sha256 = "70b0fb2aec1055c978109199bf58ccb5008aba8e242f3305194045c271ca3cae",
188-
url = "https://github.com/bazelbuild/rules_apple/releases/download/4.0.0/rules_apple.4.0.0.tar.gz",
189-
)
190-
191174
if not native.existing_rule("build_bazel_apple_support"):
192175
http_archive(
193176
name = "build_bazel_apple_support",

ruby/ext/google/protobuf_c/BUILD.bazel

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@build_bazel_rules_apple//apple:apple_binary.bzl", "apple_binary")
1+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
22
load("@rules_cc//cc:cc_library.bzl", "cc_library")
33
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
44
load("//upb/cmake:build_defs.bzl", "staleness_test")
@@ -111,30 +111,26 @@ cc_library(
111111
alwayslink = 1,
112112
)
113113

114-
apple_binary(
114+
cc_binary(
115115
name = "ffi_bundle",
116-
binary_type = "loadable_bundle",
117116
linkopts = [
118-
"-undefined,dynamic_lookup",
119-
"-multiply_defined,suppress",
117+
"-Wl,-undefined,dynamic_lookup",
118+
"-Wl,-multiply_defined,suppress",
119+
"-Wl,-bundle",
120120
],
121-
minimum_os_version = "12.0",
122-
platform_type = "macos",
123121
tags = ["manual"],
124122
deps = [
125123
":protobuf_c_ffi",
126124
],
127125
)
128126

129-
apple_binary(
127+
cc_binary(
130128
name = "bundle",
131-
binary_type = "loadable_bundle",
132129
linkopts = [
133-
"-undefined,dynamic_lookup",
134-
"-multiply_defined,suppress",
130+
"-Wl,-undefined,dynamic_lookup",
131+
"-Wl,-multiply_defined,suppress",
132+
"-Wl,-bundle",
135133
],
136-
minimum_os_version = "12.0",
137-
platform_type = "macos",
138134
tags = ["manual"],
139135
deps = [
140136
":protobuf_c",

0 commit comments

Comments
 (0)