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

Add the ability to consume scoped Options from @rules #6872

Merged
merged 6 commits into from
Dec 6, 2018

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Dec 5, 2018

Problem

As described in #5869, we need a way to consume Options in the new engine in order to provide access to Subsystems in @rules.

Solution

Convert OptionsBootstrapper and Config into datatypes in order to give them useful eq/hash implementations.

Then, modify the @rules that were added in #5889 to consume the Params API added in #6871 and expose a ScopedOptions wrapper around the set of options for a Scope.

Result

@rules can consume ScopedOptions, although there should probably be built-in rules that can consume ScopedOptions to create Subsystems. Nonetheless, let's say that this "fixes #5869", and open a followup for actually exposing Subsystems to @rules in a generic way.

@stuhood
Copy link
Member Author

stuhood commented Dec 5, 2018

Commits should be useful to review independently.

Copy link
Contributor

@wisechengyi wisechengyi left a comment

Choose a reason for hiding this comment

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

Scanned through, looks good. Some errors in CI seem legit tho

@stuhood stuhood force-pushed the stuhood/option-input-datatypes branch from 7872458 to 2bd4f6d Compare December 6, 2018 15:40
@stuhood
Copy link
Member Author

stuhood commented Dec 6, 2018

This no longer depends on #6871.

@stuhood stuhood force-pushed the stuhood/option-input-datatypes branch from 2bd4f6d to 5569e33 Compare December 6, 2018 19:27
Copy link
Contributor

@ity ity left a comment

Choose a reason for hiding this comment

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

just finished reading through all the commits - looks great!

)

def register_global(*args, **kwargs):
## Only use of Options.register?
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

Was there before: just moved.

@stuhood
Copy link
Member Author

stuhood commented Dec 6, 2018

Have seen #6879 a few times today, and restarting shards has fixed it. Merging.

@stuhood stuhood merged commit 5bfd6cd into pantsbuild:master Dec 6, 2018
@stuhood stuhood deleted the stuhood/option-input-datatypes branch December 6, 2018 23:31
stuhood pushed a commit that referenced this pull request Jan 4, 2019
### Problem

#6872 laid groundwork for consuming `(Scoped)Options` from `@rules`, but did not actually expose a facility for a `@(console_)rule` to consume a `Subsystem`.

### Solution

Expose `ScopedOptions` parsing to `@console_rules`, and add a helper method that creates an `@rule` to construct a `Subsystem`. Finally, use this facility to have `v2` `list` consume a `Subsystem` that holds options that define (most) of the behaviour that would allow it to replace the `Task`/`v1` implementation of `./pants list`.

### Result

`@rules` and `@console_rules` can consume `Subsystems`. This is a prerequisite for #6880, which will build atop this facility to fully support `v2`-only goals, and replace `v1` `list` with `v2` `list`.
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.

Implement rules that directly produce Subsystems from options
3 participants