Fix crash for packages with `executableTarget` (#296)
* Infer executable targets' source folder * Don't initialize FSWatch without watchable paths * Update Sources/CartonKit/Server/Server.swift Co-authored-by: Max Desiatov <max@desiatov.com> * Update Sources/CartonKit/Server/Server.swift Co-authored-by: Max Desiatov <max@desiatov.com>
This commit is contained in:
parent
7bd54d6c0c
commit
f5b8e63abe
|
@ -172,11 +172,13 @@ public actor Server {
|
|||
return
|
||||
}
|
||||
|
||||
watcher = FSWatch(paths: builder.pathsToWatch, latency: 0.1) { [weak self] changes in
|
||||
guard let self = self, !changes.isEmpty else { return }
|
||||
Task { try await self.onChange(changes, configuration) }
|
||||
if !builder.pathsToWatch.isEmpty {
|
||||
watcher = FSWatch(paths: builder.pathsToWatch, latency: 0.1) { [weak self] changes in
|
||||
guard let self = self, !changes.isEmpty else { return }
|
||||
Task { try await self.onChange(changes, configuration) }
|
||||
}
|
||||
try watcher?.start()
|
||||
}
|
||||
try watcher?.start()
|
||||
}
|
||||
|
||||
private func onChange(_ changes: [AbsolutePath], _ configuration: Configuration) async throws {
|
||||
|
|
|
@ -183,9 +183,9 @@ public final class Toolchain {
|
|||
|
||||
guard let path = target.path else {
|
||||
switch target.type {
|
||||
case .regular:
|
||||
case .regular, .executable:
|
||||
return RelativePath("Sources").appending(component: target.name).pathString
|
||||
case .test, .system, .executable, .binary, .plugin:
|
||||
case .test, .system, .binary, .plugin:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue