1
1
// swift-tools-version: 6.1
2
2
import PackageDescription
3
3
4
+ // Conditional plugin dependencies based on platform
5
+ let swiftDependencyAuditPluginDependencies : [ Target . Dependency ]
6
+
7
+ #if os(macOS)
8
+ swiftDependencyAuditPluginDependencies = [ . target( name: " SwiftDependencyAuditBinary " ) ]
9
+ #else
10
+ swiftDependencyAuditPluginDependencies = [ . target( name: " SwiftDependencyAudit " ) ]
11
+ #endif
12
+
4
13
let package = Package (
5
14
name: " SwiftDependencyAudit " ,
6
15
platforms: [
@@ -15,16 +24,11 @@ let package = Package(
15
24
. plugin( name: " DependencyAuditPlugin " , targets: [ " DependencyAuditPlugin " ] ) ,
16
25
] ,
17
26
dependencies: [
18
- . package ( url: " https://github.com/apple/swift-argument-parser.git " , from: " 1.6.1 " ) ,
19
- . package ( url: " https://github.com/swiftlang/swift-syntax.git " , from: " 601.0.1 " ) ,
27
+ . package ( url: " https://github.com/apple/swift-argument-parser.git " , from: " 1.6.1 " )
20
28
] ,
21
29
targets: [
22
30
. target(
23
31
name: " SwiftDependencyAuditLib " ,
24
- dependencies: [
25
- . product( name: " SwiftSyntax " , package : " swift-syntax " ) ,
26
- . product( name: " SwiftParser " , package : " swift-syntax " ) ,
27
- ] ,
28
32
plugins: [ " VersionPlugin " ]
29
33
) ,
30
34
. executableTarget(
@@ -42,13 +46,12 @@ let package = Package(
42
46
) ,
43
47
. testTarget(
44
48
name: " SwiftDependencyAuditTests " ,
45
- dependencies: [ " SwiftDependencyAuditLib " ] ,
46
- resources: [ . copy( " Fixtures " ) ]
49
+ dependencies: [ " SwiftDependencyAuditLib " ]
47
50
) ,
48
51
. plugin(
49
52
name: " DependencyAuditPlugin " ,
50
53
capability: . buildTool( ) ,
51
- dependencies: [ " SwiftDependencyAudit " ]
54
+ dependencies: swiftDependencyAuditPluginDependencies
52
55
) ,
53
56
. plugin(
54
57
name: " VersionPlugin " ,
@@ -57,3 +60,15 @@ let package = Package(
57
60
) ,
58
61
]
59
62
)
63
+
64
+ // Conditionally add binary target only on macOS
65
+ #if os(macOS)
66
+ package . targets. append (
67
+ . binaryTarget(
68
+ name: " SwiftDependencyAuditBinary " ,
69
+ url:
70
+ " https://github.com/tonyarnold/swift-dependency-audit/releases/download/v2.0.5/swift-dependency-audit.artifactbundle.zip " ,
71
+ checksum: " 9d90d5b96a082536e0e873ecfa0eb77ac1d4628c5138de7b63172a0b59739a83 "
72
+ )
73
+ )
74
+ #endif
0 commit comments