@@ -13,6 +13,8 @@ var products: [Product] = [
1313 . executable( name: " sourcekit-lsp " , targets: [ " sourcekit-lsp " ] ) ,
1414 . library( name: " _SourceKitLSP " , targets: [ " SourceKitLSP " ] ) ,
1515 . library( name: " LSPBindings " , targets: [ " LanguageServerProtocol " , " LanguageServerProtocolJSONRPC " ] ) ,
16+ . library( name: " SwiftSourceKitPlugin " , type: . dynamic, targets: [ " SwiftSourceKitPlugin " ] ) ,
17+ . library( name: " SwiftSourceKitClientPlugin " , type: . dynamic, targets: [ " SwiftSourceKitClientPlugin " ] ) ,
1618]
1719
1820var targets : [ Target ] = [
@@ -111,6 +113,45 @@ var targets: [Target] = [
111113 dependencies: [ ]
112114 ) ,
113115
116+ . target(
117+ name: " CCompletionScoring " ,
118+ dependencies: [ ]
119+ ) ,
120+
121+ // MARK: CompletionScoring
122+
123+ . target(
124+ name: " CompletionScoring " ,
125+ dependencies: [ " CCompletionScoring " ] ,
126+ swiftSettings: globalSwiftSettings
127+ ) ,
128+
129+ . target(
130+ name: " CompletionScoringForPlugin " ,
131+ dependencies: [ " CCompletionScoring " ] ,
132+ swiftSettings: globalSwiftSettings
133+ ) ,
134+
135+ . testTarget(
136+ name: " CompletionScoringTests " ,
137+ dependencies: [ " CompletionScoring " , " CompletionScoringTestSupport " , " SwiftExtensions " ] ,
138+ swiftSettings: globalSwiftSettings
139+ ) ,
140+
141+ . testTarget(
142+ name: " CompletionScoringPerfTests " ,
143+ dependencies: [ " CompletionScoring " , " CompletionScoringTestSupport " , " SwiftExtensions " ] ,
144+ swiftSettings: globalSwiftSettings
145+ ) ,
146+
147+ // MARK: CompletionScoringTestSupport
148+
149+ . target(
150+ name: " CompletionScoringTestSupport " ,
151+ dependencies: [ " CompletionScoring " , " SwiftExtensions " ] ,
152+ swiftSettings: globalSwiftSettings
153+ ) ,
154+
114155 // MARK: CSKTestSupport
115156
116157 . target(
@@ -275,6 +316,21 @@ var targets: [Target] = [
275316 swiftSettings: globalSwiftSettings + lspLoggingSwiftSettings
276317 ) ,
277318
319+ . target(
320+ name: " SKLoggingForPlugin " ,
321+ dependencies: [
322+ " SwiftExtensionsForPlugin "
323+ ] ,
324+ exclude: [ " CMakeLists.txt " ] ,
325+ swiftSettings: globalSwiftSettings + lspLoggingSwiftSettings + [
326+ // We can't depend on swift-crypto in the plugin because we can't module-alias it due to https://github.com/swiftlang/swift-package-manager/issues/8119
327+ . define( " NO_CRYPTO_DEPENDENCY " ) ,
328+ . unsafeFlags( [
329+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
330+ ] ) ,
331+ ]
332+ ) ,
333+
278334 . testTarget(
279335 name: " SKLoggingTests " ,
280336 dependencies: [
@@ -310,6 +366,21 @@ var targets: [Target] = [
310366 swiftSettings: globalSwiftSettings
311367 ) ,
312368
369+ . target(
370+ name: " SKUtilitiesForPlugin " ,
371+ dependencies: [
372+ " SKLoggingForPlugin " ,
373+ " SwiftExtensionsForPlugin " ,
374+ ] ,
375+ exclude: [ " CMakeLists.txt " ] ,
376+ swiftSettings: globalSwiftSettings + [
377+ . unsafeFlags( [
378+ " -module-alias " , " SKLogging=SKLoggingForPlugin " ,
379+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
380+ ] )
381+ ]
382+ ) ,
383+
313384 . testTarget(
314385 name: " SKUtilitiesTests " ,
315386 dependencies: [
@@ -356,6 +427,22 @@ var targets: [Target] = [
356427 swiftSettings: globalSwiftSettings
357428 ) ,
358429
430+ . target(
431+ name: " SourceKitDForPlugin " ,
432+ dependencies: [
433+ " Csourcekitd " ,
434+ " SKLoggingForPlugin " ,
435+ " SwiftExtensionsForPlugin " ,
436+ ] ,
437+ exclude: [ " CMakeLists.txt " , " sourcekitd_uids.swift.gyb " ] ,
438+ swiftSettings: globalSwiftSettings + [
439+ . unsafeFlags( [
440+ " -module-alias " , " SKLogging=SKLoggingForPlugin " ,
441+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
442+ ] )
443+ ]
444+ ) ,
445+
359446 . testTarget(
360447 name: " SourceKitDTests " ,
361448 dependencies: [
@@ -433,6 +520,13 @@ var targets: [Target] = [
433520 swiftSettings: globalSwiftSettings
434521 ) ,
435522
523+ . target(
524+ name: " SwiftExtensionsForPlugin " ,
525+ dependencies: [ " CAtomics " ] ,
526+ exclude: [ " CMakeLists.txt " ] ,
527+ swiftSettings: globalSwiftSettings
528+ ) ,
529+
436530 . testTarget(
437531 name: " SwiftExtensionsTests " ,
438532 dependencies: [
@@ -443,6 +537,84 @@ var targets: [Target] = [
443537 swiftSettings: globalSwiftSettings
444538 ) ,
445539
540+ // MARK: SwiftSourceKitClientPlugin
541+
542+ . target(
543+ name: " SwiftSourceKitClientPlugin " ,
544+ dependencies: [
545+ " Csourcekitd " ,
546+ " SourceKitDForPlugin " ,
547+ " SwiftExtensionsForPlugin " ,
548+ " SwiftSourceKitPluginCommon " ,
549+ ] ,
550+ swiftSettings: globalSwiftSettings + [
551+ . unsafeFlags( [
552+ " -module-alias " , " SourceKitD=SourceKitDForPlugin " ,
553+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
554+ ] )
555+ ] ,
556+ linkerSettings: sourcekitLSPLinkSettings
557+ ) ,
558+
559+ // MARK: SwiftSourceKitPluginCommon
560+
561+ . target(
562+ name: " SwiftSourceKitPluginCommon " ,
563+ dependencies: [
564+ " Csourcekitd " ,
565+ " SourceKitDForPlugin " ,
566+ " SwiftExtensionsForPlugin " ,
567+ " SKLoggingForPlugin " ,
568+ ] ,
569+ swiftSettings: globalSwiftSettings + [
570+ . unsafeFlags( [
571+ " -module-alias " , " SourceKitD=SourceKitDForPlugin " ,
572+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
573+ " -module-alias " , " SKLogging=SKLoggingForPlugin " ,
574+ ] )
575+ ]
576+ ) ,
577+
578+ // MARK: SwiftSourceKitPlugin
579+
580+ . target(
581+ name: " SwiftSourceKitPlugin " ,
582+ dependencies: [
583+ " Csourcekitd " ,
584+ " CompletionScoringForPlugin " ,
585+ " SKUtilitiesForPlugin " ,
586+ " SKLoggingForPlugin " ,
587+ " SourceKitDForPlugin " ,
588+ " SwiftSourceKitPluginCommon " ,
589+ " SwiftExtensionsForPlugin " ,
590+ ] ,
591+ swiftSettings: globalSwiftSettings + [
592+ . unsafeFlags( [
593+ " -module-alias " , " CompletionScoring=CompletionScoringForPlugin " ,
594+ " -module-alias " , " SKUtilities=SKUtilitiesForPlugin " ,
595+ " -module-alias " , " SourceKitD=SourceKitDForPlugin " ,
596+ " -module-alias " , " SKLogging=SKLoggingForPlugin " ,
597+ " -module-alias " , " SwiftExtensions=SwiftExtensionsForPlugin " ,
598+ ] )
599+ ] ,
600+ linkerSettings: sourcekitLSPLinkSettings
601+ ) ,
602+
603+ . testTarget(
604+ name: " SwiftSourceKitPluginTests " ,
605+ dependencies: [
606+ " BuildSystemIntegration " ,
607+ " CompletionScoring " ,
608+ " Csourcekitd " ,
609+ " LanguageServerProtocol " ,
610+ " SKTestSupport " ,
611+ " SourceKitD " ,
612+ " SwiftExtensions " ,
613+ " ToolchainRegistry " ,
614+ ] ,
615+ swiftSettings: globalSwiftSettings
616+ ) ,
617+
446618 // MARK: ToolchainRegistry
447619
448620 . target(
@@ -493,11 +665,11 @@ var targets: [Target] = [
493665if buildOnlyTests {
494666 products = [ ]
495667 targets = targets. compactMap { target in
496- guard target. isTest || target. name == " SKTestSupport " else {
668+ guard target. isTest || target. name. contains ( " TestSupport " ) else {
497669 return nil
498670 }
499671 target. dependencies = target. dependencies. filter { dependency in
500- if case . byNameItem( name: " SKTestSupport " , _) = dependency {
672+ if case . byNameItem( name: let name , _) = dependency, name . contains ( " TestSupport " ) {
501673 return true
502674 }
503675 return false
0 commit comments