Skip to content

Expose SourceKitLSP library product #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ let package = Package(
name: "sourcekit-lsp",
targets: ["sourcekit-lsp"]
),
.library(
name: "_SourceKitLSP",
type: .dynamic,
targets: ["SourceKitLSP"]
),
.library(
name: "LSPBindings",
type: .static,
Expand All @@ -26,13 +31,13 @@ let package = Package(
name: "sourcekit-lsp",
dependencies: [
"LanguageServerProtocolJSONRPC",
"SourceKit",
"SourceKitLSP",
"SwiftToolsSupport-auto",
]
),

.target(
name: "SourceKit",
name: "SourceKitLSP",
dependencies: [
"BuildServerProtocol",
"IndexStoreDB",
Expand All @@ -54,16 +59,16 @@ let package = Package(
"CSKTestSupport",
"ISDBTestSupport",
"LSPTestSupport",
"SourceKit",
"SourceKitLSP",
"tibs", // Never imported, needed at runtime
"SwiftToolsSupport-auto",
]
),
.testTarget(
name: "SourceKitTests",
name: "SourceKitLSPTests",
dependencies: [
"SKTestSupport",
"SourceKit",
"SourceKitLSP",
]
),

Expand Down
2 changes: 1 addition & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ add_subdirectory(LSPLogging)
add_subdirectory(SKCore)
add_subdirectory(SKSupport)
add_subdirectory(SKSwiftPMWorkspace)
add_subdirectory(SourceKit)
add_subdirectory(SourceKitLSP)
add_subdirectory(SourceKitD)
add_subdirectory(sourcekit-lsp)
2 changes: 1 addition & 1 deletion Sources/SKTestSupport/SKSwiftPMTestWorkspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SourceKit
import SourceKitLSP
import SKSwiftPMWorkspace
import LanguageServerProtocol
import SKCore
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKTestSupport/SKTibsTestWorkspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SourceKit
import SourceKitLSP
import LanguageServerProtocol
import SKCore
import IndexStoreDB
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKTestSupport/TestServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SKCore
import TSCUtility
import LanguageServerProtocol
import LanguageServerProtocolJSONRPC
import SourceKit
import SourceKitLSP
import class Foundation.Pipe
import LSPTestSupport

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(CMAKE_VERSION VERSION_LESS 3.16)
endif()
endif()

add_library(SourceKit
add_library(SourceKitLSP
DocumentManager.swift
IndexStoreDB+MainFilesProvider.swift
SourceKitIndexDelegate.swift
Expand All @@ -14,9 +14,9 @@ add_library(SourceKit
SourceKitServer.swift
ToolchainLanguageServer.swift
Workspace.swift)
target_sources(SourceKit PRIVATE
target_sources(SourceKitLSP PRIVATE
Clang/ClangLanguageServer.swift)
target_sources(SourceKit PRIVATE
target_sources(SourceKitLSP PRIVATE
Swift/CommentXML.swift
Swift/CursorInfo.swift
Swift/Diagnostic.swift
Expand All @@ -26,10 +26,10 @@ target_sources(SourceKit PRIVATE
Swift/SourceKitD+ResponseError.swift
Swift/SwiftCommand.swift
Swift/SwiftLanguageServer.swift)
set_target_properties(SourceKit PROPERTIES
set_target_properties(SourceKitLSP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
# TODO(compnerd) reduce the exposure here, why is everything PUBLIC-ly linked?
target_link_libraries(SourceKit PUBLIC
target_link_libraries(SourceKitLSP PUBLIC
Csourcekitd
BuildServerProtocol
IndexStoreDB
Expand All @@ -42,12 +42,12 @@ target_link_libraries(SourceKit PUBLIC

if(BUILD_SHARED_LIBS)
get_swift_host_arch(swift_arch)
install(TARGETS SourceKit
install(TARGETS SourceKitLSP
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
RUNTIME DESTINATION bin)
install(FILES
$<TARGET_PROPERTY:SourceKit,Swift_MODULE_DIRECTORY>/SourceKit.swiftdoc
$<TARGET_PROPERTY:SourceKit,Swift_MODULE_DIRECTORY>/SourceKit.swiftmodule
$<TARGET_PROPERTY:SourceKitLSP,Swift_MODULE_DIRECTORY>/SourceKitLSP.swiftdoc
$<TARGET_PROPERTY:SourceKitLSP,Swift_MODULE_DIRECTORY>/SourceKitLSP.swiftmodule
DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ public final class SourceKitServer: LanguageServer {

// Start a new service.
return orLog("failed to start language service", level: .error) {
guard let service = try SourceKit.languageService(for: toolchain, language, options: options, client: self, in: workspace) else {
guard let service = try SourceKitLSP.languageService(
for: toolchain, language, options: options, client: self, in: workspace)
else {
return nil
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Sources/sourcekit-lsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ add_executable(sourcekit-lsp
main.swift)
target_link_libraries(sourcekit-lsp PRIVATE
LanguageServerProtocolJSONRPC
SourceKit
SourceKitLSP
TSCUtility)

install(TARGETS sourcekit-lsp
Expand Down
2 changes: 1 addition & 1 deletion Sources/sourcekit-lsp/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import LanguageServerProtocolJSONRPC
import LSPLogging
import SKCore
import SKSupport
import SourceKit
import SourceKitLSP
import Csourcekitd // Not needed here, but fixes debugging...
import TSCBasic
import TSCLibc
Expand Down
4 changes: 2 additions & 2 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SKCoreTests
import SKSupportTests
import SKSwiftPMWorkspaceTests
import SourceKitDTests
import SourceKitTests
import SourceKitLSPTests

var tests = [XCTestCaseEntry]()
tests += LSPLoggingTests.__allTests()
Expand All @@ -17,6 +17,6 @@ tests += SKCoreTests.__allTests()
tests += SKSupportTests.__allTests()
tests += SKSwiftPMWorkspaceTests.__allTests()
tests += SourceKitDTests.__allTests()
tests += SourceKitTests.__allTests()
tests += SourceKitLSPTests.__allTests()

XCTMain(tests)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import LanguageServerProtocol
import LSPTestSupport
import SKCore
import SKTestSupport
import SourceKit
import SourceKitLSP
import TSCBasic
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import LanguageServerProtocol
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

final class CodeActionTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol
import LSPTestSupport
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

final class DocumentColorTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol
import LSPTestSupport
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

final class DocumentSymbolTest: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol
import LSPTestSupport
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

final class ExecuteCommandTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import LanguageServerProtocol
import LSPLogging
import LSPTestSupport
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

// Workaround ambiguity with Foundation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SourceKit
import SourceKitLSP
import SKCore
import SKTestSupport
import LanguageServerProtocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SourceKit
import SourceKitLSP
import SKCore
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol
import LSPTestSupport
import SKTestSupport
import SourceKit
import SourceKitLSP
import XCTest

final class SwiftCompletionTests: XCTestCase {
Expand Down