swift-lang: shuffle the source directory structure (NFC)

This moves the swift-lang library out of the tools/SourceKit directory
and into the stdlib directory.  As it stands, the library required that
the standard library and the SDK overlay was being built.  This is
implicitly done when building the stdlib subdirectory.  Furthermore, it
had an odd tie between the flags for Swift and SourceKit which now have
the logic separated.  This clearly delineates the host and target
components in the repository.
This commit is contained in:
Saleem Abdulrasool
2020-02-13 14:13:32 -08:00
committed by Saleem Abdulrasool
parent 3777ec0eaf
commit edbe22b63c
10 changed files with 35 additions and 32 deletions

View File

@@ -0,0 +1,43 @@
//===--------------------- SourceKitdClient.swift -------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// This file provides a wrapper of SourceKitd service.
//===----------------------------------------------------------------------===//
import sourcekitd
public class SourceKitdService {
public init() {
sourcekitd_initialize()
}
deinit {
sourcekitd_shutdown()
}
/// Send a request synchronously with a handler for its response.
/// - Parameter request: The request to send.
/// - Returns: The response from the sourcekitd service.
public func sendSyn(request: SourceKitdRequest) -> SourceKitdResponse {
return SourceKitdResponse(resp: sourcekitd_send_request_sync(request.rawRequest))
}
/// Send a request asynchronously with a handler for its response.
/// - Parameter request: The request to send.
/// - Parameter handler: The handler for the response in the future.
public func send(request: SourceKitdRequest,
handler: @escaping (SourceKitdResponse) -> ()) {
sourcekitd_send_request(request.rawRequest, nil) { response in
guard let response = response else { return }
handler(SourceKitdResponse(resp: response))
}
}
}