@@ -56,7 +56,7 @@ let package = Package(
5656 url: " https://github.com/pointfreeco/swift-composable-architecture " ,
5757 from: " 0.55.0 "
5858 ) ,
59- ] ,
59+ ] . pro ,
6060 targets: [
6161 // MARK: - Main
6262
@@ -88,7 +88,8 @@ let package = Package(
8888 " PromptToCodeService " ,
8989 " ServiceUpdateMigration " ,
9090 " UserDefaultsObserver " ,
91- " ChatTab " ,
91+ " ChatGPTChatTab " ,
92+ . product( name: " ChatTab " , package : " Tool " ) ,
9293 . product( name: " Logger " , package : " Tool " ) ,
9394 . product( name: " OpenAIService " , package : " Tool " ) ,
9495 . product( name: " Preferences " , package : " Tool " ) ,
@@ -223,12 +224,13 @@ let package = Package(
223224 ) ,
224225
225226 . target(
226- name: " ChatTab " ,
227+ name: " ChatGPTChatTab " ,
227228 dependencies: [
228229 " SharedUIComponents " ,
229230 " ChatService " ,
230231 . product( name: " OpenAIService " , package : " Tool " ) ,
231232 . product( name: " Logger " , package : " Tool " ) ,
233+ . product( name: " ChatTab " , package : " Tool " ) ,
232234 . product( name: " MarkdownUI " , package : " swift-markdown-ui " ) ,
233235 ]
234236 ) ,
@@ -248,13 +250,14 @@ let package = Package(
248250 . target(
249251 name: " SuggestionWidget " ,
250252 dependencies: [
251- " ChatTab " ,
253+ " ChatGPTChatTab " ,
252254 " ActiveApplicationMonitor " ,
253255 " AXNotificationStream " ,
254256 " Environment " ,
255257 " UserDefaultsObserver " ,
256258 " XcodeInspector " ,
257259 " SharedUIComponents " ,
260+ . product( name: " ChatTab " , package : " Tool " ) ,
258261 . product( name: " Logger " , package : " Tool " ) ,
259262 . product( name: " AsyncAlgorithms " , package : " swift-async-algorithms " ) ,
260263 . product( name: " MarkdownUI " , package : " swift-markdown-ui " ) ,
@@ -391,3 +394,34 @@ let package = Package(
391394 ]
392395)
393396
397+ // MARK: - Pro
398+
399+ extension [ Target . Dependency ] {
400+ func pro( _ targetNames: [ String ] ) -> [ Target . Dependency ] {
401+ if isProIncluded ( ) {
402+ return self + targetNames. map { Target . Dependency. product ( name: $0, package : " Pro " ) }
403+ }
404+ return self
405+ }
406+ }
407+
408+ extension [ Package . Dependency ] {
409+ var pro : [ Package . Dependency ] {
410+ if isProIncluded ( ) {
411+ return self + [ . package ( path: " ../Pro " ) ]
412+ }
413+ return self
414+ }
415+ }
416+
417+ import Foundation
418+
419+ func isProIncluded( file: StaticString = #file) -> Bool {
420+ let filePath = " \( file) "
421+ let url = URL ( fileURLWithPath: filePath)
422+ . deletingLastPathComponent ( )
423+ . deletingLastPathComponent ( )
424+ . appendingPathComponent ( " Pro/Package.swift " )
425+ return FileManager . default. fileExists ( atPath: url. path)
426+ }
427+
0 commit comments