Skip to content

Commit 2b12e3a

Browse files
committed
be able to run test
1 parent f723e5a commit 2b12e3a

File tree

2 files changed

+84
-53
lines changed

2 files changed

+84
-53
lines changed

Package.swift

Lines changed: 82 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,72 +10,101 @@
1010
import CompilerPluginSupport
1111
import PackageDescription
1212

13-
let package = Package(
14-
name: "QuickLayout",
15-
platforms: [
16-
.iOS(.v15),
17-
.macOS(.v10_15),
18-
],
19-
products: [
13+
#if os(iOS) || !os(macOS)
14+
var QuickLayoutDependencies: [Target.Dependency] = [
15+
"QuickLayoutMacro",
16+
"QuickLayoutBridge",
17+
]
18+
#else
19+
var QuickLayoutDependencies: [Target.Dependency] = [
20+
"QuickLayoutMacro",
21+
]
22+
#endif
23+
24+
var targets: [Target] = [
25+
.target(
26+
name: "QuickLayout",
27+
dependencies: QuickLayoutDependencies,
28+
path: "Sources/QuickLayout/QuickLayout",
29+
exclude: [
30+
"__showcase__/"
31+
]
32+
),
33+
.macro(
34+
name: "QuickLayoutMacro",
35+
dependencies: [
36+
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
37+
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
38+
],
39+
path: "Sources/QuickLayout/QuickLayoutMacro"
40+
),
41+
.target(
42+
name: "FastResultBuilder",
43+
path: "Sources/FastResultBuilder/FastResultBuilder",
44+
exclude: [
45+
"__tests__/"
46+
]
47+
),
48+
.testTarget(
49+
name: "QuickLayoutMacroTests",
50+
dependencies: [
51+
"QuickLayoutMacro",
52+
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
53+
],
54+
path: "Sources/QuickLayout/QuickLayoutMacroTests"
55+
),
56+
]
57+
58+
var products: [Product] = [
2059
.library(
2160
name: "QuickLayout",
2261
targets: ["QuickLayout"]
2362
),
24-
.library(
25-
name: "QuickLayoutCore",
26-
targets: ["QuickLayoutCore"]
27-
),
2863
.library(
2964
name: "FastResultBuilder",
3065
targets: ["FastResultBuilder"]
3166
),
67+
]
68+
69+
// iOS-only targets
70+
#if os(iOS) || !os(macOS)
71+
targets += [
72+
.target(
73+
name: "QuickLayoutCore",
74+
path: "Sources/QuickLayout/QuickLayoutCore"
75+
),
76+
.target(
77+
name: "QuickLayoutBridge",
78+
dependencies: ["FastResultBuilder", "QuickLayoutCore"],
79+
path: "Sources/QuickLayout/QuickLayoutBridge",
80+
exclude: [
81+
"__server_snapshot_tests__",
82+
"__tests__",
83+
]
84+
),
85+
]
86+
87+
products += [
88+
.library(
89+
name: "QuickLayoutCore",
90+
targets: ["QuickLayoutCore"]
91+
),
3292
.library(
3393
name: "QuickLayoutBridge",
3494
targets: ["QuickLayoutBridge"]
3595
),
96+
]
97+
#endif
98+
99+
let package = Package(
100+
name: "QuickLayout",
101+
platforms: [
102+
.iOS(.v15),
103+
.macOS(.v10_15),
36104
],
105+
products: products,
37106
dependencies: [
38-
.package(url: "https://github.com/apple/swift-syntax.git", from: "600.0.0")
39-
],
40-
targets: [
41-
.target(
42-
name: "QuickLayout",
43-
dependencies: [
44-
"QuickLayoutMacro",
45-
"QuickLayoutBridge",
46-
],
47-
path: "Sources/QuickLayout/QuickLayout",
48-
exclude: [
49-
"__showcase__/"
50-
]
51-
),
52-
.macro(
53-
name: "QuickLayoutMacro",
54-
dependencies: [
55-
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
56-
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
57-
],
58-
path: "Sources/QuickLayout/QuickLayoutMacro",
59-
),
60-
.target(
61-
name: "QuickLayoutCore",
62-
path: "Sources/QuickLayout/QuickLayoutCore",
63-
),
64-
.target(
65-
name: "FastResultBuilder",
66-
path: "Sources/FastResultBuilder/FastResultBuilder",
67-
exclude: [
68-
"__tests__/"
69-
]
70-
),
71-
.target(
72-
name: "QuickLayoutBridge",
73-
dependencies: ["FastResultBuilder", "QuickLayoutCore"],
74-
path: "Sources/QuickLayout/QuickLayoutBridge",
75-
exclude: [
76-
"__server_snapshot_tests__",
77-
"__tests__",
78-
]
79-
),
107+
.package(url: "https://github.com/apple/swift-syntax.git", from: "602.0.0"),
80108
],
109+
targets: targets
81110
)

Sources/QuickLayout/QuickLayout/QuickLayout.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#if canImport(QuickLayoutBridge)
89
@_exported import QuickLayoutBridge
10+
#endif

0 commit comments

Comments
 (0)