// swift-tools-version: 5.9

import PackageDescription

let package = Package(
    name: "Sapling",
    platforms: [
        .macOS(.v14),
        .iOS(.v17)
    ],
    products: [
        .executable(name: "SaplingApp", targets: ["SaplingApp"]),
        .library(name: "SaplingCore", targets: ["SaplingCore"]),
        .library(name: "SaplingWorkspace", targets: ["SaplingWorkspace"]),
        .library(name: "SaplingGit", targets: ["SaplingGit"]),
        .library(name: "SaplingEditor", targets: ["SaplingEditor"]),
        .library(name: "SaplingRenderer", targets: ["SaplingRenderer"]),
        .library(name: "SaplingStorage", targets: ["SaplingStorage"]),
        .library(name: "SaplingLogging", targets: ["SaplingLogging"]),
        .library(name: "SaplingUI", targets: ["SaplingUI"])
    ],
    targets: [
        .executableTarget(
            name: "SaplingApp",
            dependencies: [
                "SaplingCore",
                "SaplingWorkspace",
                "SaplingGit",
                "SaplingEditor",
                "SaplingRenderer",
                "SaplingStorage",
                "SaplingLogging",
                "SaplingUI"
            ]
        ),
        .target(name: "SaplingCore"),
        .target(
            name: "SaplingWorkspace",
            dependencies: ["SaplingCore", "SaplingGit", "SaplingStorage"]
        ),
        .target(
            name: "SaplingGit",
            dependencies: ["SaplingCore"]
        ),
        .target(
            name: "SaplingEditor",
            dependencies: ["SaplingCore", "SaplingRenderer"]
        ),
        .target(
            name: "SaplingRenderer",
            dependencies: ["SaplingCore"]
        ),
        .target(
            name: "SaplingStorage",
            dependencies: ["SaplingCore"]
        ),
        .target(name: "SaplingLogging"),
        .target(
            name: "SaplingUI",
            dependencies: ["SaplingCore", "SaplingWorkspace", "SaplingGit", "SaplingEditor", "SaplingStorage"]
        ),
        .testTarget(
            name: "SaplingCoreTests",
            dependencies: ["SaplingCore"]
        ),
        .testTarget(
            name: "SaplingEditorTests",
            dependencies: ["SaplingCore", "SaplingEditor"]
        )
    ]
)
