Skip to content

[build-script] Argument Builder DSL Conversion: Episode 3 #13231

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 7 commits into from
Dec 6, 2017

Conversation

Rostepher
Copy link
Contributor

@Rostepher Rostepher commented Dec 3, 2017

This PR is the third and final part of #13117 and similarly doesn't contain any real functional changes. I did have to add support for asserting a path contains an executable in both the PathType and StorePathAction classes and I've added associated tests. I've also converted the top-level arguments to the new builder DSL, which means that all the argument definitions are now in the builder DSL. All the unit-tests still pass which makes me confident that this PR is low risk.

rdar://34336890

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 3, 2017

Build failed
Swift Test Linux Platform
Git Sha - 2027744f7248bbdae7cf89335ee5779515e2d580

@swift-ci
Copy link
Contributor

swift-ci commented Dec 3, 2017

Build failed
Swift Test OS X Platform
Git Sha - 2027744f7248bbdae7cf89335ee5779515e2d580

@Rostepher Rostepher changed the title [build-script] Argument Builder DSL Conversion: Episode 2 [build-script] Argument Builder DSL Conversion: Episode 3 Dec 4, 2017
@Rostepher Rostepher force-pushed the builder-dsl-episode-3 branch from 96f4aa3 to 6fd4b80 Compare December 5, 2017 03:16
@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 5, 2017

Build failed
Swift Test Linux Platform
Git Sha - 2027744f7248bbdae7cf89335ee5779515e2d580

@swift-ci
Copy link
Contributor

swift-ci commented Dec 5, 2017

Build failed
Swift Test OS X Platform
Git Sha - 2027744f7248bbdae7cf89335ee5779515e2d580

@Rostepher Rostepher force-pushed the builder-dsl-episode-3 branch from 6fd4b80 to a518ffc Compare December 5, 2017 21:37
@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 5, 2017

Build failed
Swift Test Linux Platform
Git Sha - 6fd4b80650ed5e87c54e15b66d340367949b78dc

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@lplarson lplarson left a comment

Choose a reason for hiding this comment

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

I had a couple questions, but LGTM.

if isinstance(components[0], str):
components = components[0].split('.')
elif isinstance(components[0], list):
components = tuple(components[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to convert this to a tuple here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, I can remove it if you'd like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, removing the conversion will make it a bit clearer.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can convert it to isinstance(components[0], (list, tuple)).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, had no idea you could pass a tuple to isinstance. Today I learned!

@@ -32,6 +34,44 @@

# -----------------------------------------------------------------------------

class CompilerVersion(object):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we already have anything like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do have an equivalent (albeit less type-safe) class in utils/swift_build_support/swift_build_support/arguments.py, however one of my main goals with the build_swift module is to completely remove reliance on that package since it's quite messy. Rather I'm opting here to implement a well-tested version analogous to the older one.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a comment to the old one indicating that it's deprecated then and link to the new one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing!

@@ -107,6 +173,12 @@ def __init__(self):
ClangVersionType.VERSION_REGEX,
ClangVersionType.ERROR_MESSAGE)

def __call__(self, value):
matches = super(ClangVersionType, self).__call__(value)
components = filter(None, matches.group(1, 2, 3, 5))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the filter here necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

This filters out 0 which is a incorrect.

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2017

Build failed
Swift Test OS X Platform
Git Sha - 6fd4b80650ed5e87c54e15b66d340367949b78dc

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2017

Build failed
Swift Test Linux Platform
Git Sha - a518ffc

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2017

Build failed
Swift Test OS X Platform
Git Sha - a518ffc

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2017

Build failed
Swift Test Linux Platform
Git Sha - d44263a

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2017

Build failed
Swift Test OS X Platform
Git Sha - d44263a

Copy link
Member

@shahmishal shahmishal left a comment

Choose a reason for hiding this comment

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

LGTM!

@Rostepher Rostepher merged commit 5a8a25e into swiftlang:master Dec 6, 2017
@Rostepher Rostepher deleted the builder-dsl-episode-3 branch December 6, 2017 20:36
@AnthonyLatsis AnthonyLatsis added build-script Area → utils: The build script improvement and removed enhancement labels Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-script Area → utils: The build script improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants