Skip to content

Commit c3a8716

Browse files
authored
Reorganize project files & reduce public interface (#212)
Reorganizes files in the project to be more clearly and consistently organized by visibility (whether the types within each file should be internal to the package or public). Also reduces the public interface of the module by moving some types to `internal` or `package`. Note that `package` is specific to SPM, so the keyword cannot be used in conjunction with CocoaPods. For this reason, a few of the types are guarded with `#if COCOAPODS`. It's also worth noting that `ConnectNIO` cannot be consumed via CocoaPods today because NIO does not support CocoaPods. For this reason, the shared gRPC interfaces between `Connect` and `ConnectNIO` don't need to be exposed to CocoaPods at all. Additionally, [`package` requires Swift 5.9](https://github.com/apple/swift-evolution/blob/main/proposals/0386-package-access-modifier.md), so the Swift package version has been updated as well. New directory structure: ``` . ├── Examples │   ├── ElizaCocoaPodsApp │   ├── ElizaSharedSources │   │   ├── AppSources │   │   └── GeneratedSources │   │   └── connectrpc │   │   └── eliza │   │   └── v1 │   └── ElizaSwiftPackageApp │   └── ElizaSwiftPackageApp ├── Libraries │   ├── Connect │   │   ├── Internal │   │   │   ├── Generated │   │   │   │   └── grpc │   │   │   │   └── status │   │   │   │   └── v1 │   │   │   ├── Interceptors │   │   │   ├── Locks │   │   │   ├── Streaming │   │   │   └── Unary │   │   ├── PackageInternal │   │   ├── Public │   │   │   ├── Implementation │   │   │   │   ├── Clients │   │   │   │   ├── Codecs │   │   │   │   └── Compression │   │   │   └── Interfaces │   │   │   ├── Interceptors │   │   │   └── Streaming │   │   │   ├── AsyncAwait │   │   │   └── Callbacks │   │   └── proto │   │   └── grpc │   │   └── status │   │   └── v1 │   ├── ConnectMocks │   └── ConnectNIO │   ├── Internal │   │   └── Extensions │   └── Public ├── Plugins │   ├── ConnectMocksPlugin │   ├── ConnectPluginUtilities │   └── ConnectSwiftPlugin └── Tests ├── ConnectLibraryTests │   ├── ConnectConformance │   ├── ConnectMocksTests │   ├── ConnectTests │   ├── Generated │   │   ├── connectrpc │   │   │   └── conformance │   │   │   └── v1 │   │   └── server │   │   └── v1 │   └── TestResources └── ConnectPluginUtilitiesTests ```
1 parent e19c6b3 commit c3a8716

File tree

64 files changed

+112
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+112
-47
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
runs-on: macos-13
4545
steps:
4646
- uses: actions/checkout@v4
47+
- name: Select Xcode version
48+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
49+
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
4750
- uses: bufbuild/[email protected]
4851
with:
4952
github_token: ${{ github.token }}

.swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ included:
44
- Plugins
55
- Tests
66
excluded:
7-
- Libraries/Connect/Implementation/Generated
7+
- Libraries/Connect/Internal/Generated
88
- Tests/ConnectLibraryTests/Generated
99
disabled_rules:
1010
- blanket_disable_command

Libraries/Connect/Implementation/Locked.swift renamed to Libraries/Connect/Internal/Locks/Locked.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ import Foundation
1616

1717
/// Class containing an internal lock which can be used to ensure thread-safe access to an
1818
/// underlying value. Conforms to `Sendable`, making it accessible from `@Sendable` closures.
19-
public final class Locked<T>: @unchecked Sendable {
19+
final class Locked<T>: @unchecked Sendable {
2020
private let lock = Lock()
2121
private var wrappedValue: T
2222

2323
/// Thread-safe access to the underlying value.
24-
public var value: T {
24+
var value: T {
2525
get { self.lock.perform { self.wrappedValue } }
2626
set { self.lock.perform { self.wrappedValue = newValue } }
2727
}
2828

2929
/// Perform an action with the underlying value, potentially updating that value.
3030
///
3131
/// - parameter action: Closure to perform with the underlying value.
32-
public func perform(action: @escaping (inout T) -> Void) {
32+
func perform(action: @escaping (inout T) -> Void) {
3333
self.lock.perform {
3434
action(&self.wrappedValue)
3535
}
3636
}
3737

38-
public init(_ value: T) {
38+
init(_ value: T) {
3939
self.wrappedValue = value
4040
}
4141
}

0 commit comments

Comments
 (0)