Skip to content

Commit

Permalink
Adding back stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Prachi Pai Asnodkar authored and Prachi Pai Asnodkar committed Aug 9, 2018
1 parent 1546ab6 commit 8324f0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
14 changes: 6 additions & 8 deletions Sources/Build/llbuild.swift
Expand Up @@ -249,6 +249,7 @@ public struct LLBuildManifestGenerator {
switch dependency {
case .target(let target):
addStaticTargetInputs(target)

case .product(let product):
switch product.type {
case .executable, .library(.dynamic):
Expand All @@ -265,12 +266,12 @@ public struct LLBuildManifestGenerator {
}
}
}

var buildTarget = Target(name: target.target.getLLBuildTargetName(config: plan.buildParameters.configuration.dirname))
let buildConfig = plan.buildParameters.configuration.dirname
var buildTarget = Target(name: target.target.getLLBuildTargetName(config: buildConfig))
// The target only cares about the module output.
buildTarget.outputs.insert(target.moduleOutputPath.asString)
let tool = SwiftCompilerTool(target: target, inputs: inputs.values)
buildTarget.cmds.insert(Command(name: target.target.getCommandName(config: plan.buildParameters.configuration.dirname), tool: tool))
buildTarget.cmds.insert(Command(name: target.target.getCommandName(config: buildConfig), tool: tool))
return buildTarget
}

Expand Down Expand Up @@ -318,12 +319,9 @@ extension ResolvedTarget {
public func getCommandName(config: String) -> String {
return "C." + getLLBuildTargetName(config: config)
}

public func getLLBuildTargetName(config: String) -> String {
if config == "release" {
return "\(name)-release.module"
}
return "\(name)-debug.module"
return "\(name)-\(config).module"
}
}

Expand Down
29 changes: 0 additions & 29 deletions Sources/Commands/SwiftTool.swift
Expand Up @@ -564,30 +564,6 @@ public class SwiftTool<Options: ToolOptions> {
func getManifestLoader() throws -> ManifestLoader {
return try _manifestLoader.dematerialize()
}

func shouldRegenerateManifest() throws -> Bool {
// Check if we are allowed to use llbuild manifest caching.
guard options.shouldEnableManifestCaching else {
return true
}

// Check if we need to generate the llbuild manifest.
let parameters: BuildParameters = try self.buildParameters()
guard localFileSystem.isFile(parameters.llbuildManifest) else {
return true
}

// Run the target which computes if regeneration is needed.
let args = [try getToolchain().llbuild.asString, "-f", parameters.llbuildManifest.asString, "regenerate"]
do {
try Process.checkNonZeroExit(arguments: args)
} catch {
// Regenerate the manifest if this fails for some reason.
warning(message: "Failed to run the regeneration check: \(error)")
return true
}
return try !self.buildManifestRegenerationToken().isValid()
}

func computeLLBuildTargetName(for subset: BuildSubset, buildParameters: BuildParameters) throws -> String? {
switch subset {
Expand All @@ -610,11 +586,6 @@ public class SwiftTool<Options: ToolOptions> {

/// Build a subset of products and targets using swift-build-tool.
func build(plan: BuildPlan, subset: BuildSubset) throws {
guard !plan.graph.rootPackages[0].targets.isEmpty else {
warning(message: "no targets to build in package")
return
}

guard let llbuildTargetName = subset.llbuildTargetName(for: plan.graph, diagnostics: diagnostics, config: plan.buildParameters.configuration.dirname) else {
return
}
Expand Down

0 comments on commit 8324f0c

Please sign in to comment.