Repository Public
1// swift-tools-version: 6.02// ORIX Docs3// File: Packages/ORIXDocsKit/Package.swift4// Description: Engine package. Every target here is independent from SwiftUI; the app target is a thin shell on top.5//6// Author: Simon-Pierre Boucher7// Contact: contact@spboucher.ai8import PackageDescription910import Foundation1112/// `ORIX_ONLY=DocModel,DocReferences,DocReferencesTests swift build` restricts the package to the listed targets,13/// so one engine can be built and tested while another one is mid-change.14let only: Set<String>? = ProcessInfo.processInfo.environment["ORIX_ONLY"].map { Set($0.split(separator: ",").map(String.init)) }1516let math: Target.Dependency = .product(name: "SwiftMath", package: "SwiftMath")17let allTargets: [Target] = [18 .target(name: "DocModel"),19 .target(name: "DocContainer", dependencies: ["DocModel"]),20 .target(name: "DocMath", dependencies: ["DocModel", math]),21 .target(name: "DocReferences", dependencies: ["DocModel"]),22 .target(name: "DocDOCX", dependencies: ["DocModel", "DocContainer"]),23 .target(name: "DocFormats", dependencies: ["DocModel", "DocContainer"]),24 .target(name: "DocLayout", dependencies: ["DocModel", "DocMath"]),25 .target(name: "DocReview", dependencies: ["DocModel"]),26 .target(name: "DocAudit", dependencies: ["DocModel"]),27 .target(name: "DocTemplates", dependencies: ["DocModel"]),28 .target(name: "DocAutomation", dependencies: ["DocModel", "DocContainer", "DocDOCX", "DocFormats", "DocLayout", "DocReferences", "DocReview", "DocAudit", "DocTemplates"]),29 .executableTarget(name: "orixdocs", dependencies: ["DocAutomation"]),30 .executableTarget(name: "orixbench", dependencies: ["DocAutomation"]),31 .testTarget(name: "DocModelTests", dependencies: ["DocModel"]),32 .testTarget(name: "DocContainerTests", dependencies: ["DocContainer"]),33 .testTarget(name: "DocDOCXTests", dependencies: ["DocDOCX"], resources: [.copy("Corpus")]),34 .testTarget(name: "DocFormatsTests", dependencies: ["DocFormats"]),35 .testTarget(name: "DocLayoutTests", dependencies: ["DocLayout", "DocReferences", "DocTemplates"]),36 .testTarget(name: "DocReferencesTests", dependencies: ["DocReferences"]),37 .testTarget(name: "DocReviewTests", dependencies: ["DocReview"]),38 .testTarget(name: "DocAuditTests", dependencies: ["DocAudit"]),39 .testTarget(name: "DocTemplatesTests", dependencies: ["DocTemplates"]),40 .testTarget(name: "DocAutomationTests", dependencies: ["DocAutomation"]),41]42let targets = allTargets.filter { only?.contains($0.name) ?? true }43let libraryTargets = targets.filter { $0.type == .regular }.map(\.name)4445let package = Package(46 name: "ORIXDocsKit",47 defaultLocalization: "en",48 platforms: [.macOS(.v15)],49 products: [.library(name: "ORIXDocsKit", targets: libraryTargets)]50 + (targets.contains { $0.name == "orixdocs" } ? [.executable(name: "orixdocs", targets: ["orixdocs"])] : []),51 dependencies: [52 // Pinned to an upstream revision after 1.7.3 (no newer tag exists): it removes traps on malformed LaTeX that the53 // fuzz tests in DocLayoutTests/MathRobustnessTests.swift hit with 1.7.3. See docs/security.md.54 .package(url: "https://github.com/mgriebling/SwiftMath", revision: "0b0222e102ba415b352cd29f334075622bd4e6aa"),55 ],56 targets: targets57)58