-
-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #5831
- Loading branch information
Showing
37 changed files
with
497 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants.build_graph.build_configuration import BuildConfiguration | ||
from pants.engine.rules import RootRule, rule | ||
from pants.engine.selectors import Select | ||
from pants.init.options_initializer import OptionsInitializer | ||
from pants.option.options_bootstrapper import OptionsBootstrapper | ||
from pants.util.objects import datatype | ||
|
||
|
||
class OptionsParseRequest(datatype(['args', 'env'])): | ||
"""Represents a request for Options computation.""" | ||
|
||
@classmethod | ||
def create(cls, args, env): | ||
assert isinstance(args, (list, tuple)) | ||
return cls( | ||
tuple(args), | ||
tuple(sorted(env.items() if isinstance(env, dict) else env)) | ||
) | ||
|
||
|
||
class Options(datatype(['options', 'build_config'])): | ||
"""Represents the result of an Options computation.""" | ||
|
||
|
||
# TODO: Accommodate file_option, dir_option, etc. | ||
@rule(Options, [Select(OptionsBootstrapper), Select(BuildConfiguration)]) | ||
def parse_options(options_bootstrapper, build_config): | ||
options = OptionsInitializer.create(options_bootstrapper, build_config) | ||
options.freeze() | ||
return Options(options, build_config) | ||
|
||
|
||
def create_options_parsing_rules(): | ||
return [ | ||
parse_options, | ||
RootRule(OptionsBootstrapper), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants.binaries.binary_util import BinaryUtil | ||
from pants.goal.run_tracker import RunTracker | ||
from pants.init.repro import Reproducer | ||
from pants.init.subprocess import Subprocess | ||
from pants.reporting.reporting import Reporting | ||
from pants.scm.subsystems.changed import Changed | ||
from pants.source.source_root import SourceRootConfig | ||
|
||
|
||
class GlobalSubsystems(object): | ||
@classmethod | ||
def get(cls): | ||
"""Subsystems used outside of any task.""" | ||
return { | ||
SourceRootConfig, | ||
Reporting, | ||
Reproducer, | ||
RunTracker, | ||
Changed, | ||
BinaryUtil.Factory, | ||
Subprocess.Factory | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.