Skip to content

Build script invocation helper #2919

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

Merged
merged 4 commits into from
Jun 8, 2016

Conversation

ddunbar
Copy link
Contributor

@ddunbar ddunbar commented Jun 6, 2016

What's in this pull request?

This factors out a BuildScriptInvocation helper object and then decomposes the high-level operation into the conceptual phases mentioned in #2804.

This should make it more obvious what the high-level flow of the script is, and where new code belongs while respecting the conceptual divisions.

Part of SR-237.


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 6, 2016

@swift-ci please Python lint

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 6, 2016

@swift-ci please smoke test

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 6, 2016

/cc @gribozavr @rintaro @karwa

@karwa
Copy link
Contributor

karwa commented Jun 6, 2016

Yep, I certainly support the intent of this - will need to look at the code later. One problem I was encountering with my changes was that we can't really test the argument processing because it's all in one mega function which also calls build-script-impl.

The way I would like to see this going is that BuildScriptInvocation parses out a set of lists from its parameters:

  • Products to configure/build/test
  • Targets to configure/build/test (per host!)

Then we loop over hosts(, targets) & products and call a configure()/build()/test() function.

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 6, 2016

Yes, that is exactly the direction I intend to go here. I actually factored this out into its own PR so I could use it to do that in #2880, which I will then extend to drive individual actions (using #2844).

@ddunbar ddunbar force-pushed the build-script-invocation-helper branch from 39e34fa to 46c3384 Compare June 6, 2016 23:04
@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 6, 2016

@swift-ci please smoke test

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 8, 2016

Since this has gotten conflicted, I'm just going to merge this with #2880, which I have refactored to include it.

@ddunbar ddunbar closed this Jun 8, 2016
ddunbar added 3 commits June 8, 2016 08:37
 - This is an object designed to represent a single invocation of the build
   script, primarily for use in decomposing the main program flow into its
   distinct conceptual pieces.
@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 8, 2016

Actually, reopening this. I remember the reason I factored it out was because I was hoping to land it ASAP to limit the window of merge conflicts.

@ddunbar ddunbar reopened this Jun 8, 2016
@ddunbar ddunbar force-pushed the build-script-invocation-helper branch from 46c3384 to bc0f921 Compare June 8, 2016 15:52
@ddunbar ddunbar force-pushed the build-script-invocation-helper branch from bc0f921 to 754521b Compare June 8, 2016 15:53
@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 8, 2016

@swift-ci please Python lint

@swift-ci please smoke test

@ddunbar
Copy link
Contributor Author

ddunbar commented Jun 8, 2016

@swift-ci please Python lint

@gribozavr
Copy link
Contributor

@ddunbar LGTM! I verified with manual inspection that this refactoring does not drop any code.

@ddunbar ddunbar merged commit bc4e3c3 into swiftlang:master Jun 8, 2016
if not os.path.exists(self.workspace.source_dir("ninja")):
diagnostics.fatal(
"can't find source directory for ninja "
"(tried %s)" % (self.workspace.source_dir("ninja")))
Copy link
Member

Choose a reason for hiding this comment

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

This check was deferred after (possible) shell.rmtree(build_dir).
We should perform every validation before any destructive operation.

Anyway, I'm OK with it for now. build-script-impl still have many validations.
When we migrate them, we should rearrange them (including this).

@modocache modocache mentioned this pull request Jun 9, 2016
2 tasks
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.

4 participants