Skip to content

Commit

Permalink
[Build] LLBuildManifest: Mark all new APIs as package and convert m…
Browse files Browse the repository at this point in the history
…ethods into computed properties
  • Loading branch information
xedin committed May 31, 2024
1 parent a15e18c commit 3a2d24b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension LLBuildManifestBuilder {
let additionalInputs = try addBuildToolPlugins(.clang(target))

// Create a phony node to represent the entire target.
let targetName = target.getLLBuildTargetName()
let targetName = target.llbuildTargetName
let output: Node = .virtual(targetName)

self.manifest.addNode(output, toTarget: targetName)
Expand Down
18 changes: 11 additions & 7 deletions Sources/Build/BuildManifest/LLBuildManifestBuilder+Product.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import struct PackageGraph.ResolvedProduct

extension LLBuildManifestBuilder {
func createProductCommand(_ buildProduct: ProductBuildDescription) throws {
let cmdName = try buildProduct.getCommandName()
let cmdName = try buildProduct.commandName

// Add dependency on Info.plist generation on Darwin platforms.
let testInputs: [AbsolutePath]
Expand All @@ -37,7 +37,7 @@ extension LLBuildManifestBuilder {
}

// Create a phony node to represent the entire target.
let targetName = try buildProduct.getLLBuildTargetName()
let targetName = try buildProduct.llbuildTargetName
let output: Node = .virtual(targetName)

let finalProductNode: Node
Expand Down Expand Up @@ -88,7 +88,7 @@ extension LLBuildManifestBuilder {
outputPath: plistPath
)

let cmdName = try buildProduct.getCommandName()
let cmdName = try buildProduct.commandName
let codeSigningOutput = Node.virtual(targetName + "-CodeSigning")
try self.manifest.addShellCmd(
name: "\(cmdName)-entitlements",
Expand Down Expand Up @@ -125,12 +125,16 @@ extension LLBuildManifestBuilder {
}

extension ProductBuildDescription {
public func getLLBuildTargetName() throws -> String {
try self.product.getLLBuildTargetName(buildParameters: self.buildParameters)
package var llbuildTargetName: String {
get throws {
try self.product.getLLBuildTargetName(buildParameters: self.buildParameters)
}
}

public func getCommandName() throws -> String {
try "C.\(self.getLLBuildTargetName())\(self.buildParameters.suffix)"
package var commandName: String {
get throws {
try "C.\(self.llbuildTargetName)\(self.buildParameters.suffix)"
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension LLBuildManifestBuilder {
outputs.append(output)
}

let cmdName = target.getLLBuildResourcesCmdName()
let cmdName = target.llbuildResourcesCmdName
self.manifest.addPhonyCmd(name: cmdName, inputs: outputs, outputs: [.virtual(cmdName)])

return .virtual(cmdName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ extension LLBuildManifestBuilder {

// Depend on any required macro product's output.
try target.requiredMacroProducts.forEach { macro in
try inputs.append(.virtual(macro.getLLBuildTargetName()))
try inputs.append(.virtual(macro.llbuildTargetName))
}

return inputs + additionalInputs
Expand Down
4 changes: 2 additions & 2 deletions Sources/Build/BuildManifest/LLBuildManifestBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ extension TargetBuildDescription {
}

extension TargetBuildDescription {
public func getLLBuildResourcesCmdName() -> String {
package var llbuildResourcesCmdName: String {
"\(self.target.name)-\(self.buildParameters.triple.tripleString)-\(self.buildParameters.buildConfig)\(self.buildParameters.suffix).module-resources"
}
}

extension ClangTargetBuildDescription {
public func getLLBuildTargetName() -> String {
package var llbuildTargetName: String {
self.target.getLLBuildTargetName(buildParameters: self.buildParameters)
}
}
Expand Down

0 comments on commit 3a2d24b

Please sign in to comment.