|
| 1 | +// swift-tools-version: 6.0 |
| 2 | + |
| 3 | +import CompilerPluginSupport |
| 4 | +import PackageDescription |
| 5 | + |
| 6 | +let package = Package( |
| 7 | + name: "swift-structured-queries", |
| 8 | + platforms: [ |
| 9 | + .iOS(.v13), |
| 10 | + .macOS(.v10_15), |
| 11 | + .tvOS(.v13), |
| 12 | + .watchOS(.v6), |
| 13 | + ], |
| 14 | + products: [ |
| 15 | + .library( |
| 16 | + name: "StructuredQueries", |
| 17 | + targets: ["StructuredQueries"] |
| 18 | + ), |
| 19 | + .library( |
| 20 | + name: "StructuredQueriesCore", |
| 21 | + targets: ["StructuredQueriesCore"] |
| 22 | + ), |
| 23 | + .library( |
| 24 | + name: "StructuredQueriesTestSupport", |
| 25 | + targets: ["StructuredQueriesTestSupport"] |
| 26 | + ), |
| 27 | + .library( |
| 28 | + name: "_StructuredQueriesSQLite", |
| 29 | + targets: ["StructuredQueriesSQLite"] |
| 30 | + ), |
| 31 | + ], |
| 32 | + dependencies: [ |
| 33 | + .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"), |
| 34 | + .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.8.1"), |
| 35 | + .package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.6.3"), |
| 36 | + .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"), |
| 37 | + .package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.5.2"), |
| 38 | + .package(url: "https://github.com/swiftlang/swift-syntax", "600.0.0"..<"602.0.0"), |
| 39 | + ], |
| 40 | + targets: [ |
| 41 | + .target( |
| 42 | + name: "StructuredQueriesCore", |
| 43 | + dependencies: [ |
| 44 | + "StructuredQueriesSupport", |
| 45 | + .product(name: "IssueReporting", package: "xctest-dynamic-overlay"), |
| 46 | + ] |
| 47 | + ), |
| 48 | + .target( |
| 49 | + name: "StructuredQueries", |
| 50 | + dependencies: [ |
| 51 | + "StructuredQueriesCore", |
| 52 | + "StructuredQueriesMacros", |
| 53 | + ] |
| 54 | + ), |
| 55 | + .macro( |
| 56 | + name: "StructuredQueriesMacros", |
| 57 | + dependencies: [ |
| 58 | + "StructuredQueriesSupport", |
| 59 | + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), |
| 60 | + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), |
| 61 | + ] |
| 62 | + ), |
| 63 | + .target( |
| 64 | + name: "StructuredQueriesSQLite", |
| 65 | + dependencies: [ |
| 66 | + "StructuredQueries" |
| 67 | + ] |
| 68 | + ), |
| 69 | + .target( |
| 70 | + name: "StructuredQueriesTestSupport", |
| 71 | + dependencies: [ |
| 72 | + "StructuredQueriesCore", |
| 73 | + .product(name: "CustomDump", package: "swift-custom-dump"), |
| 74 | + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), |
| 75 | + ] |
| 76 | + ), |
| 77 | + .testTarget( |
| 78 | + name: "StructuredQueriesMacrosTests", |
| 79 | + dependencies: [ |
| 80 | + "StructuredQueries", |
| 81 | + "StructuredQueriesMacros", |
| 82 | + .product(name: "IssueReporting", package: "xctest-dynamic-overlay"), |
| 83 | + .product(name: "MacroTesting", package: "swift-macro-testing"), |
| 84 | + ] |
| 85 | + ), |
| 86 | + .testTarget( |
| 87 | + name: "StructuredQueriesTests", |
| 88 | + dependencies: [ |
| 89 | + "StructuredQueries", |
| 90 | + "StructuredQueriesSQLite", |
| 91 | + "StructuredQueriesTestSupport", |
| 92 | + .product(name: "CustomDump", package: "swift-custom-dump"), |
| 93 | + .product(name: "Dependencies", package: "swift-dependencies"), |
| 94 | + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), |
| 95 | + ] |
| 96 | + ), |
| 97 | + |
| 98 | + .target(name: "StructuredQueriesSupport"), |
| 99 | + ], |
| 100 | + swiftLanguageModes: [.v6] |
| 101 | +) |
| 102 | + |
| 103 | +let swiftSettings: [SwiftSetting] = [ |
| 104 | + .enableUpcomingFeature("MemberImportVisibility") |
| 105 | + // .unsafeFlags([ |
| 106 | + // "-Xfrontend", |
| 107 | + // "-warn-long-function-bodies=50", |
| 108 | + // "-Xfrontend", |
| 109 | + // "-warn-long-expression-type-checking=50", |
| 110 | + // ]) |
| 111 | +] |
| 112 | + |
| 113 | +for index in package.targets.indices { |
| 114 | + package.targets[index].swiftSettings = swiftSettings |
| 115 | +} |
| 116 | + |
| 117 | +#if !os(Darwin) |
| 118 | + package.targets.append( |
| 119 | + .systemLibrary( |
| 120 | + name: "StructuredQueriesSQLite3", |
| 121 | + providers: [.apt(["libsqlite3-dev"])] |
| 122 | + ) |
| 123 | + ) |
| 124 | + |
| 125 | + for index in package.targets.indices { |
| 126 | + if package.targets[index].name == "StructuredQueriesSQLite" { |
| 127 | + package.targets[index].dependencies.append("StructuredQueriesSQLite3") |
| 128 | + } |
| 129 | + } |
| 130 | +#endif |
| 131 | + |
| 132 | +#if !os(Windows) |
| 133 | + // Add the documentation compiler plugin if possible |
| 134 | + package.dependencies.append( |
| 135 | + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0") |
| 136 | + ) |
| 137 | +#endif |
0 commit comments