luminate/Package.swift

159 lines
5.8 KiB
Swift

// swift-tools-version: 6.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let strictConcurrencySettings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency=complete")
]
// UI/executable-facing targets default to MainActor isolation on top of strict
// concurrency; data/service layers (e.g. LuminateAPI) stay nonisolated by default
// so they aren't implicitly pinned to the main actor.
let uiSwiftSettings: [SwiftSetting] =
strictConcurrencySettings + [
.defaultIsolation(MainActor.self)
]
// Everything the service layer needs to speak to a Jellyfin server: the domain
// layer, the generated client, the OpenAPI runtime/transport, and HTTPTypes for
// the middleware's own HTTPRequest/HTTPResponse signature.
let servicesDeps: [Target.Dependency] = [
"LuminateCore",
"LuminateAPI",
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
]
// UI-layer targets see the domain layer and Portico, never the generated client.
let uiDeps: [Target.Dependency] = [
"LuminateCore",
.product(name: "Portico", package: "portico"),
.product(name: "Logging", package: "swift-log"),
]
// The persistence layer owns SQLite and exposes only Core value types above it.
let storeDeps: [Target.Dependency] = [
"LuminateCore",
"CSQLite",
.product(name: "Logging", package: "swift-log"),
]
let package = Package(
name: "luminate",
platforms: [.macOS(.v26)],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.executable(
name: "Luminate",
targets: ["Luminate"]
)
],
dependencies: [
.package(url: "https://git.bscubed.dev/gtk-swift/portico.git", branch: "main"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.6.0"),
.package(url: "https://github.com/apple/swift-log", from: "1.14.0"),
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.13.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.12.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.3.1"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "LuminateCore",
swiftSettings: strictConcurrencySettings
),
.target(
name: "LuminateAPI",
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
],
swiftSettings: strictConcurrencySettings,
plugins: [
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator")
]
),
.systemLibrary(
name: "CSQLite",
path: "Sources/CSQLite",
pkgConfig: "sqlite3",
providers: [.apt(["libsqlite3-dev"]), .brew(["sqlite3"])]
),
.target(
name: "LuminateStore",
dependencies: storeDeps,
swiftSettings: strictConcurrencySettings
),
.target(
name: "LuminateServices",
dependencies: servicesDeps,
swiftSettings: strictConcurrencySettings
),
.target(
name: "LuminateUI",
dependencies: uiDeps,
swiftSettings: uiSwiftSettings
),
.target(
name: "LuminateOnboarding",
dependencies: [
"LuminateCore",
"LuminateServices",
"LuminateUI",
.product(name: "Portico", package: "portico"),
],
swiftSettings: uiSwiftSettings
),
.executableTarget(
name: "Luminate",
dependencies: [
"LuminateCore",
"LuminateStore",
"LuminateServices",
"LuminateUI",
"LuminateOnboarding",
.product(name: "Portico", package: "portico"),
.product(name: "Logging", package: "swift-log"),
],
swiftSettings: uiSwiftSettings
),
.testTarget(
name: "LuminateOnboardingTests",
dependencies: [
"LuminateCore",
"LuminateServices",
"LuminateUI",
"LuminateOnboarding",
],
swiftSettings: uiSwiftSettings
),
.testTarget(
name: "LuminateCoreTests",
dependencies: ["LuminateCore"],
swiftSettings: strictConcurrencySettings
),
.testTarget(
name: "LuminateServicesTests",
dependencies: servicesDeps + ["LuminateServices"],
swiftSettings: strictConcurrencySettings
),
.testTarget(
name: "LuminateStoreTests",
dependencies: storeDeps + ["LuminateStore"],
swiftSettings: strictConcurrencySettings
),
.testTarget(
name: "LuminateUITests",
dependencies: uiDeps + ["LuminateUI"],
swiftSettings: uiSwiftSettings
),
.testTarget(
name: "LuminateTests",
dependencies: ["Luminate", "LuminateCore", "LuminateServices", "LuminateStore", "LuminateUI"],
swiftSettings: uiSwiftSettings
),
],
swiftLanguageModes: [.v6]
)