Skip to content

Commit 7f92c54

Browse files
committed
only import swiftprotobuf in vpnlib to debug runtime crash
1 parent fbe7ca8 commit 7f92c54

File tree

7 files changed

+15
-17
lines changed

7 files changed

+15
-17
lines changed

Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import FluidMenuBarExtra
22
import NetworkExtension
33
import SwiftUI
4+
import VPNLib
45

56
@main
67
struct DesktopApp: App {

Coder Desktop/Coder Desktop/FileSync/FileSyncDaemon.swift renamed to Coder Desktop/VPNLib/FileSync/FileSyncDaemon.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import NIO
44
import os
55

66
@MainActor
7-
protocol FileSyncDaemon: ObservableObject {
7+
public protocol FileSyncDaemon: ObservableObject {
88
var state: DaemonState { get }
99
func start() async throws
1010
func stop() async throws
1111
}
1212

1313
@MainActor
14-
class MutagenDaemon: FileSyncDaemon {
14+
public class MutagenDaemon: FileSyncDaemon {
1515
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "mutagen")
1616

17-
@Published var state: DaemonState = .stopped
17+
@Published public var state: DaemonState = .stopped
1818

1919
private var mutagenProcess: Process?
2020
private var mutagenPipe: Pipe?
@@ -26,7 +26,7 @@ class MutagenDaemon: FileSyncDaemon {
2626
private var channel: GRPCChannel?
2727
private var client: Daemon_DaemonAsyncClient?
2828

29-
init() {
29+
public init() {
3030
#if arch(arm64)
3131
mutagenPath = Bundle.main.url(forResource: "mutagen-darwin-arm64", withExtension: nil)
3232
#elseif arch(x86_64)
@@ -47,7 +47,7 @@ class MutagenDaemon: FileSyncDaemon {
4747
}
4848
}
4949

50-
func start() async throws {
50+
public func start() async throws {
5151
if case .unavailable = state { return }
5252

5353
// Stop an orphaned daemon, if there is one
@@ -97,7 +97,7 @@ class MutagenDaemon: FileSyncDaemon {
9797
group = nil
9898
}
9999

100-
func stop() async throws {
100+
public func stop() async throws {
101101
if case .unavailable = state { return }
102102
state = .stopped
103103
guard FileManager.default.fileExists(atPath: mutagenDaemonSocket.path) else {
@@ -158,14 +158,14 @@ class MutagenDaemon: FileSyncDaemon {
158158
}
159159
}
160160

161-
enum DaemonState {
161+
public enum DaemonState {
162162
case running
163163
case stopped
164164
case failed(String)
165165
case unavailable
166166
}
167167

168-
enum MutagenDaemonError: Error {
168+
public enum MutagenDaemonError: Error {
169169
case daemonStartFailure(Error)
170170
case connectionFailure(Error)
171171
}

Coder Desktop/Coder Desktop/FileSync/daemon.grpc.swift renamed to Coder Desktop/VPNLib/FileSync/daemon.grpc.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// swift-format-ignore-file
44
//
55
// Generated by the protocol buffer compiler.
6-
// Source: Coder Desktop/Coder Desktop/FileSync/daemon.proto
6+
// Source: Coder Desktop/VPNLib/FileSync/daemon.proto
77
//
88
import GRPC
99
import NIO

Coder Desktop/Coder Desktop/FileSync/daemon.pb.swift renamed to Coder Desktop/VPNLib/FileSync/daemon.pb.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// swiftlint:disable all
44
//
55
// Generated by the Swift generator plugin for the protocol buffer compiler.
6-
// Source: Coder Desktop/Coder Desktop/FileSync/daemon.proto
6+
// Source: Coder Desktop/VPNLib/FileSync/daemon.proto
77
//
88
// For information on using the generated types, please see the documentation:
99
// https://github.com/apple/swift-protobuf/

Coder Desktop/project.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ targets:
161161
- package: FluidMenuBarExtra
162162
- package: KeychainAccess
163163
- package: LaunchAtLogin
164-
- package: GRPC
165-
- package: SwiftProtobuf
166-
- package: SwiftProtobuf
167-
product: SwiftProtobufPluginLibrary
168164
scheme:
169165
testPlans:
170166
- path: Coder Desktop.xctestplan
@@ -263,6 +259,7 @@ targets:
263259
- package: SwiftProtobuf
264260
- package: SwiftProtobuf
265261
product: SwiftProtobufPluginLibrary
262+
- package: GRPC
266263
- target: CoderSDK
267264
embed: false
268265

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ $(XCPROJECT): $(PROJECT)/project.yml
4848
$(PROJECT)/VPNLib/vpn.pb.swift: $(PROJECT)/VPNLib/vpn.proto
4949
protoc --swift_opt=Visibility=public --swift_out=. 'Coder Desktop/VPNLib/vpn.proto'
5050

51-
$(PROJECT)/Coder\ Desktop/FileSync/daemon.pb.swift: $(PROJECT)/Coder\ Desktop/FileSync/daemon.proto
51+
$(PROJECT)/VPNLib/FileSync/daemon.pb.swift: $(PROJECT)/VPNLib/FileSync/daemon.proto
5252
protoc \
5353
--swift_out=.\
5454
--grpc-swift_out=. \
55-
'Coder Desktop/Coder Desktop/FileSync/daemon.proto'
55+
'Coder Desktop/VPNLib/FileSync/daemon.proto'
5656

5757
$(KEYCHAIN_FILE):
5858
security create-keychain -p "" "$(APP_SIGNING_KEYCHAIN)"
@@ -136,7 +136,7 @@ clean/build:
136136
rm -rf build/ release/ $$out
137137

138138
.PHONY: proto
139-
proto: $(PROJECT)/VPNLib/vpn.pb.swift $(PROJECT)/Coder\ Desktop/FileSync/daemon.pb.swift ## Generate Swift files from protobufs
139+
proto: $(PROJECT)/VPNLib/vpn.pb.swift $(PROJECT)/VPNLib/FileSync/daemon.pb.swift ## Generate Swift files from protobufs
140140

141141
.PHONY: help
142142
help: ## Show this help

0 commit comments

Comments
 (0)