Skip to content

Commit 453ebfb

Browse files
committed
Make FallbackBuildSystem not conform to BuildSystem and remove no-op functions from it
1 parent d6101a1 commit 453ebfb

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

Sources/SKCore/BuildSystemManager.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public actor BuildSystemManager {
120120

121121
public func filesDidChange(_ events: [FileEvent]) async {
122122
await self.buildSystem?.filesDidChange(events)
123-
self.fallbackBuildSystem?.filesDidChange(events)
124123
}
125124
}
126125

@@ -206,7 +205,6 @@ extension BuildSystemManager {
206205
}
207206

208207
await buildSystem?.registerForChangeNotifications(for: mainFile, language: language)
209-
fallbackBuildSystem?.registerForChangeNotifications(for: mainFile, language: language)
210208
}
211209

212210
/// Return settings for `file` based on the `change` settings for `mainFile`.
@@ -248,7 +246,7 @@ extension BuildSystemManager {
248246
public func fileHandlingCapability(for uri: DocumentURI) async -> FileHandlingCapability {
249247
return max(
250248
await buildSystem?.fileHandlingCapability(for: uri) ?? .unhandled,
251-
fallbackBuildSystem?.fileHandlingCapability(for: uri) ?? .unhandled
249+
fallbackBuildSystem != nil ? .fallback : .unhandled
252250
)
253251
}
254252
}

Sources/SKCore/FallbackBuildSystem.swift

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import class TSCBasic.Process
2121
import struct TSCBasic.AbsolutePath
2222

2323
/// A simple BuildSystem suitable as a fallback when accurate settings are unknown.
24-
public final class FallbackBuildSystem: BuildSystem {
24+
public final class FallbackBuildSystem {
2525

2626
let buildSetup: BuildSetup
2727

@@ -59,13 +59,6 @@ public final class FallbackBuildSystem: BuildSystem {
5959
}
6060
}
6161

62-
public func registerForChangeNotifications(for uri: DocumentURI, language: Language) {
63-
// Fallback build systems never change.
64-
}
65-
66-
/// We don't support change watching.
67-
public func unregisterForChangeNotifications(for: DocumentURI) {}
68-
6962
func settingsSwift(_ file: String) -> FileBuildSettings {
7063
var args: [String] = []
7164
args.append(contentsOf: self.buildSetup.flags.swiftCompilerFlags)
@@ -98,10 +91,4 @@ public final class FallbackBuildSystem: BuildSystem {
9891
args.append(file)
9992
return FileBuildSettings(compilerArguments: args)
10093
}
101-
102-
public func filesDidChange(_ events: [FileEvent]) {}
103-
104-
public func fileHandlingCapability(for uri: DocumentURI) -> FileHandlingCapability {
105-
return .fallback
106-
}
10794
}

Tests/SKCoreTests/BuildSystemManagerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ final class BuildSystemManagerTests: XCTestCase {
3434
]
3535

3636
let bsm = await BuildSystemManager(
37-
buildSystem: FallbackBuildSystem(buildSetup: .default),
38-
fallbackBuildSystem: nil,
37+
buildSystem: nil,
38+
fallbackBuildSystem: FallbackBuildSystem(buildSetup: .default),
3939
mainFilesProvider: mainFiles)
4040
defer { withExtendedLifetime(bsm) {} } // Keep BSM alive for callbacks.
4141

0 commit comments

Comments
 (0)