File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ import struct PackageGraph.ModulesGraph
27
27
public protocol BuildTarget {
28
28
var sources : [ URL ] { get }
29
29
30
+ /// The name of the target. It should be possible to build a target by passing this name to `swift build --target`
31
+ var name : String { get }
32
+
30
33
/// Whether the target is part of the root package that the user opened or if it's part of a package dependency.
31
34
var isPartOfRootPackage : Bool { get }
32
35
@@ -46,6 +49,10 @@ private struct WrappedClangTargetBuildDescription: BuildTarget {
46
49
return ( try ? description. compilePaths ( ) . map { URL ( fileURLWithPath: $0. source. pathString) } ) ?? [ ]
47
50
}
48
51
52
+ public var name : String {
53
+ return description. clangTarget. name
54
+ }
55
+
49
56
public func compileArguments( for fileURL: URL ) throws -> [ String ] {
50
57
let filePath = try resolveSymlinks ( try AbsolutePath ( validating: fileURL. path) )
51
58
let commandLine = try description. emitCommandLine ( for: filePath)
@@ -63,6 +70,10 @@ private struct WrappedSwiftTargetBuildDescription: BuildTarget {
63
70
self . isPartOfRootPackage = isPartOfRootPackage
64
71
}
65
72
73
+ public var name : String {
74
+ return description. target. name
75
+ }
76
+
66
77
var sources : [ URL ] {
67
78
return description. sources. map { URL ( fileURLWithPath: $0. pathString) }
68
79
}
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ struct PluginTargetBuildDescription: BuildTarget {
34
34
return target. sources. paths. map { URL ( fileURLWithPath: $0. pathString) }
35
35
}
36
36
37
+ var name : String {
38
+ return target. name
39
+ }
40
+
37
41
func compileArguments( for fileURL: URL ) throws -> [ String ] {
38
42
// FIXME: This is very odd and we should clean this up by merging `ManifestLoader` and `DefaultPluginScriptRunner` again.
39
43
let loader = ManifestLoader ( toolchain: try UserToolchain ( swiftSDK: . hostSwiftSDK( ) ) )
You can’t perform that action at this time.
0 commit comments