Skip to content

Commit

Permalink
Add DebugSinkOf
Browse files Browse the repository at this point in the history
Xcode debugger can't step into `SinkType.put()`.
Using `DebugSinkOf` instead of `SinkOf` allow step into `SinkType.put()`

ReactiveCocoa/ReactiveCocoa#2021
  • Loading branch information
norio-nomura committed May 23, 2015
1 parent 90cbac5 commit f10efaf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Source/CarthageKit/Git.swift
Expand Up @@ -134,7 +134,7 @@ extension Submodule: Printable {

/// Shells out to `git` with the given arguments, optionally in the directory
/// of an existing repository.
public func launchGitTask(arguments: [String], repositoryFileURL: NSURL? = nil, standardInput: SignalProducer<NSData, NoError>? = nil, standardOutput: SinkOf<NSData>? = nil, standardError: SinkOf<NSData>? = nil, environment: [String: String]? = nil) -> SignalProducer<String, CarthageError> {
public func launchGitTask(arguments: [String], repositoryFileURL: NSURL? = nil, standardInput: SignalProducer<NSData, NoError>? = nil, standardOutput: SinkOfNSData? = nil, standardError: SinkOfNSData? = nil, environment: [String: String]? = nil) -> SignalProducer<String, CarthageError> {
let taskDescription = TaskDescription(launchPath: "/usr/bin/env", arguments: [ "git" ] + arguments, workingDirectoryPath: repositoryFileURL?.path, environment: environment, standardInput: standardInput)

return launchTask(taskDescription, standardOutput: standardOutput, standardError: standardError)
Expand Down Expand Up @@ -195,7 +195,7 @@ public func listTags(repositoryFileURL: NSURL) -> SignalProducer<String, Carthag
/// the path could not be loaded.
public func contentsOfFileInRepository(repositoryFileURL: NSURL, path: String, revision: String = "HEAD") -> SignalProducer<String, CarthageError> {
let showObject = "\(revision):\(path)"
return launchGitTask([ "show", showObject ], repositoryFileURL: repositoryFileURL, standardError: SinkOf<NSData> { _ in () })
return launchGitTask([ "show", showObject ], repositoryFileURL: repositoryFileURL, standardError: SinkOfNSData { _ in () })
}

/// Checks out the working tree of the given (ideally bare) repository, at the
Expand Down Expand Up @@ -352,7 +352,7 @@ public func submodulesInRepository(repositoryFileURL: NSURL, revision: String =
let modulesObject = "\(revision):.gitmodules"
let baseArguments = [ "config", "--blob", modulesObject, "-z" ]

return launchGitTask(baseArguments + [ "--get-regexp", "submodule\\..*\\.path" ], repositoryFileURL: repositoryFileURL, standardError: SinkOf<NSData> { _ in () })
return launchGitTask(baseArguments + [ "--get-regexp", "submodule\\..*\\.path" ], repositoryFileURL: repositoryFileURL, standardError: SinkOfNSData { _ in () })
|> catch { _ in SignalProducer<String, NoError>.empty }
|> map { value in parseConfigEntries(value, keyPrefix: "submodule.", keySuffix: ".path") }
|> flatten(.Concat)
Expand Down Expand Up @@ -381,7 +381,7 @@ public func commitExistsInRepository(repositoryFileURL: NSURL, revision: String
return
}

launchGitTask([ "rev-parse", "\(revision)^{commit}" ], repositoryFileURL: repositoryFileURL, standardOutput: SinkOf<NSData> { _ in () }, standardError: SinkOf<NSData> { _ in () })
launchGitTask([ "rev-parse", "\(revision)^{commit}" ], repositoryFileURL: repositoryFileURL, standardOutput: SinkOfNSData { _ in () }, standardError: SinkOfNSData { _ in () })
|> then(SignalProducer<Bool, CarthageError>(value: true))
|> catch { _ in SignalProducer<Bool, NoError>(value: false) }
|> startWithSignal { signal, signalDisposable in
Expand All @@ -393,7 +393,7 @@ public func commitExistsInRepository(repositoryFileURL: NSURL, revision: String

/// Attempts to resolve the given reference into an object SHA.
public func resolveReferenceInRepository(repositoryFileURL: NSURL, reference: String) -> SignalProducer<String, CarthageError> {
return launchGitTask([ "rev-parse", "\(reference)^{object}" ], repositoryFileURL: repositoryFileURL, standardError: SinkOf<NSData> { _ in () })
return launchGitTask([ "rev-parse", "\(reference)^{object}" ], repositoryFileURL: repositoryFileURL, standardError: SinkOfNSData { _ in () })
|> map { string in string.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) }
|> catch { _ in SignalProducer(error: CarthageError.RepositoryCheckoutFailed(workingDirectoryURL: repositoryFileURL, reason: "No object named \"\(reference)\" exists", underlyingError: nil)) }
}
Expand Down
2 changes: 1 addition & 1 deletion Source/CarthageKit/Xcode.swift
Expand Up @@ -770,7 +770,7 @@ public func buildScheme(scheme: String, withConfiguration configuration: String,
var buildScheme = xcodebuildTask("build", copiedArgs)
buildScheme.workingDirectoryPath = workingDirectoryURL.path!

return launchTask(buildScheme, standardOutput: SinkOf { data in
return launchTask(buildScheme, standardOutput: SinkOfNSData { data in
sendNext(stdoutSink, data)
})
|> catch { error in SignalProducer(error: .TaskError(error)) }
Expand Down
2 changes: 1 addition & 1 deletion Source/CarthageKitTests/XcodeSpec.swift
Expand Up @@ -118,7 +118,7 @@ class XcodeSpec: QuickSpec {
var output: String = ""
let codeSign = TaskDescription(launchPath: "/usr/bin/xcrun", arguments: [ "codesign", "--verify", "--verbose", targetURL.path! ])

let codesignResult = launchTask(codeSign, standardError: SinkOf<NSData> { data -> () in
let codesignResult = launchTask(codeSign, standardError: SinkOfNSData { data -> () in
output += NSString(data: data, encoding: NSStringEncoding(NSUTF8StringEncoding))! as String
})
|> wait
Expand Down
2 changes: 1 addition & 1 deletion Source/carthage/Build.swift
Expand Up @@ -49,7 +49,7 @@ public struct BuildCommand: CommandType {
|> filter { _ in false }
|> observe(stderrSink)

let stderrSinkWrapper: SinkOf<NSData> = SinkOf { data in
let stderrSinkWrapper: SinkOfNSData = SinkOfNSData { data in
stderrSink.put(.Next(Box(data)))
return
}
Expand Down

0 comments on commit f10efaf

Please sign in to comment.