Skip to content

Commit c84000b

Browse files
author
Karim Alweheshy
committed
update to split 3rd party libs
1 parent 5a926d5 commit c84000b

File tree

20 files changed

+201
-82
lines changed

20 files changed

+201
-82
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ common --incompatible_allow_tags_propagation
44
# Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195)
55
build --incompatible_disallow_empty_glob
66

7-
build --host_macos_minimum_os=13.0
8-
build --macos_minimum_os=13.0
7+
build --host_macos_minimum_os=15.0
8+
build --macos_minimum_os=15.0
99

1010
# We don't need to bump some of our dependencies, just becuse our dev
1111
# dependencies cause us to use a newer version

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ use_repo(
3333
"com_github_apple_swift_nio_transport_services",
3434
"com_github_apple_swift_protobuf",
3535
"com_github_grpc_grpc_swift",
36+
"com_github_grpc_grpc_swift_protobuf",
37+
"com_github_grpc_grpc_swift_nio_transport",
3638
)
3739

3840
apple_cc_configure = use_extension("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure_extension")

doc/proto_migration.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,6 @@ swift_proto_library(
221221
],
222222
protos = [":service_proto"],
223223
)
224-
225-
swift_proto_library(
226-
name = "service_test_client_swift_proto",
227-
additional_compiler_info = {
228-
"ExtraModuleImports": "examples_xplatform_grpc_service_client_swift_proto",
229-
},
230-
compiler_deps = [
231-
":service_client_swift_proto",
232-
],
233-
compilers = ["@build_bazel_rules_swift//proto/compilers:swift_test_client_proto"],
234-
protos = [":service_proto"],
235-
)
236224
```
237225

238226
Note here that we don't need the intermediate `swift_proto_library` target,

examples/xplatform/grpc/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ swift_binary(
2020
srcs = ["server_main.swift"],
2121
deps = [
2222
"//examples/xplatform/grpc/service:service_server_swift_proto",
23+
"@com_github_apple_swift_nio//:NIO",
24+
"@com_github_apple_swift_nio//:NIOCore",
2325
],
2426
)
2527

@@ -28,6 +30,8 @@ swift_binary(
2830
srcs = ["client_main.swift"],
2931
deps = [
3032
"//examples/xplatform/grpc/service:service_client_swift_proto",
33+
"@com_github_apple_swift_nio//:NIO",
34+
"@com_github_apple_swift_nio//:NIOCore",
3135
],
3236
)
3337

@@ -39,6 +43,8 @@ swift_test(
3943
deps = [
4044
"//examples/xplatform/grpc/service:service_client_swift_proto",
4145
"//examples/xplatform/grpc/service:service_server_swift_proto",
46+
"@com_github_apple_swift_nio//:NIO",
47+
"@com_github_apple_swift_nio//:NIOCore",
4248
],
4349
)
4450

@@ -50,5 +56,7 @@ swift_test(
5056
deps = [
5157
"//examples/xplatform/grpc/service:service_client_swift_proto",
5258
"//examples/xplatform/grpc/service:service_test_client_swift_proto",
59+
"@com_github_apple_swift_nio//:NIO",
60+
"@com_github_apple_swift_nio//:NIOCore",
5361
],
5462
)

examples/xplatform/grpc/client_main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616
import SwiftProtobuf
17-
import GRPC
17+
import GRPCCore
1818
import NIOCore
1919
import NIOPosix
2020
import ServiceClient

examples/xplatform/grpc/client_unit_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import ServiceClient
1616
import ServiceServer
17-
import GRPC
17+
import GRPCCore
1818
import NIOCore
1919
import NIOPosix
2020
import XCTest

examples/xplatform/grpc/server_main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import Dispatch
16-
import GRPC
16+
import GRPCCore
1717
import NIOCore
1818
import NIOPosix
1919
import ServiceServer

examples/xplatform/grpc/test_client_unit_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import ServiceClient
1616
import ServiceTestClient
17-
import GRPC
17+
import GRPCCore
1818
import NIOCore
1919
import NIOPosix
2020
import XCTest

examples/xplatform/proto_library_group/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ swift_binary(
66
srcs = ["server_main.swift"],
77
deps = [
88
"//examples/xplatform/proto_library_group/service:service_server_swift_proto",
9+
"@com_github_apple_swift_nio//:NIO",
10+
"@com_github_apple_swift_nio//:NIOCore",
911
],
1012
)
1113

@@ -14,6 +16,8 @@ swift_binary(
1416
srcs = ["client_main.swift"],
1517
deps = [
1618
"//examples/xplatform/proto_library_group/service:service_client_swift_proto",
19+
"@com_github_apple_swift_nio//:NIO",
20+
"@com_github_apple_swift_nio//:NIOCore",
1721
],
1822
)
1923

@@ -25,5 +29,7 @@ swift_test(
2529
deps = [
2630
"//examples/xplatform/proto_library_group/service:service_client_swift_proto",
2731
"//examples/xplatform/proto_library_group/service:service_server_swift_proto",
32+
"@com_github_apple_swift_nio//:NIO",
33+
"@com_github_apple_swift_nio//:NIOCore",
2834
],
2935
)

examples/xplatform/proto_library_group/client_main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616
import SwiftProtobuf
17-
import GRPC
17+
import GRPCCore
1818
import NIOCore
1919
import NIOPosix
2020
import examples_xplatform_proto_library_group_request_request_proto

examples/xplatform/proto_library_group/client_unit_test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import GRPC
15+
import GRPCCore
1616
import NIOCore
1717
import NIOPosix
1818
import XCTest

examples/xplatform/proto_library_group/server_main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import Dispatch
16-
import GRPC
16+
import GRPCCore
1717
import NIOCore
1818
import NIOPosix
1919
import examples_xplatform_proto_library_group_request_request_proto

proto/compilers/swift_proto_compiler_macros.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def make_grpc_swift_proto_compiler(
7777
suffixes = [".grpc.swift"],
7878
deps = [
7979
"@com_github_apple_swift_protobuf//:SwiftProtobuf",
80-
"@com_github_grpc_grpc_swift//:GRPC",
80+
"@com_github_grpc_grpc_swift//:GRPCCodeGen",
8181
],
8282
visibility = ["//visibility:public"],
8383
)

swift/repositories.bzl

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,28 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
125125
),
126126
)
127127

128+
_maybe(
129+
http_archive,
130+
name = "com_github_grpc_grpc_swift_nio_transport",
131+
urls = ["https://github.com/grpc/grpc-swift-nio-transport/archive/1.0.0.tar.gz"], # latest at time of writing
132+
sha256 = "e590f7a30961802cbdf4f8cac37ae2dbc9ab2c8f8032c2ef2f66ed2b63623185",
133+
strip_prefix = "grpc-swift-nio-transport-1.0.0/",
134+
build_file = Label(
135+
"//third_party:com_github_grpc_grpc_swift_nio_transport/BUILD.overlay",
136+
),
137+
)
138+
139+
_maybe(
140+
http_archive,
141+
name = "com_github_grpc_grpc_swift_protobuf",
142+
urls = ["https://github.com/grpc/grpc-swift-protobuf/archive/1.0.0.tar.gz"], # latest at time of writing
143+
sha256 = "c31969782aa710e002f9a6214a9eb1e4292800e3606c2a092b034b97fdff52ac",
144+
strip_prefix = "grpc-swift-protobuf-1.0.0/",
145+
build_file = Label(
146+
"//third_party:com_github_grpc_grpc_swift_protobuf/BUILD.overlay",
147+
),
148+
)
149+
128150
_maybe(
129151
http_archive,
130152
name = "com_github_apple_swift_docc_symbolkit",
@@ -139,9 +161,9 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
139161
_maybe(
140162
http_archive,
141163
name = "com_github_apple_swift_nio",
142-
urls = ["https://github.com/apple/swift-nio/archive/2.42.0.tar.gz"], # pinned to grpc swift version
143-
sha256 = "e3304bc3fb53aea74a3e54bd005ede11f6dc357117d9b1db642d03aea87194a0",
144-
strip_prefix = "swift-nio-2.42.0/",
164+
urls = ["https://github.com/apple/swift-nio/archive/2.78.0.tar.gz"], # pinned to grpc swift version
165+
sha256 = "7262fe6a134ce83fda666429ca88a511db517f36996955dafeb2068d66b7d260",
166+
strip_prefix = "swift-nio-2.78.0/",
145167
build_file = Label(
146168
"//third_party:com_github_apple_swift_nio/BUILD.overlay",
147169
),
@@ -150,9 +172,9 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
150172
_maybe(
151173
http_archive,
152174
name = "com_github_apple_swift_nio_http2",
153-
urls = ["https://github.com/apple/swift-nio-http2/archive/1.26.0.tar.gz"], # pinned to grpc-swift version
154-
sha256 = "f0edfc9d6a7be1d587e5b403f2d04264bdfae59aac1d74f7d974a9022c6d2b25",
155-
strip_prefix = "swift-nio-http2-1.26.0/",
175+
urls = ["https://github.com/apple/swift-nio-http2/archive/1.35.0.tar.gz"], # pinned to grpc-swift version
176+
sha256 = "ffc425d7e2737d17b80a0227f2b2823eb95bd76cb681906494e5b795f64f6f5c",
177+
strip_prefix = "swift-nio-http2-1.35.0/",
156178
build_file = Label(
157179
"//third_party:com_github_apple_swift_nio_http2/BUILD.overlay",
158180
),
@@ -194,9 +216,9 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
194216
_maybe(
195217
http_archive,
196218
name = "com_github_apple_swift_nio_ssl",
197-
urls = ["https://github.com/apple/swift-nio-ssl/archive/2.23.0.tar.gz"], # pinned to grpc swift version
198-
sha256 = "4787c63f61dd04d99e498adc3d1a628193387e41efddf8de19b8db04544d016d",
199-
strip_prefix = "swift-nio-ssl-2.23.0/",
219+
urls = ["https://github.com/apple/swift-nio-ssl/archive/2.29.0.tar.gz"], # pinned to grpc swift version
220+
sha256 = "f35a05309d791ec5ff23e1b0cdff2962872e2388fa0e27fced57566bb0383ea4",
221+
strip_prefix = "swift-nio-ssl-2.29.0/",
200222
build_file = Label(
201223
"//third_party:com_github_apple_swift_nio_ssl/BUILD.overlay",
202224
),
@@ -205,9 +227,9 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True):
205227
_maybe(
206228
http_archive,
207229
name = "com_github_apple_swift_collections",
208-
urls = ["https://github.com/apple/swift-collections/archive/1.0.4.tar.gz"], # pinned to swift-nio @ grpc-swift version
209-
sha256 = "d9e4c8a91c60fb9c92a04caccbb10ded42f4cb47b26a212bc6b39cc390a4b096",
210-
strip_prefix = "swift-collections-1.0.4/",
230+
urls = ["https://github.com/apple/swift-collections/archive/1.1.3.tar.gz"], # pinned to swift-nio @ grpc-swift version
231+
sha256 = "7e5e48d0dc2350bed5919be5cf60c485e72a30bd1f2baf718a619317677b91db",
232+
strip_prefix = "swift-collections-1.1.3/",
211233
build_file = Label(
212234
"//third_party:com_github_apple_swift_collections/BUILD.overlay",
213235
),

third_party/com_github_apple_swift_collections/BUILD.overlay

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ swift_library(
1818
srcs = glob([
1919
"Sources/DequeModule/**/*.swift",
2020
]),
21+
deps = [
22+
":InternalCollectionsUtilities",
23+
],
2124
module_name = "DequeModule",
2225
visibility = ["//visibility:public"],
2326
)
@@ -27,6 +30,18 @@ swift_library(
2730
srcs = glob([
2831
"Sources/OrderedCollections/**/*.swift",
2932
]),
33+
deps = [
34+
":InternalCollectionsUtilities",
35+
],
3036
module_name = "OrderedCollections",
3137
visibility = ["//visibility:public"],
3238
)
39+
40+
swift_library(
41+
name = "InternalCollectionsUtilities",
42+
srcs = glob([
43+
"Sources/InternalCollectionsUtilities/**/*.swift",
44+
]),
45+
module_name = "InternalCollectionsUtilities",
46+
visibility = ["//visibility:public"],
47+
)

third_party/com_github_apple_swift_nio/BUILD.overlay

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,24 @@ swift_library(
155155
":CNIOLinux",
156156
":CNIOWindows",
157157
":NIOConcurrencyHelpers",
158+
":_NIODataStructures",
159+
":_NIOBase64",
158160
"@com_github_apple_swift_atomics//:Atomics",
159161
"@com_github_apple_swift_collections//:DequeModule",
160162
],
161163
)
162164

165+
swift_library(
166+
name = "_NIOBase64",
167+
srcs = glob([
168+
"Sources/_NIOBase64/*.swift",
169+
]),
170+
copts = [],
171+
module_name = "_NIOBase64",
172+
visibility = ["//visibility:public"],
173+
deps = [],
174+
)
175+
163176
swift_library(
164177
name = "NIOEmbedded",
165178
srcs = glob([
Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,41 @@
1-
load("@build_bazel_rules_swift//swift:swift_binary.bzl", "swift_binary")
2-
load(
3-
"@build_bazel_rules_swift//swift:swift_interop_hint.bzl",
4-
"swift_interop_hint",
5-
)
61
load("@build_bazel_rules_swift//swift:swift_library.bzl", "swift_library")
72

8-
cc_library(
9-
name = "CGRPCZlib",
10-
srcs = glob([
11-
"Sources/CGRPCZlib/**/*.c",
12-
]),
13-
hdrs = glob([
14-
"Sources/CGRPCZlib/**/*.h",
15-
]),
16-
aspect_hints = [":CGRPCZLIB_interop"],
17-
includes = ["Sources/CGRPCZlib/include"],
18-
linkopts = ["-lz"],
19-
)
20-
21-
swift_interop_hint(
22-
name = "CGRPCZLIB_interop",
23-
module_name = "CGRPCZlib",
24-
)
25-
263
swift_library(
27-
name = "GRPC",
4+
name = "GRPCCodeGen",
285
srcs = glob([
29-
"Sources/GRPC/**/*.swift",
6+
"Sources/GRPCCodeGen/**/*.swift",
307
]),
318
defines = ["SWIFT_PACKAGE"], # activates CgRPC imports
32-
module_name = "GRPC",
9+
module_name = "GRPCCodeGen",
10+
package_name = "GRPCCodeGen",
3311
visibility = ["//visibility:public"],
34-
deps = [
35-
":CGRPCZlib",
36-
"@com_github_apple_swift_log//:Logging",
37-
"@com_github_apple_swift_nio//:NIO",
38-
"@com_github_apple_swift_nio//:NIOCore",
39-
"@com_github_apple_swift_nio//:NIOEmbedded",
40-
"@com_github_apple_swift_nio//:NIOFoundationCompat",
41-
"@com_github_apple_swift_nio//:NIOHTTP1",
42-
"@com_github_apple_swift_nio//:NIOPosix",
43-
"@com_github_apple_swift_nio//:NIOTLS",
44-
"@com_github_apple_swift_nio_extras//:NIOExtras",
45-
"@com_github_apple_swift_nio_http2//:NIOHTTP2",
46-
"@com_github_apple_swift_nio_ssl//:NIOSSL",
47-
"@com_github_apple_swift_nio_transport_services//:NIOTransportServices",
48-
"@com_github_apple_swift_protobuf//:SwiftProtobuf",
12+
features = [
13+
"swift.upcoming.ExistentialAny",
14+
"swift.upcoming.InternalImportsByDefault",
15+
"swift.upcoming.MemberImportVisibility",
16+
"swift.enable_v6",
4917
],
18+
deps = [],
5019
)
5120

52-
swift_binary(
53-
name = "protoc-gen-grpc-swift",
21+
swift_library(
22+
name = "GRPCCore",
5423
srcs = glob([
55-
"Sources/protoc-gen-grpc-swift/*.swift",
24+
"Sources/GRPCCore/**/*.swift",
25+
], exclude = [
26+
"Sources/GRPCCore/Documentation.docc/**/*",
5627
]),
28+
defines = ["SWIFT_PACKAGE"], # activates CgRPC imports
29+
module_name = "GRPCCore",
30+
package_name = "GRPCCore",
5731
visibility = ["//visibility:public"],
32+
features = [
33+
"swift.upcoming.ExistentialAny",
34+
"swift.upcoming.InternalImportsByDefault",
35+
"swift.upcoming.MemberImportVisibility",
36+
"swift.enable_v6",
37+
],
5838
deps = [
59-
"@com_github_apple_swift_protobuf//:SwiftProtobuf",
60-
"@com_github_apple_swift_protobuf//:SwiftProtobufPluginLibrary",
39+
"@com_github_apple_swift_collections//:DequeModule",
6140
],
6241
)

0 commit comments

Comments
 (0)