@@ -17,6 +17,7 @@ import PackageGraph
17
17
import PackageLoading
18
18
import PackageModel
19
19
20
+ @_spi ( SwiftPMInternal)
20
21
import SPMBuildCore
21
22
22
23
#if USE_IMPL_ONLY_IMPORTS
@@ -28,19 +29,19 @@ import DriverSupport
28
29
import struct TSCBasic. ByteString
29
30
30
31
/// Target description for a Swift target.
31
- package final class SwiftTargetBuildDescription {
32
+ public final class SwiftTargetBuildDescription {
32
33
/// The package this target belongs to.
33
- package let package : ResolvedPackage
34
+ public let package : ResolvedPackage
34
35
35
36
/// The target described by this target.
36
- package let target : ResolvedTarget
37
+ public let target : ResolvedTarget
37
38
38
39
private let swiftTarget : SwiftTarget
39
40
40
41
/// The tools version of the package that declared the target. This can
41
42
/// can be used to conditionalize semantically significant changes in how
42
43
/// a target is built.
43
- package let toolsVersion : ToolsVersion
44
+ public let toolsVersion : ToolsVersion
44
45
45
46
/// The build parameters.
46
47
let buildParameters : BuildParameters
@@ -77,22 +78,22 @@ package final class SwiftTargetBuildDescription {
77
78
}
78
79
79
80
/// The list of all source files in the target, including the derived ones.
80
- package var sources : [ AbsolutePath ] {
81
+ public var sources : [ AbsolutePath ] {
81
82
self . target. sources. paths + self . derivedSources. paths + self . pluginDerivedSources. paths
82
83
}
83
84
84
- package var sourcesFileListPath : AbsolutePath {
85
+ public var sourcesFileListPath : AbsolutePath {
85
86
self . tempsPath. appending ( component: " sources " )
86
87
}
87
88
88
89
/// The list of all resource files in the target, including the derived ones.
89
- package var resources : [ Resource ] {
90
+ public var resources : [ Resource ] {
90
91
self . target. underlying. resources + self . pluginDerivedResources
91
92
}
92
93
93
94
/// The objects in this target, containing either machine code or bitcode
94
95
/// depending on the build parameters used.
95
- package var objects : [ AbsolutePath ] {
96
+ public var objects : [ AbsolutePath ] {
96
97
get throws {
97
98
let relativeSources = self . target. sources. relativePaths
98
99
+ self . derivedSources. relativePaths
@@ -112,7 +113,7 @@ package final class SwiftTargetBuildDescription {
112
113
}
113
114
114
115
/// The path to the swiftmodule file after compilation.
115
- public var moduleOutputPath : AbsolutePath { // note: needs to be ` public` because of sourcekit-lsp
116
+ public var moduleOutputPath : AbsolutePath { // note: needs to be public because of sourcekit-lsp
116
117
// If we're an executable and we're not allowing test targets to link against us, we hide the module.
117
118
let triple = buildParameters. triple
118
119
let allowLinkingAgainstExecutables = ( triple. isDarwin ( ) || triple. isLinux ( ) || triple. isWindows ( ) ) && self . toolsVersion >= . v5_5
@@ -133,7 +134,7 @@ package final class SwiftTargetBuildDescription {
133
134
}
134
135
135
136
/// Path to the resource Info.plist file, if generated.
136
- package private( set) var resourceBundleInfoPlistPath : AbsolutePath ?
137
+ public private( set) var resourceBundleInfoPlistPath : AbsolutePath ?
137
138
138
139
/// Paths to the binary libraries the target depends on.
139
140
var libraryBinaryPaths : Set < AbsolutePath > = [ ]
@@ -143,7 +144,7 @@ package final class SwiftTargetBuildDescription {
143
144
144
145
/// Describes the purpose of a test target, including any special roles such as containing a list of discovered
145
146
/// tests or serving as the manifest target which contains the main entry point.
146
- package enum TestTargetRole {
147
+ public enum TestTargetRole {
147
148
/// An ordinary test target, defined explicitly in a package, containing test code.
148
149
case `default`
149
150
@@ -158,10 +159,10 @@ package final class SwiftTargetBuildDescription {
158
159
case entryPoint( isSynthesized: Bool )
159
160
}
160
161
161
- package let testTargetRole : TestTargetRole ?
162
+ public let testTargetRole : TestTargetRole ?
162
163
163
164
/// If this target is a test target.
164
- package var isTestTarget : Bool {
165
+ public var isTestTarget : Bool {
165
166
self . testTargetRole != nil
166
167
}
167
168
@@ -223,13 +224,13 @@ package final class SwiftTargetBuildDescription {
223
224
private( set) var moduleMap : AbsolutePath ?
224
225
225
226
/// The results of applying any build tool plugins to this target.
226
- package let buildToolPluginInvocationResults : [ BuildToolPluginInvocationResult ]
227
+ public let buildToolPluginInvocationResults : [ BuildToolPluginInvocationResult ]
227
228
228
229
/// The results of running any prebuild commands for this target.
229
- package let prebuildCommandResults : [ PrebuildCommandResult ]
230
+ public let prebuildCommandResults : [ PrebuildCommandResult ]
230
231
231
232
/// Any macro products that this target requires to build.
232
- package let requiredMacroProducts : [ ResolvedProduct ]
233
+ public let requiredMacroProducts : [ ResolvedProduct ]
233
234
234
235
/// ObservabilityScope with which to emit diagnostics
235
236
private let observabilityScope : ObservabilityScope
@@ -450,7 +451,7 @@ package final class SwiftTargetBuildDescription {
450
451
}
451
452
452
453
/// The arguments needed to compile this target.
453
- package func compileArguments( ) throws -> [ String ] {
454
+ public func compileArguments( ) throws -> [ String ] {
454
455
var args = [ String] ( )
455
456
args += try self . buildParameters. targetTripleArgs ( for: self . target)
456
457
@@ -625,7 +626,7 @@ package final class SwiftTargetBuildDescription {
625
626
626
627
/// When `scanInvocation` argument is set to `true`, omit the side-effect producing arguments
627
628
/// such as emitting a module or supplementary outputs.
628
- package func emitCommandLine( scanInvocation: Bool = false ) throws -> [ String ] {
629
+ public func emitCommandLine( scanInvocation: Bool = false ) throws -> [ String ] {
629
630
var result : [ String ] = [ ]
630
631
result. append ( self . buildParameters. toolchain. swiftCompilerPath. pathString)
631
632
0 commit comments