94 lines
3.9 KiB
Swift
94 lines
3.9 KiB
Swift
// swift-tools-version: 6.0
|
|
// SprachmittlerKit — all testable logic for Sprachmittler. The macOS app target (App/) is generated by
|
|
// XcodeGen from project.yml and links the library products below. See docs/ARCHITECTURE.md §3–§4.
|
|
|
|
import PackageDescription
|
|
|
|
let strictSettings: [SwiftSetting] = [
|
|
.enableUpcomingFeature("ExistentialAny"),
|
|
]
|
|
|
|
let package = Package(
|
|
name: "SprachmittlerKit",
|
|
platforms: [.macOS(.v14)],
|
|
products: [
|
|
.library(name: "SprachmittlerCore", targets: ["SprachmittlerCore"]),
|
|
.library(name: "SprachmittlerCapture", targets: ["SprachmittlerCapture"]),
|
|
.executable(name: "sprachmittler-cli", targets: ["sprachmittler-cli"]),
|
|
],
|
|
dependencies: [
|
|
// CLI harness only (ARCHITECTURE §4). The app target must not depend on it.
|
|
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
|
|
],
|
|
targets: [
|
|
// Leaf modules — must not depend on each other or on any other package module.
|
|
// SprachmittlerText: pure Foundation + NaturalLanguage.
|
|
.target(name: "SprachmittlerText", swiftSettings: strictSettings),
|
|
// SprachmittlerOllama: the only URLSession user.
|
|
.target(name: "SprachmittlerOllama", swiftSettings: strictSettings),
|
|
|
|
// The only module that knows model names, prompts, language names and dialects (ADR-002, ADR-012).
|
|
.target(
|
|
name: "SprachmittlerEngines",
|
|
dependencies: ["SprachmittlerText", "SprachmittlerOllama"],
|
|
swiftSettings: strictSettings
|
|
),
|
|
|
|
// Composition through protocols; no model-specific branches.
|
|
.target(
|
|
name: "SprachmittlerCore",
|
|
dependencies: ["SprachmittlerText", "SprachmittlerOllama", "SprachmittlerEngines"],
|
|
swiftSettings: strictSettings
|
|
),
|
|
|
|
// The only module that imports Accessibility and touches NSPasteboard (ADR-004, ADR-005).
|
|
.target(name: "SprachmittlerCapture", dependencies: ["SprachmittlerCore"], swiftSettings: strictSettings),
|
|
|
|
// Evaluation harness — linked into the CLI only, never into the app.
|
|
.target(name: "SprachmittlerEval", dependencies: ["SprachmittlerCore"], swiftSettings: strictSettings),
|
|
|
|
// Fakes shared by tests (FakePasteboard, FakeClock, FakeOllamaTransport, FakeTextInserter, …).
|
|
.target(name: "SprachmittlerTestSupport", dependencies: ["SprachmittlerCore"], swiftSettings: strictSettings),
|
|
|
|
.executableTarget(
|
|
name: "sprachmittler-cli",
|
|
dependencies: [
|
|
"SprachmittlerCore",
|
|
"SprachmittlerEval",
|
|
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
|
],
|
|
swiftSettings: strictSettings
|
|
),
|
|
|
|
.testTarget(
|
|
name: "SprachmittlerTextTests",
|
|
dependencies: ["SprachmittlerText"],
|
|
resources: [.copy("Fixtures")]
|
|
),
|
|
.testTarget(
|
|
name: "SprachmittlerOllamaTests",
|
|
dependencies: ["SprachmittlerOllama"],
|
|
resources: [.copy("Fixtures")]
|
|
),
|
|
.testTarget(
|
|
name: "SprachmittlerEnginesTests",
|
|
dependencies: ["SprachmittlerEngines"],
|
|
resources: [.copy("Fixtures")]
|
|
),
|
|
.testTarget(
|
|
name: "SprachmittlerCoreTests",
|
|
dependencies: ["SprachmittlerCore", "SprachmittlerTestSupport"]
|
|
),
|
|
.testTarget(
|
|
name: "SprachmittlerCaptureTests",
|
|
dependencies: ["SprachmittlerCapture", "SprachmittlerTestSupport"]
|
|
),
|
|
.testTarget(
|
|
name: "SprachmittlerEvalTests",
|
|
dependencies: ["SprachmittlerEval", "SprachmittlerTestSupport"]
|
|
),
|
|
// Opt-in tests against a real local Ollama: SPRACHMITTLER_LIVE=1 swift test --filter SprachmittlerLiveTests
|
|
.testTarget(name: "SprachmittlerLiveTests", dependencies: ["SprachmittlerCore"]),
|
|
]
|
|
)
|