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

[build-script] Argument Builder DSL Conversion: Episode 1 #13117

Merged
merged 7 commits into from Dec 1, 2017

Conversation

Rostepher
Copy link
Contributor

Purpose

This PR begins the conversion to the new argument builder DSL. There's no real functional changes, just converting to the more expressive builder system and adding some visual separators between argument groups. More conversion PRs are to follow until all the arguments are converted.

rdar://34336890

@Rostepher Rostepher self-assigned this Nov 28, 2017
@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - b428563c5cb4ab29492070309291d7431e4e8e14

@zbowling
Copy link
Contributor

I added a bunch of args in #12955 (and related PRs) that will have to move over to this DSL format

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - b428563c5cb4ab29492070309291d7431e4e8e14

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - b428563c5cb4ab29492070309291d7431e4e8e14

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - b428563c5cb4ab29492070309291d7431e4e8e14

@Rostepher
Copy link
Contributor Author

@swift-ci please test Mac OS X

@Rostepher
Copy link
Contributor Author

@swift-ci please clean test Mac OS X

@Rostepher
Copy link
Contributor Author

@swift-ci please test Mac OS X

@shahmishal
Copy link
Member

@swift-ci please test OS X

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - f5064cf4b446d958336e03980fbd0e6592690c94

option(['-e', '--eclipse'], store('cmake_generator'),
const='Eclipse CDT4 - Ninja',
default=defaults.CMAKE_GENERATOR,
help="use CMake's Xcode generator (%(default)s by default)")
Copy link
Contributor

Choose a reason for hiding this comment

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

This string seems accidentally repeated.

Overall very cool. 👏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, thanks for catching that! I can't take all the credit here, this PR and the ones leading up to it were based on some awesome work by @rintaro last year in #2190.

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - f5064cf4b446d958336e03980fbd0e6592690c94

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - f5064cf4b446d958336e03980fbd0e6592690c94

@Rostepher
Copy link
Contributor Author

@swift-ci please test

@Rostepher
Copy link
Contributor Author

@swift-ci please smoke test

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - 8ad0f981a379fde593045288380a9ab2d6906218

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - 8ad0f981a379fde593045288380a9ab2d6906218

with mutually_exclusive_group():
set_defaults(assertions=True)

# TODO: Convert to store_true
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to use "store_true" 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.

Because using store_const and then setting the const to True is a bit ridiculous, since that's almost store_true, just without the safety of setting the default to False. It doesn't make sense to store a constant boolean for an option, just use store_true, store_false, toggle_true and toggle_false instead.

builder = parser.to_builder()

# Prepare DSL functions
option = builder.add_option
Copy link
Member

Choose a reason for hiding this comment

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

Why change this to "option" instead of using "add_option"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling it just option is shorter which cuts down on visual noise and it's more declarative inline with the rest of the DSL.

Copy link
Contributor

@zisko zisko 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 4274233 into apple:master Dec 1, 2017
@Rostepher Rostepher deleted the arguments-make-converts branch December 1, 2017 01:47
davidungar pushed a commit to davidungar/swift that referenced this pull request Dec 5, 2017
* Imported the new argparse overlay module and added the setup code for the DSL.

* Converted the CMake generator flags to use the new builder DSL.

* Converted the assertions argument group to use the new builder DSL.

* Converted the LLVM-specific settings argument group to use the new builder DSL.

* Converted the Android build settings argument group to use the new builder DSL.

* Removed unused action aliases from the builder DSL setup section to appease the flake8 gods.

* Fixed small typo in help message for --eclipse option.
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

7 participants