-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathPackage.swift
More file actions
146 lines (137 loc) · 9.1 KB
/
Copy pathPackage.swift
File metadata and controls
146 lines (137 loc) · 9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// swift-tools-version: 6.2
import Foundation
import PackageDescription
let packageRoot = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path
// Telemetry (Sentry) is resolved deterministically but linked only when explicitly
// requested. The official Developer ID release pipeline sets
// REPOPROMPT_ENABLE_SENTRY=1; local builds use the same gate for intentional
// Sentry testing.
let environment = ProcessInfo.processInfo.environment
let sentryEnabled = environment["REPOPROMPT_ENABLE_SENTRY"] == "1"
let benchmarkTestsEnabled = environment["RPCE_ENABLE_BENCHMARK_TESTS"] == "1"
var packageDependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-log.git", exact: "1.6.3"),
.package(url: "https://github.com/sindresorhus/KeyboardShortcuts.git", exact: "2.3.0"),
.package(url: "https://github.com/gonzalezreal/swift-markdown-ui", exact: "2.4.1"),
.package(url: "https://github.com/swiftlang/swift-markdown", exact: "0.6.0"),
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", exact: "2.8.0"),
.package(url: "https://github.com/apple/swift-system.git", exact: "1.6.4"),
.package(url: "https://github.com/provencher/swift-sdk.git", revision: "85dec2fc7a27252bc33dc7728be6af6b3bd398c0"),
.package(url: "https://github.com/ChimeHQ/SwiftTreeSitter.git", exact: "0.8.0"),
.package(url: "https://github.com/tree-sitter/tree-sitter-c", revision: "3efee11f784605d44623d7dadd6cd12a0f73ea92"),
.package(url: "https://github.com/UserNobody14/tree-sitter-dart", revision: "80e23c07b64494f7e21090bb3450223ef0b192f4"),
.package(url: "https://github.com/tree-sitter/tree-sitter-go", revision: "c350fa54d38af725c40d061a602ee3205ef1e072"),
.package(url: "https://github.com/tree-sitter/tree-sitter-java", revision: "e10607b45ff745f5f876bfa3e94fbcc6b44bdc11"),
.package(url: "https://github.com/tree-sitter/tree-sitter-javascript", revision: "39798e26b6d4dbcee8e522b8db83f8b2df33a5ea"),
.package(url: "https://github.com/tree-sitter/tree-sitter-python", revision: "c5fca1a186e8e528115196178c28eefa8d86b0b0"),
.package(url: "https://github.com/tree-sitter/tree-sitter-rust", revision: "2eaf126458a4d6a69401089b6ba78c5e5d6c1ced"),
.package(url: "https://github.com/tree-sitter/tree-sitter-typescript", revision: "75b3874edb2dc714fb1fd77a32013d0f8699989f"),
.package(url: "https://github.com/tree-sitter/tree-sitter-ruby", revision: "7a010836b74351855148818d5cb8170dc4df8e6a"),
.package(url: "https://github.com/alex-pinkus/tree-sitter-swift", revision: "9253825dd2570430b53fa128cbb40cb62498e75d"),
.package(url: "https://github.com/tree-sitter/tree-sitter-c-sharp.git", revision: "b27b091bfdc5f16d0ef76421ea5609c82a57dff0"),
.package(url: "https://github.com/tree-sitter/tree-sitter-cpp", revision: "e5cea0ec884c5c3d2d1e41a741a66ce13da4d945"),
.package(url: "https://github.com/provencher/tree-sitter-php", revision: "0a99deca13c4af1fb9adcb03c958bfc9f4c740a9"),
.package(url: "https://github.com/jamesrochabrun/SwiftAnthropic", revision: "b7d030cd7453f314c780f5492385f73d704cbd5d"),
.package(url: "https://github.com/provencher/SwiftOpenAI", revision: "1211782eb337e7968124448a20d9260df1952012"),
.package(url: "https://github.com/ChimeHQ/Neon.git", exact: "0.6.0"),
.package(path: "Vendor/UniversalCharsetDetection"),
.package(url: "https://github.com/loopwork-ai/JSONSchema.git", exact: "1.3.0"),
.package(url: "https://github.com/loopwork-ai/ontology.git", exact: "0.6.0"),
.package(url: "https://github.com/getsentry/sentry-cocoa", exact: "9.17.1"),
.package(path: "Packages/RepoPromptAgentProviders")
]
var repoPromptDependencies: [Target.Dependency] = [
"RepoPromptShared",
"RepoPromptC", "CSwiftPCRE2", "TreeSitterScannerSupport",
"Sparkle",
.product(name: "Logging", package: "swift-log"),
.product(name: "KeyboardShortcuts", package: "KeyboardShortcuts"),
.product(name: "MarkdownUI", package: "swift-markdown-ui"),
.product(name: "Markdown", package: "swift-markdown"),
.product(name: "MCP", package: "swift-sdk"),
.product(name: "SwiftTreeSitter", package: "SwiftTreeSitter"),
.product(name: "TreeSitterC", package: "tree-sitter-c"),
.product(name: "TreeSitterDart", package: "tree-sitter-dart"),
.product(name: "TreeSitterGo", package: "tree-sitter-go"),
.product(name: "TreeSitterJava", package: "tree-sitter-java"),
.product(name: "TreeSitterJavaScript", package: "tree-sitter-javascript"),
.product(name: "TreeSitterPython", package: "tree-sitter-python"),
.product(name: "TreeSitterRust", package: "tree-sitter-rust"),
.product(name: "TreeSitterTypeScript", package: "tree-sitter-typescript"),
.product(name: "TreeSitterRuby", package: "tree-sitter-ruby"),
.product(name: "TreeSitterSwift", package: "tree-sitter-swift"),
.product(name: "TreeSitterCSharp", package: "tree-sitter-c-sharp"),
.product(name: "TreeSitterCPP", package: "tree-sitter-cpp"),
.product(name: "TreeSitterPHP", package: "tree-sitter-php"),
.product(name: "SwiftAnthropic", package: "SwiftAnthropic"),
.product(name: "SwiftOpenAI", package: "SwiftOpenAI"),
.product(name: "Neon", package: "Neon"),
.product(name: "UniversalCharsetDetection", package: "UniversalCharsetDetection"),
.product(name: "Cuchardet", package: "UniversalCharsetDetection"),
.product(name: "JSONSchema", package: "JSONSchema"),
.product(name: "Ontology", package: "ontology"),
.product(name: "RepoPromptClaudeCompatibleProvider", package: "RepoPromptAgentProviders")
]
var repoPromptSwiftSettings: [SwiftSetting] = [
.define("DEBUG", .when(configuration: .debug)),
.enableUpcomingFeature("BareSlashRegexLiterals"),
.unsafeFlags([
"-import-objc-header", "\(packageRoot)/Sources/RepoPrompt/Support/RepoPrompt-Bridging-Header.h",
"-disable-bridging-pch"
])
]
var repoPromptTestSwiftSettings: [SwiftSetting] = [
.define("DEBUG", .when(configuration: .debug))
]
if sentryEnabled {
repoPromptDependencies.append(.product(name: "Sentry", package: "sentry-cocoa"))
repoPromptSwiftSettings.append(.define("REPOPROMPT_SENTRY_ENABLED"))
}
if benchmarkTestsEnabled {
repoPromptTestSwiftSettings.append(.define("RPCE_BENCHMARK_TESTS"))
}
let package = Package(
name: "RepoPromptCE",
platforms: [.macOS(.v14)],
products: [
.executable(name: "RepoPrompt", targets: ["RepoPrompt"]),
.executable(name: "repoprompt-mcp", targets: ["RepoPromptMCP"])
],
dependencies: packageDependencies,
targets: [
.executableTarget(
name: "RepoPrompt",
dependencies: repoPromptDependencies,
path: "Sources/RepoPrompt",
swiftSettings: repoPromptSwiftSettings
),
.executableTarget(
name: "RepoPromptMCP",
dependencies: ["RepoPromptShared", .product(name: "Logging", package: "swift-log"), .product(name: "MCP", package: "swift-sdk"), .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), .product(name: "SystemPackage", package: "swift-system")],
path: "Sources/RepoPromptMCP",
swiftSettings: [.define("DEBUG", .when(configuration: .debug))]
),
.target(
name: "RepoPromptShared",
path: "Sources/RepoPromptShared",
swiftSettings: [.define("DEBUG", .when(configuration: .debug))]
),
.target(name: "CSwiftPCRE2", path: "Sources/CSwiftPCRE2", exclude: ["deps/sljit/sljit_src/sljitNativeARM_64.c", "deps/sljit/sljit_src/sljitSerialize.c", "deps/sljit/sljit_src/sljitUtils.c", "deps/sljit/sljit_src/sljitNativeX86_common.c", "deps/sljit/sljit_src/sljitNativeX86_64.c", "deps/sljit/sljit_src/sljitNativeX86_32.c", "deps/sljit/sljit_src/allocator_src/sljitWXExecAllocatorPosix.c", "deps/sljit/sljit_src/allocator_src/sljitProtExecAllocatorPosix.c", "deps/sljit/sljit_src/allocator_src/sljitExecAllocatorPosix.c", "deps/sljit/sljit_src/allocator_src/sljitExecAllocatorCore.c", "deps/sljit/sljit_src/allocator_src/sljitExecAllocatorApple.c"], publicHeadersPath: "include", cSettings: [.headerSearchPath("include"), .headerSearchPath("src"), .define("PCRE2_CODE_UNIT_WIDTH", to: "8"), .define("HAVE_CONFIG_H")]),
.target(name: "RepoPromptC", path: "Sources/RepoPromptC", publicHeadersPath: "include", cSettings: [.headerSearchPath("include")]),
// Exact-snapshot scanner ABI fallback for upstream JavaScript/Python products.
// See docs/architecture/source-layout.md and ThirdPartyLicenses/tree-sitter/README.md.
.target(name: "TreeSitterScannerSupport", path: "Sources/TreeSitterScannerSupport", sources: ["src/javascript/scanner.c", "src/python/scanner.c"], publicHeadersPath: "include"),
.binaryTarget(name: "Sparkle", path: "Vendor/Sparkle/Sparkle.xcframework"),
.testTarget(
name: "RepoPromptTests",
dependencies: ["RepoPrompt", "RepoPromptMCP", "RepoPromptShared"],
path: "Tests/RepoPromptTests",
resources: [
.copy("CodeMap/Fixtures"),
.copy("CodeMap/Goldens")
],
swiftSettings: repoPromptTestSwiftSettings
)
],
swiftLanguageModes: [.v5]
)