Skip to content

Commit 9dd047d

Browse files
committed
TSCBasic: remove some deprecated interfaces in Process
These interfaces were deprecated in 2022, remove these now. While there were some instances of the `init` still in use. Thanks to @MaxDesiatov and @weissi for the help to verify the safe removal of these deprecated interfaces.
1 parent 5b6b256 commit 9dd047d

File tree

1 file changed

+2
-82
lines changed

1 file changed

+2
-82
lines changed

Sources/TSCBasic/Process/Process.swift

+2-82
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ public final class Process {
227227
private static let loggingHandlerLock = NSLock()
228228

229229
/// Global logging handler. Use with care! preferably use instance level instead of setting one globally.
230+
@available(*, deprecated, message: "use instance level `loggingHandler` passed via `init` instead of setting one globally.")
230231
public static var loggingHandler: LoggingHandler? {
231232
get {
232233
Self.loggingHandlerLock.withLock {
@@ -239,45 +240,7 @@ public final class Process {
239240
}
240241
}
241242

242-
// deprecated 2/2022, remove once client migrate to logging handler
243-
@available(*, deprecated)
244-
public static var verbose: Bool {
245-
get {
246-
Self.loggingHandler != nil
247-
} set {
248-
Self.loggingHandler = newValue ? Self.logToStdout: .none
249-
}
250-
}
251-
252-
private var _loggingHandler: LoggingHandler?
253-
254-
// the log and setter are only required to backward support verbose setter.
255-
// remove and make loggingHandler a let property once verbose is deprecated
256-
private let loggingHandlerLock = NSLock()
257-
public private(set) var loggingHandler: LoggingHandler? {
258-
get {
259-
self.loggingHandlerLock.withLock {
260-
self._loggingHandler
261-
}
262-
}
263-
set {
264-
self.loggingHandlerLock.withLock {
265-
self._loggingHandler = newValue
266-
}
267-
}
268-
}
269-
270-
// deprecated 2/2022, remove once client migrate to logging handler
271-
// also simplify loggingHandler (see above) once this is removed
272-
@available(*, deprecated)
273-
public var verbose: Bool {
274-
get {
275-
self.loggingHandler != nil
276-
}
277-
set {
278-
self.loggingHandler = newValue ? Self.logToStdout : .none
279-
}
280-
}
243+
public let loggingHandler: LoggingHandler?
281244

282245
/// The current environment.
283246
@available(*, deprecated, message: "use ProcessEnv.vars instead")
@@ -377,31 +340,6 @@ public final class Process {
377340
self.loggingHandler = loggingHandler ?? Process.loggingHandler
378341
}
379342

380-
// deprecated 2/2022
381-
@_disfavoredOverload
382-
@available(*, deprecated, message: "use version without verbosity flag")
383-
@available(macOS 10.15, *)
384-
public convenience init(
385-
arguments: [String],
386-
environment: [String: String] = ProcessEnv.vars,
387-
workingDirectory: AbsolutePath,
388-
outputRedirection: OutputRedirection = .collect,
389-
verbose: Bool,
390-
startNewProcessGroup: Bool = true
391-
) {
392-
self.init(
393-
arguments: arguments,
394-
environment: environment,
395-
workingDirectory: workingDirectory,
396-
outputRedirection: outputRedirection,
397-
startNewProcessGroup: startNewProcessGroup,
398-
loggingHandler: verbose ? { message in
399-
stdoutStream.send(message).send("\n")
400-
stdoutStream.flush()
401-
} : nil
402-
)
403-
}
404-
405343
/// Create a new process instance.
406344
///
407345
/// - Parameters:
@@ -428,24 +366,6 @@ public final class Process {
428366
self.loggingHandler = loggingHandler ?? Process.loggingHandler
429367
}
430368

431-
@_disfavoredOverload
432-
@available(*, deprecated, message: "use version without verbosity flag")
433-
public convenience init(
434-
arguments: [String],
435-
environment: [String: String] = ProcessEnv.vars,
436-
outputRedirection: OutputRedirection = .collect,
437-
verbose: Bool = Process.verbose,
438-
startNewProcessGroup: Bool = true
439-
) {
440-
self.init(
441-
arguments: arguments,
442-
environment: environment,
443-
outputRedirection: outputRedirection,
444-
startNewProcessGroup: startNewProcessGroup,
445-
loggingHandler: verbose ? Self.logToStdout : .none
446-
)
447-
}
448-
449369
public convenience init(
450370
args: String...,
451371
environment: [String: String] = ProcessEnv.vars,

0 commit comments

Comments
 (0)