Skip to content

Commit 8ff6a98

Browse files
committed
[sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test', so that running 'check-swift' will also run all the SourceKit tests. SourceKit is disabled on non-darwin platforms.
1 parent 598a129 commit 8ff6a98

File tree

379 files changed

+51992
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+51992
-1
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ option(SWIFT_BUILD_STATIC_STDLIB
4444
"Build static variants of the Swift standard library and SDK overlay"
4545
FALSE)
4646

47+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
48+
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
49+
else()
50+
set(SWIFT_BUILD_SOURCEKIT_default FALSE)
51+
endif()
52+
option(SWIFT_BUILD_SOURCEKIT
53+
"Build SourceKit"
54+
${SWIFT_BUILD_SOURCEKIT_default})
55+
4756
option(SWIFT_INCLUDE_BENCHMARKS
4857
"Create targets for running swift benchmarks"
4958
TRUE)
@@ -77,7 +86,7 @@ set(SWIFT_ENABLE_GOLD_LINKER FALSE CACHE BOOL
7786
"Enable using the gold linker when available")
7887

7988
set(_SWIFT_KNOWN_INSTALL_COMPONENTS
80-
"compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;clang-libclang;arclite-symlink;stdlib;stdlib-experimental;sdk-overlay;editor-integration;lang-docs;tools;testsuite-tools;dev")
89+
"compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;clang-libclang;arclite-symlink;stdlib;stdlib-experimental;sdk-overlay;editor-integration;lang-docs;tools;testsuite-tools;dev;sourcekit-xpc-service;sourcekit-inproc")
8190

8291
# Set the SWIFT_INSTALL_COMPONENTS variable to the default value if it is not passed in via -D
8392
set(SWIFT_INSTALL_COMPONENTS "${_SWIFT_KNOWN_INSTALL_COMPONENTS}" CACHE STRING

test/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ function(swift_configure_lit_site_cfg source_path destination_path installed_nam
88
string(REPLACE ${CMAKE_CFG_INTDIR} ${SWIFT_BUILD_MODE} LLVM_TOOLS_DIR ${LLVM_TOOLS_BINARY_DIR})
99
string(REPLACE ${CMAKE_CFG_INTDIR} ${SWIFT_BUILD_MODE} LLVM_LIBS_DIR ${LLVM_LIBRARY_DIR})
1010

11+
if (XCODE)
12+
string(REPLACE ${CMAKE_CFG_INTDIR} Debug LIT_SWIFTLIB_DIR ${SWIFTLIB_DIR})
13+
else ()
14+
set(LIT_SWIFTLIB_DIR ${SWIFTLIB_DIR})
15+
endif ()
16+
1117
configure_lit_site_cfg("${source_path}" "${destination_path}")
1218

1319
if(NOT "${installed_name}" STREQUAL "")
@@ -39,6 +45,9 @@ function(get_test_dependencies SDK result_var_name)
3945
if(NOT SWIFT_BUILT_STANDALONE)
4046
list(APPEND deps_binaries llc)
4147
endif()
48+
if(SWIFT_BUILD_SOURCEKIT)
49+
list(APPEND deps_binaries sourcekitd-test complete-test)
50+
endif()
4251

4352
if(("${SDK}" STREQUAL "IOS") OR
4453
("${SDK}" STREQUAL "TVOS") OR
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import Bar;
2+
@import Foo;
3+
4+
void importsFoo(void);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import ImportsFoo;
2+
@import Bar;
3+
4+
void importsImportsFoo(void);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@exported import ImportedByAuxFile
2+
public func fromAuxFile() {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public typealias Foo = JSValue
2+
3+
public struct JSValue {
4+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
key.request: source.request.codecomplete.setcustom,
3+
key.results: [
4+
{
5+
key.name: "customExpr",
6+
key.kind: myuid.customExpr,
7+
key.context: [ source.lang.swift.expr ]
8+
},
9+
{
10+
key.name: "customStmt",
11+
key.kind: myuid.customStmt,
12+
key.context: [ source.lang.swift.stmt ]
13+
},
14+
{
15+
key.name: "customType",
16+
key.kind: myuid.customType,
17+
key.context: [ source.lang.swift.type ]
18+
},
19+
{
20+
key.name: "customExprOrStmtOrType",
21+
key.kind: myuid.customExprOrStmtOrType,
22+
key.context: [
23+
source.lang.swift.expr,
24+
source.lang.swift.stmt,
25+
source.lang.swift.type
26+
]
27+
}
28+
]
29+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
key.request: source.request.codecomplete.setcustom,
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
key.request: source.request.codecomplete.setcustom,
3+
key.results: [
4+
{
5+
key.name: "name",
6+
key.kind: myuid1,
7+
key.context: [
8+
invalidcontext
9+
]
10+
}
11+
]
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
key.request: source.request.codecomplete.setcustom,
3+
key.results: {}
4+
}

0 commit comments

Comments
 (0)