๐Ÿ“ฆ techouse / qs-swift

๐Ÿ“„ Package@swift-5.10.swift ยท 88 lines
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// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

var deps: [Package.Dependency] = [
    .package(url: "https://github.com/apple/swift-algorithms.git", from: "1.2.1"),
    .package(url: "https://github.com/apple/swift-collections.git", from: "1.2.1"),
    .package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
    .package(url: "https://github.com/apple/swift-testing.git", from: "0.9.0"),
]
var targetDeps: [Target.Dependency] = [
    .product(name: "Algorithms", package: "swift-algorithms"),
    .product(name: "OrderedCollections", package: "swift-collections"),
]
#if os(Linux)
    deps.append(.package(url: "https://github.com/reers/ReerKit.git", from: "1.2.2"))
    targetDeps.append(.product(name: "ReerKit", package: "ReerKit"))
#endif

let package = Package(
    name: "QsSwift",
    platforms: [
        .macOS(.v12), .iOS(.v13), .tvOS(.v13), .watchOS(.v8),
    ],
    products: [
        .library(name: "QsSwift", targets: ["QsSwift"]),
        .library(name: "QsObjC", targets: ["QsObjC"]),
    ],
    dependencies: deps,
    targets: [
        .target(
            name: "QsSwift",
            dependencies: targetDeps,
            path: "Sources/QsSwift",
            swiftSettings: [
                .unsafeFlags(["-strict-concurrency=complete"], .when(configuration: .debug)),
                .unsafeFlags(["-enable-actor-data-race-checks"], .when(configuration: .debug)),
            ]
        ),
        .target(
            name: "QsObjC",
            dependencies: ["QsSwift"],
            path: "Sources/QsObjC",
            exclude: ["README.md"],
            swiftSettings: [
                .define("QS_OBJC_BRIDGE", .when(platforms: [.macOS, .iOS, .tvOS, .watchOS]))
            ]
        ),
        .testTarget(
            name: "QsSwiftTests",
            dependencies: [
                "QsSwift",
                .product(name: "Testing", package: "swift-testing"),
            ],
            path: "Tests/QsSwiftTests",
            swiftSettings: [
                .unsafeFlags(["-strict-concurrency=complete"], .when(configuration: .debug)),
                .unsafeFlags(["-enable-actor-data-race-checks"], .when(configuration: .debug)),
            ]
        ),
        .testTarget(
            name: "QsObjCTests",
            dependencies: [
                "QsSwift",
                "QsObjC",
                .product(name: "Testing", package: "swift-testing"),
            ],
            path: "Tests/QsObjCTests"
        ),
        .executableTarget(
            name: "QsSwiftComparison",
            dependencies: ["QsSwift"],
            path: "Tools/QsSwiftComparison",
            exclude: [
                "js/node_modules",
                "js/package.json",
                "js/package-lock.json",
                "js/qs.js",
                "compare_outputs.sh",
            ],
            resources: [
                .copy("js/test_cases.json")
            ]
        ),
    ]
)