generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Package.swift
117 lines (110 loc) · 4.81 KB
/
Package.swift
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// swift-tools-version:6.0
//
// This source file is part of the Spezi open source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
import CompilerPluginSupport
import class Foundation.ProcessInfo
import PackageDescription
let package = Package(
name: "SpeziAccount",
defaultLocalization: "en",
platforms: [
.iOS(.v17),
.macOS(.v14), // we need to specify that to run macro tests as they only run on the host platform
.visionOS(.v1)
],
products: [
.library(name: "SpeziAccount", targets: ["SpeziAccount"]),
.library(name: "XCTSpeziAccount", targets: ["XCTSpeziAccount"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation.git", from: "2.0.0"),
.package(url: "https://github.com/StanfordSpezi/Spezi.git", from: "1.7.3"),
.package(url: "https://github.com/StanfordSpezi/SpeziViews.git", from: "1.7.0"),
.package(url: "https://github.com/StanfordSpezi/SpeziStorage.git", from: "1.2.0"),
.package(url: "https://github.com/StanfordBDHG/XCTRuntimeAssertions.git", from: "1.1.1"),
.package(url: "https://github.com/StanfordBDHG/XCTestExtensions.git", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.2"),
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0"),
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0-prerelease-2024-08-14"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.0")
] + swiftLintPackage(),
targets: [
.macro(
name: "SpeziAccountMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
.product(name: "SwiftDiagnostics", package: "swift-syntax")
],
plugins: [] + swiftLintPlugin()
),
.target(
name: "SpeziAccount",
dependencies: [
.product(name: "SpeziFoundation", package: "SpeziFoundation"),
.product(name: "Spezi", package: "Spezi"),
.product(name: "SpeziViews", package: "SpeziViews"),
.product(name: "SpeziPersonalInfo", package: "SpeziViews"),
.product(name: "SpeziValidation", package: "SpeziViews"),
.product(name: "SpeziLocalStorage", package: "SpeziStorage"),
.product(name: "SpeziSecureStorage", package: "SpeziStorage"),
.product(name: "XCTRuntimeAssertions", package: "XCTRuntimeAssertions"),
.product(name: "OrderedCollections", package: "swift-collections"),
.product(name: "Atomics", package: "swift-atomics"),
.target(name: "SpeziAccountMacros")
],
resources: [
.process("Resources")
],
plugins: [] + swiftLintPlugin()
),
.target(
name: "XCTSpeziAccount",
dependencies: [
.target(name: "SpeziAccount"),
.product(name: "XCTestExtensions", package: "XCTestExtensions")
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziAccountTests",
dependencies: [
.target(name: "SpeziAccount"),
.product(name: "XCTRuntimeAssertions", package: "XCTRuntimeAssertions"),
.product(name: "Spezi", package: "Spezi"),
.product(name: "XCTSpezi", package: "Spezi"),
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziAccountMacrosTests",
dependencies: [
"SpeziAccountMacros",
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax")
],
plugins: [] + swiftLintPlugin()
)
]
)
func swiftLintPlugin() -> [Target.PluginUsage] {
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
} else {
[]
}
}
func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
} else {
[]
}
}