Skip to content

Commit

Permalink
[ObjC] build universal binary for grpc_proto_plugin on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
HannahShiSFB committed Jan 2, 2025
1 parent f39cd0f commit 0e195fb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bazel/grpc_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Contains macros used throughout the repo.
"""

load("@build_bazel_apple_support//rules:universal_binary.bzl", "universal_binary")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner")
load("@com_google_protobuf//bazel:upb_proto_library.bzl", "upb_proto_library", "upb_proto_reflection_library")
Expand Down Expand Up @@ -237,10 +238,23 @@ def grpc_cc_library(

def grpc_proto_plugin(name, srcs = [], deps = []):
native.cc_binary(
name = name,
name = name + "_native",
srcs = srcs,
deps = deps,
)
universal_binary(
name = name + "_universal",
binary = name + "_native",
)
native.genrule(
name = name,
srcs = select({
"@platforms//os:macos": [name + "_universal"],
"//conditions:default": [name + "_native"],
}),
outs = [name],
cmd = "cp $< $@",
)

def grpc_internal_proto_library(
name,
Expand Down

0 comments on commit 0e195fb

Please sign in to comment.