Skip to content

Commit 62473f0

Browse files
committed
Revert "Hide more llbuild-specific APIs (#7387)"
This reverts commit 5185c03.
1 parent 3443ff9 commit 62473f0

19 files changed

+305
-305
lines changed

Sources/Build/BuildDescription/ClangTargetBuildDescription.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ import struct SPMBuildCore.PrebuildCommandResult
2323
import enum TSCBasic.ProcessEnv
2424

2525
/// Target description for a Clang target i.e. C language family target.
26-
package final class ClangTargetBuildDescription {
26+
public final class ClangTargetBuildDescription {
2727
/// The package this target belongs to.
28-
package let package: ResolvedPackage
28+
public let package: ResolvedPackage
2929

3030
/// The target described by this target.
31-
package let target: ResolvedModule
31+
public let target: ResolvedModule
3232

3333
/// The underlying clang target.
34-
package let clangTarget: ClangTarget
34+
public let clangTarget: ClangTarget
3535

3636
/// The tools version of the package that declared the target. This can
3737
/// can be used to conditionalize semantically significant changes in how
3838
/// a target is built.
39-
package let toolsVersion: ToolsVersion
39+
public let toolsVersion: ToolsVersion
4040

4141
/// The build parameters.
4242
let buildParameters: BuildParameters
@@ -47,7 +47,7 @@ package final class ClangTargetBuildDescription {
4747
}
4848

4949
/// The list of all resource files in the target, including the derived ones.
50-
package var resources: [Resource] {
50+
public var resources: [Resource] {
5151
self.target.underlying.resources + self.pluginDerivedResources
5252
}
5353

@@ -65,7 +65,7 @@ package final class ClangTargetBuildDescription {
6565
}
6666

6767
/// The modulemap file for this target, if any.
68-
package private(set) var moduleMap: AbsolutePath?
68+
public private(set) var moduleMap: AbsolutePath?
6969

7070
/// Path to the temporary directory for this target.
7171
var tempsPath: AbsolutePath
@@ -82,13 +82,13 @@ package final class ClangTargetBuildDescription {
8282
private var pluginDerivedResources: [Resource]
8383

8484
/// Path to the resource accessor header file, if generated.
85-
package private(set) var resourceAccessorHeaderFile: AbsolutePath?
85+
public private(set) var resourceAccessorHeaderFile: AbsolutePath?
8686

8787
/// Path to the resource Info.plist file, if generated.
88-
package private(set) var resourceBundleInfoPlistPath: AbsolutePath?
88+
public private(set) var resourceBundleInfoPlistPath: AbsolutePath?
8989

9090
/// The objects in this target.
91-
package var objects: [AbsolutePath] {
91+
public var objects: [AbsolutePath] {
9292
get throws {
9393
try compilePaths().map(\.object)
9494
}
@@ -104,12 +104,12 @@ package final class ClangTargetBuildDescription {
104104
private let fileSystem: FileSystem
105105

106106
/// If this target is a test target.
107-
package var isTestTarget: Bool {
107+
public var isTestTarget: Bool {
108108
target.type == .test
109109
}
110110

111111
/// The results of applying any build tool plugins to this target.
112-
package let buildToolPluginInvocationResults: [BuildToolPluginInvocationResult]
112+
public let buildToolPluginInvocationResults: [BuildToolPluginInvocationResult]
113113

114114
/// Create a new target description with target and build parameters.
115115
init(
@@ -188,7 +188,7 @@ package final class ClangTargetBuildDescription {
188188
}
189189

190190
/// An array of tuples containing filename, source, object and dependency path for each of the source in this target.
191-
package func compilePaths()
191+
public func compilePaths()
192192
throws -> [(filename: RelativePath, source: AbsolutePath, object: AbsolutePath, deps: AbsolutePath)]
193193
{
194194
let sources = [
@@ -212,7 +212,7 @@ package final class ClangTargetBuildDescription {
212212
/// NOTE: The parameter to specify whether to get C++ semantics is currently optional, but this is only for revlock
213213
/// avoidance with clients. Callers should always specify what they want based either the user's indication or on a
214214
/// default value (possibly based on the filename suffix).
215-
package func basicArguments(
215+
public func basicArguments(
216216
isCXX isCXXOverride: Bool? = .none,
217217
isC: Bool = false
218218
) throws -> [String] {
@@ -335,7 +335,7 @@ package final class ClangTargetBuildDescription {
335335
return args
336336
}
337337

338-
package func emitCommandLine(for filePath: AbsolutePath) throws -> [String] {
338+
public func emitCommandLine(for filePath: AbsolutePath) throws -> [String] {
339339
let standards = [
340340
(clangTarget.cxxLanguageStandard, SupportedLanguageExtension.cppExtensions),
341341
(clangTarget.cLanguageStandard, SupportedLanguageExtension.cExtensions),

Sources/Build/BuildDescription/PluginDescription.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ import protocol Basics.FileSystem
2121
/// But because the package graph and build plan are not loaded for incremental
2222
/// builds, this information is included in the BuildDescription, and the plugin
2323
/// targets are compiled directly.
24-
package final class PluginDescription: Codable {
24+
public final class PluginDescription: Codable {
2525
/// The identity of the package in which the plugin is defined.
26-
package let package: PackageIdentity
26+
public let package: PackageIdentity
2727

2828
/// The name of the plugin target in that package (this is also the name of
2929
/// the plugin).
30-
package let targetName: String
30+
public let targetName: String
3131

3232
/// The names of any plugin products in that package that vend the plugin
3333
/// to other packages.
34-
package let productNames: [String]
34+
public let productNames: [String]
3535

3636
/// The tools version of the package that declared the target. This affects
3737
/// the API that is available in the PackagePlugin module.
38-
package let toolsVersion: ToolsVersion
38+
public let toolsVersion: ToolsVersion
3939

4040
/// Swift source files that comprise the plugin.
41-
package let sources: Sources
41+
public let sources: Sources
4242

4343
/// Initialize a new plugin target description. The target is expected to be
4444
/// a `PluginTarget`.

Sources/Build/BuildDescription/ProductBuildDescription.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ import SPMBuildCore
2222
import struct TSCBasic.SortedArray
2323

2424
/// The build description for a product.
25-
package final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription {
25+
public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription {
2626
/// The reference to the product.
27-
package let package: ResolvedPackage
27+
public let package: ResolvedPackage
2828

2929
/// The reference to the product.
30-
package let product: ResolvedProduct
30+
public let product: ResolvedProduct
3131

3232
/// The tools version of the package that declared the product. This can
3333
/// can be used to conditionalize semantically significant changes in how
3434
/// a target is built.
35-
package let toolsVersion: ToolsVersion
35+
public let toolsVersion: ToolsVersion
3636

3737
/// The build parameters.
38-
package let buildParameters: BuildParameters
38+
public let buildParameters: BuildParameters
3939

4040
/// All object files to link into this product.
4141
///
4242
// Computed during build planning.
43-
package internal(set) var objects = SortedArray<AbsolutePath>()
43+
public internal(set) var objects = SortedArray<AbsolutePath>()
4444

4545
/// The dynamic libraries this product needs to link with.
4646
// Computed during build planning.
@@ -132,7 +132,7 @@ package final class ProductBuildDescription: SPMBuildCore.ProductBuildDescriptio
132132
}
133133

134134
/// The arguments to the librarian to create a static library.
135-
package func archiveArguments() throws -> [String] {
135+
public func archiveArguments() throws -> [String] {
136136
let librarian = self.buildParameters.toolchain.librarianPath.pathString
137137
let triple = self.buildParameters.triple
138138
if triple.isWindows(), librarian.hasSuffix("link") || librarian.hasSuffix("link.exe") {
@@ -145,7 +145,7 @@ package final class ProductBuildDescription: SPMBuildCore.ProductBuildDescriptio
145145
}
146146

147147
/// The arguments to link and create this product.
148-
package func linkArguments() throws -> [String] {
148+
public func linkArguments() throws -> [String] {
149149
var args = [buildParameters.toolchain.swiftCompilerPath.pathString]
150150
args += self.buildParameters.sanitizers.linkSwiftFlags()
151151
args += self.additionalFlags
@@ -402,7 +402,7 @@ package final class ProductBuildDescription: SPMBuildCore.ProductBuildDescriptio
402402
}
403403

404404
extension SortedArray where Element == AbsolutePath {
405-
package static func +=<S: Sequence>(lhs: inout SortedArray, rhs: S) where S.Iterator.Element == AbsolutePath {
405+
public static func +=<S: Sequence>(lhs: inout SortedArray, rhs: S) where S.Iterator.Element == AbsolutePath {
406406
lhs.insert(contentsOf: rhs)
407407
}
408408
}

Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ import DriverSupport
2828
import struct TSCBasic.ByteString
2929

3030
/// Target description for a Swift target.
31-
package final class SwiftTargetBuildDescription {
31+
public final class SwiftTargetBuildDescription {
3232
/// The package this target belongs to.
33-
package let package: ResolvedPackage
33+
public let package: ResolvedPackage
3434

3535
/// The target described by this target.
36-
package let target: ResolvedModule
36+
public let target: ResolvedModule
3737

3838
private let swiftTarget: SwiftTarget
3939

4040
/// The tools version of the package that declared the target. This can
4141
/// can be used to conditionalize semantically significant changes in how
4242
/// a target is built.
43-
package let toolsVersion: ToolsVersion
43+
public let toolsVersion: ToolsVersion
4444

4545
/// The build parameters for this target.
4646
let defaultBuildParameters: BuildParameters
@@ -81,22 +81,22 @@ package final class SwiftTargetBuildDescription {
8181
}
8282

8383
/// The list of all source files in the target, including the derived ones.
84-
package var sources: [AbsolutePath] {
84+
public var sources: [AbsolutePath] {
8585
self.target.sources.paths + self.derivedSources.paths + self.pluginDerivedSources.paths
8686
}
8787

88-
package var sourcesFileListPath: AbsolutePath {
88+
public var sourcesFileListPath: AbsolutePath {
8989
self.tempsPath.appending(component: "sources")
9090
}
9191

9292
/// The list of all resource files in the target, including the derived ones.
93-
package var resources: [Resource] {
93+
public var resources: [Resource] {
9494
self.target.underlying.resources + self.pluginDerivedResources
9595
}
9696

9797
/// The objects in this target, containing either machine code or bitcode
9898
/// depending on the build parameters used.
99-
package var objects: [AbsolutePath] {
99+
public var objects: [AbsolutePath] {
100100
get throws {
101101
let relativeSources = self.target.sources.relativePaths
102102
+ self.derivedSources.relativePaths
@@ -117,7 +117,7 @@ package final class SwiftTargetBuildDescription {
117117
}
118118

119119
/// The path to the swiftmodule file after compilation.
120-
public var moduleOutputPath: AbsolutePath { // note: needs to be `public` because of sourcekit-lsp
120+
public var moduleOutputPath: AbsolutePath { // note: needs to be public because of sourcekit-lsp
121121
// If we're an executable and we're not allowing test targets to link against us, we hide the module.
122122
let triple = defaultBuildParameters.triple
123123
let allowLinkingAgainstExecutables = (triple.isDarwin() || triple.isLinux() || triple.isWindows()) && self.toolsVersion >= .v5_5
@@ -138,7 +138,7 @@ package final class SwiftTargetBuildDescription {
138138
}
139139

140140
/// Path to the resource Info.plist file, if generated.
141-
package private(set) var resourceBundleInfoPlistPath: AbsolutePath?
141+
public private(set) var resourceBundleInfoPlistPath: AbsolutePath?
142142

143143
/// Paths to the binary libraries the target depends on.
144144
var libraryBinaryPaths: Set<AbsolutePath> = []
@@ -148,7 +148,7 @@ package final class SwiftTargetBuildDescription {
148148

149149
/// Describes the purpose of a test target, including any special roles such as containing a list of discovered
150150
/// tests or serving as the manifest target which contains the main entry point.
151-
package enum TestTargetRole {
151+
public enum TestTargetRole {
152152
/// An ordinary test target, defined explicitly in a package, containing test code.
153153
case `default`
154154

@@ -163,10 +163,10 @@ package final class SwiftTargetBuildDescription {
163163
case entryPoint(isSynthesized: Bool)
164164
}
165165

166-
package let testTargetRole: TestTargetRole?
166+
public let testTargetRole: TestTargetRole?
167167

168168
/// If this target is a test target.
169-
package var isTestTarget: Bool {
169+
public var isTestTarget: Bool {
170170
self.testTargetRole != nil
171171
}
172172

@@ -228,13 +228,13 @@ package final class SwiftTargetBuildDescription {
228228
private(set) var moduleMap: AbsolutePath?
229229

230230
/// The results of applying any build tool plugins to this target.
231-
package let buildToolPluginInvocationResults: [BuildToolPluginInvocationResult]
231+
public let buildToolPluginInvocationResults: [BuildToolPluginInvocationResult]
232232

233233
/// The results of running any prebuild commands for this target.
234-
package let prebuildCommandResults: [PrebuildCommandResult]
234+
public let prebuildCommandResults: [PrebuildCommandResult]
235235

236236
/// Any macro products that this target requires to build.
237-
package let requiredMacroProducts: [ResolvedProduct]
237+
public let requiredMacroProducts: [ResolvedProduct]
238238

239239
/// ObservabilityScope with which to emit diagnostics
240240
private let observabilityScope: ObservabilityScope
@@ -471,7 +471,7 @@ package final class SwiftTargetBuildDescription {
471471
}
472472

473473
/// The arguments needed to compile this target.
474-
package func compileArguments() throws -> [String] {
474+
public func compileArguments() throws -> [String] {
475475
var args = [String]()
476476
args += try self.defaultBuildParameters.tripleArgs(for: self.target)
477477

@@ -646,7 +646,7 @@ package final class SwiftTargetBuildDescription {
646646

647647
/// When `scanInvocation` argument is set to `true`, omit the side-effect producing arguments
648648
/// such as emitting a module or supplementary outputs.
649-
package func emitCommandLine(scanInvocation: Bool = false) throws -> [String] {
649+
public func emitCommandLine(scanInvocation: Bool = false) throws -> [String] {
650650
var result: [String] = []
651651
result.append(self.defaultBuildParameters.toolchain.swiftCompilerPath.pathString)
652652

Sources/Build/BuildDescription/TargetBuildDescription.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import struct PackageModel.ToolsVersion
1717
import struct SPMBuildCore.BuildToolPluginInvocationResult
1818
import struct SPMBuildCore.BuildParameters
1919

20-
package enum BuildDescriptionError: Swift.Error {
20+
public enum BuildDescriptionError: Swift.Error {
2121
case requestedFileNotPartOfTarget(targetName: String, requestedFilePath: AbsolutePath)
2222
}
2323

2424
/// A target description which can either be for a Swift or Clang target.
25-
package enum TargetBuildDescription {
25+
public enum TargetBuildDescription {
2626
/// Swift target description.
2727
case swift(SwiftTargetBuildDescription)
2828

Sources/Build/BuildManifest/LLBuildManifestBuilder+Swift.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extension LLBuildManifestBuilder {
188188
// dependency graph of B. The driver is then responsible for the necessary post-processing
189189
// to merge the dependency graphs and plan the build for A, using artifacts of B as explicit
190190
// inputs.
191-
package func addTargetsToExplicitBuildManifest() throws {
191+
public func addTargetsToExplicitBuildManifest() throws {
192192
// Sort the product targets in topological order in order to collect and "bubble up"
193193
// their respective dependency graphs to the depending targets.
194194
let nodes: [ResolvedModule.Dependency] = try self.plan.targetMap.keys.compactMap {

0 commit comments

Comments
 (0)