File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,12 @@ internal import class PackageModel.UserToolchain
29
29
public typealias BuildTriple = PackageGraph . BuildTriple
30
30
31
31
public protocol BuildTarget {
32
+ /// Source files in the target
32
33
var sources : [ URL ] { get }
33
34
35
+ /// Header files in the target
36
+ var headers : [ URL ] { get }
37
+
34
38
/// The name of the target. It should be possible to build a target by passing this name to `swift build --target`
35
39
var name : String { get }
36
40
@@ -52,7 +56,14 @@ private struct WrappedClangTargetBuildDescription: BuildTarget {
52
56
}
53
57
54
58
public var sources : [ URL ] {
55
- return ( try ? description. compilePaths ( ) . map { URL ( fileURLWithPath: $0. source. pathString) } ) ?? [ ]
59
+ guard let compilePaths = try ? description. compilePaths ( ) else {
60
+ return [ ]
61
+ }
62
+ return compilePaths. map ( \. source. asURL)
63
+ }
64
+
65
+ public var headers : [ URL ] {
66
+ return description. clangTarget. headers. map ( \. asURL)
56
67
}
57
68
58
69
public var name : String {
@@ -92,6 +103,8 @@ private struct WrappedSwiftTargetBuildDescription: BuildTarget {
92
103
return description. sources. map { URL ( fileURLWithPath: $0. pathString) }
93
104
}
94
105
106
+ var headers : [ URL ] { [ ] }
107
+
95
108
func compileArguments( for fileURL: URL ) throws -> [ String ] {
96
109
// Note: we ignore the `fileURL` here as the expectation is that we get a command line for the entire target
97
110
// in case of Swift.
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ struct PluginTargetBuildDescription: BuildTarget {
39
39
return target. sources. paths. map { URL ( fileURLWithPath: $0. pathString) }
40
40
}
41
41
42
+ var headers : [ URL ] { [ ] }
43
+
42
44
var name : String {
43
45
return target. name
44
46
}
You can’t perform that action at this time.
0 commit comments