Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for switch debug & release builds invalidates build #1731

Merged
merged 3 commits into from Aug 14, 2018

Conversation

prachipai
Copy link
Contributor

No description provided.

var commandName: String {
return "C.\(llbuildTargetName)"

public func getBuildTargetName(config: String?) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be optional. We should always pass the config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: function name -> getLLBuildTargetName(config:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return "\(name)-release.module"
}
else if config == "debug" {
return "\(name)-debug.module"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the config is non-optional, this function can just be: return "\(name)-\(config).module"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@prachipai prachipai force-pushed the switchFix branch 2 times, most recently from 43650c8 to c0424d8 Compare August 8, 2018 23:14
if config == "release" {
return "\(name)-release.module"
}
return "\(name)-debug.module"
Copy link
Member

@ankitspd ankitspd Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be return "\(name)-\(config).module"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -267,11 +266,11 @@ public struct LLBuildManifestGenerator {
}
}

var buildTarget = Target(name: target.target.llbuildTargetName)
var buildTarget = Target(name: target.target.getLLBuildTargetName(config: plan.buildParameters.configuration.dirname))
Copy link
Member

@ankitspd ankitspd Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we need it twice in this method, its better to extract it into a new variable:

let buildConfig = plan.buildParameters.configuration.dirname
..
var buildTarget = Target(name: target.target.getLLBuildTargetName(config: buildConfig))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -249,7 +249,6 @@ public struct LLBuildManifestGenerator {
switch dependency {
case .target(let target):
addStaticTargetInputs(target)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: avoid this extra diff

@@ -565,28 +565,57 @@ public class SwiftTool<Options: ToolOptions> {
return try _manifestLoader.dematerialize()
}

func computeLLBuildTargetName(for subset: BuildSubset) throws -> String? {
func shouldRegenerateManifest() throws -> Bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a bad merge

return
}
try runLLBuild(manifest: parameters.llbuildManifest, llbuildTarget: llbuildTargetName)
}

/// Build a subset of products and targets using swift-build-tool.
func build(plan: BuildPlan, subset: BuildSubset) throws {
guard let llbuildTargetName = subset.llbuildTargetName(for: plan.graph, diagnostics: diagnostics) else {
guard !plan.graph.rootPackages[0].targets.isEmpty else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why is this diff here, bad merge/rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@prachipai prachipai force-pushed the switchFix branch 10 times, most recently from 3945506 to 8324f0c Compare August 9, 2018 00:28
@@ -266,12 +266,12 @@ public struct LLBuildManifestGenerator {
}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should keep this newline

@@ -564,29 +564,29 @@ public class SwiftTool<Options: ToolOptions> {
func getManifestLoader() throws -> ManifestLoader {
return try _manifestLoader.dematerialize()
}

func computeLLBuildTargetName(for subset: BuildSubset) throws -> String? {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same space issue here

@ankitspd
Copy link
Member

ankitspd commented Aug 9, 2018

We need to add this config in products as well. You can notice linker re-running in executable packages:

swift package init --type executable
./swift-build
./swift-build -c release
./swift-build

@ankitspd ankitspd added the WIP Work in progress label Aug 9, 2018
@prachipai
Copy link
Contributor Author

Added for products too!

@ddunbar
Copy link
Member

ddunbar commented Aug 14, 2018

Is this ready for rereview?

@prachipai
Copy link
Contributor Author

We're thinking to write some tests to make sure other things aren't getting broken. Ankit was worried about this.

@ankitspd
Copy link
Member

This looks good.

@ankitspd
Copy link
Member

@swift-ci smoke test

@ankitspd ankitspd removed the WIP Work in progress label Aug 14, 2018
@ankitspd ankitspd merged commit 30154b2 into apple:master Aug 14, 2018
@ddunbar
Copy link
Member

ddunbar commented Aug 15, 2018

Yay yay yay! Can’t wait for a toolchain...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants