Skip to content

Conversation

@cltnschlosser
Copy link
Contributor

Fixes Driver/continue-building-after-errors.swift

Long term we probably want to add more to llbuildSwift, so that we can cancel the build there instead of going through all the jobs. We could suspend the jobQueue so it doesn't start anymore. It also feels like llbuild should have a mechanism for throttling parallel builds, so maybe with that the queue could be replaced.

Copy link
Contributor

@owenv owenv left a comment

Choose a reason for hiding this comment

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

This approach seems like it should work fine as far as I can tell, so these changes LGTM once one usage of _spi is temporarily dropped and we update SPM's executor to match the changed protocol requirement.

delegate: JobExecutionDelegate,
numParallelJobs: Int,
continueBuildingAfterErrors: Bool,
forceResponseFiles: Bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

This will require a corresponding update to SPM's executor

Copy link
Contributor

Choose a reason for hiding this comment

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

That's why in my version, I put this bit in the workload parameter. Seemed like one could defend that the decision to run jobs after an error was a workload parameter.

Comment on lines -309 to -310
// FIXME: It's unfortunate we diagnose this twice, once for each job which uses the input.
verifier.expect(.error("input file '\(other.description)' was modified during the build"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still needed if -driver-continue-building... is set? Or can we 86 it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope not needed. It was getting emitted twice because the second job was running even though the first one failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh @davidungar I missunderstood your question. Yes, if continue building after errors is set, then we would get 2 errors, but since it's not and the driver defaults to 1 job at a time, it only outputs once.

Is this not causing a test failure in #387 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, @cltnschlosser . Apparently not causing a failure there. As soon as I've gotten my PRs in, I'll push forward on the legacy tests and see what pops up.

@_spi(Testing) public let numParallelJobs: Int?

/// Whether jobs should continue to be executed after a failure.
@_spi(Testing) public let continueBuildingAfterErrors: Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to drop te @_spi here until the related build issues get sorted out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's being used a lot in this file. Not sure what the issue is, but it's still being used in a lot of places.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a set of changes I have not pushed in a PR (yet) that comments out all the spi's so we can use the older compilers. Not sure what to do about this issue.

Comment on lines 447 to 459
override func inputsAvailable(_ engine: LLTaskBuildEngine) {
// Return early any of the input failed.
guard allInputsSucceeded else {
guard allInputsSucceeded, !context.isCancelled else {
return engine.taskIsComplete(DriverBuildValue.jobExecution(success: false))
}

context.jobQueue.addOperation {
guard !self.context.isCancelled else {
return engine.taskIsComplete(DriverBuildValue.jobExecution(success: false))
}
self.executeJob(engine)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If these changes work, this part of the PR is more elegant than mine.

@davidungar
Copy link
Contributor

@cltnschlosser What do you think? I like the workload integration in my PR, but I like the way your code stops the build better in your PR. What are your thoughts?

@cltnschlosser
Copy link
Contributor Author

Closing this in favor of #387

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.

3 participants