Skip to content

Commit

Permalink
Update code, including tests, to refer to pants.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Feb 10, 2020
1 parent 81994b7 commit d0433e1
Show file tree
Hide file tree
Showing 49 changed files with 103 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ deploy:
skip_cleanup: true
env:
global:
- PANTS_CONFIG_FILES="${TRAVIS_BUILD_DIR}/pants.travis-ci.ini"
- PANTS_CONFIG_FILES="${TRAVIS_BUILD_DIR}/pants.travis-ci.toml"
- LC_ALL="en_US.UTF-8"
- BOOTSTRAPPED_PEX_BUCKET=ci-public.pantsbuild.org
- BOOTSTRAPPED_PEX_KEY_PREFIX=${TRAVIS_BUILD_NUMBER}/${TRAVIS_BUILD_ID}/pants.pex
Expand Down
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ files(
)

files(
name = 'pants_ini',
source = 'pants.ini',
name = 'pants_toml',
source = 'pants.toml',
)

files(
Expand Down
2 changes: 1 addition & 1 deletion build-support/bin/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def pants_command(
"./pants.pex",
"--no-v1",
"--v2",
"--pants-config-files=pants.remote.ini",
"--pants-config-files=pants.remote.toml",
f"--remote-oauth-bearer-token-path={oauth_token_path}",
"test",
*sorted(targets),
Expand Down
2 changes: 1 addition & 1 deletion build-support/bin/generate_travis_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def all_entries(cls) -> List[Dict[str, str]]:
# ----------------------------------------------------------------------

GLOBAL_ENV_VARS = [
'PANTS_CONFIG_FILES="${TRAVIS_BUILD_DIR}/pants.travis-ci.ini"',
'PANTS_CONFIG_FILES="${TRAVIS_BUILD_DIR}/pants.travis-ci.toml"',
'LC_ALL="en_US.UTF-8"',
'BOOTSTRAPPED_PEX_BUCKET=ci-public.pantsbuild.org',
'BOOTSTRAPPED_PEX_KEY_PREFIX=${TRAVIS_BUILD_NUMBER}/${TRAVIS_BUILD_ID}/pants.pex',
Expand Down
2 changes: 1 addition & 1 deletion build-support/docker/remote_execution/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 4. $ docker build --tag rbe-remote-execution build-support/docker/remote_execution
# 5. $ docker tag rbe-remote-execution gcr.io/pants-remoting-beta/rbe-remote-execution
# 6. $ docker push gcr.io/pants-remoting-beta/rbe-remote-execution
# 7. Update `pants.remote.ini` to use the new SHA printed to the console.
# 7. Update `pants.remote.toml` to use the new SHA printed to the console.

FROM gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:da0f21c71abce3bbb92c3a0c44c3737f007a82b60f8bd2930abc55fe64fc2729

Expand Down
2 changes: 1 addition & 1 deletion contrib/go/src/python/pants/contrib/go/tasks/go_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def execute(self):
def _get_build_flags(cls, build_flags_from_option, is_flagged, target):
"""Merge build flags with global < target < command-line order
Build flags can be defined as globals (in `pants.ini`), as arguments to a Target, and
Build flags can be defined as globals (in `pants.toml`), as arguments to a Target, and
via the command-line.
"""
# If self.get_options().build_flags returns a quoted string, remove the outer quotes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def register_options(cls, register):
type=list,
help='A list of interpreter constraints for which matching targets will be linted '
'in addition to targets that match the global interpreter constraints '
'(either from defaults or pants.ini). If the user supplies an empty list, '
'(either from defaults or pants.toml). If the user supplies an empty list, '
'Pants will lint all targets in the target set, irrespective of the working '
'set of compatibility constraints.')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def skip_execution(self):
"Pylint. Pants currently provides a wrapper around MyPy and will soon add "
"Pylint. (To install MyPy, add "
"`pantsbuild.pants.contrib.mypy==%(pants_version)s` to your `plugins` list.)"
"\n\nTo prepare, set `skip: True` in your `pants.ini` under the section "
"`python-eval`. If you still need to use this tool, set `skip: False`. In "
"Pants 1.27.0.dev0, the default will change from `skip: False` to `skip: True`, "
"\n\nTo prepare, set `skip = true` in your `pants.toml` under the section "
"`python-eval`. If you still need to use this tool, set `skip = false`. In "
"Pants 1.27.0.dev0, the default will change from `skip = false` to `skip = true`, "
"and in Pants 1.29.0.dev0, the module will be removed."
)
return self.resolve_conflicting_skip_options(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_bad_non_strict_override(self):

@rename_build_file
def test_bad_pants_ini_strict(self):
# thrift-linter fails if pants.ini has a thrift-linter:strict=True setting.
# thrift-linter fails if pants.toml has a thrift-linter:strict=True setting.
cmd = ['lint.thrift', self.thrift_test_target('bad-thrift-default')]
pants_ini_config = {'scrooge-linter': {'strict': True}}
pants_run = self.run_pants(cmd, config=pants_ini_config)
Expand All @@ -138,7 +138,7 @@ def test_bad_pants_ini_strict(self):

@rename_build_file
def test_bad_pants_ini_strict_overridden(self):
# thrift-linter passes if pants.ini has a thrift-linter:strict=True setting and
# thrift-linter passes if pants.toml has a thrift-linter:strict=True setting and
# a command line non-strict flag is passed.
cmd = ['--no-scrooge-linter-strict', 'lint.thrift', self.thrift_test_target('bad-thrift-default')]
pants_ini_config = {'scrooge-linter': {'strict': True}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def process(target):

# Create a jar file to be published along with other artifacts for this target.
# In principle, any extra file type could be created here, and published.
# Options in pants.ini allow specifying the file extension.
# Options in pants.toml allow specifying the file extension.
with self.open_jar(jar_path, overwrite=True, compressed=True) as open_jar:
# Write the sample file to the jar.
open_jar.write(os.path.join(self.workdir, example_file_name), "example.txt")

# For this target, add the path to the newly created jar to the product map, under the
# 'extra_test_jar_example key.
#
# IMPORTANT: this string *must* match the string that you have set in pants.ini. Otherwise,
# IMPORTANT: this string *must* match the string that you have set in pants.toml. Otherwise,
# the code in 'jar_publish.py' won't be able to find this addition to the product map.
self.context.products.get('extra_test_jar_example').add(target, self.workdir).append(jar_name)
self.context.log.info("Made a jar: %s" % jar_path)
Expand Down
2 changes: 1 addition & 1 deletion pants.remote.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# an account authorized to run the Pants project (you may need to ask a Pants committer for
# to authorize your account). Then, point to this config file and provide the oauth token like this:
#
# $ ./pants --pants-config-files=pants.remote.ini
# $ ./pants --pants-config-files=pants.remote.toml
# --remote-oauth-bearer-token-path=<(gcloud auth application-default print-access-token | perl -p -e 'chomp if eof')
# --no-v1 --v2 test tests/python/pants_test/util:strutil
#
Expand Down
2 changes: 1 addition & 1 deletion src/docs/howto_develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ passing the `--remote-execution-enabled` flag to `ci.py`, such as:
To use remote execution for a specific test(s), run this:

:::bash
$ ./pants --pants-config-files=pants.remote.ini \
$ ./pants --pants-config-files=pants.remote.toml \
--remote-oauth-bearer-token-path=<(gcloud auth application-default print-access-token | perl -p -e 'chomp if eof') \
--no-v1 --v2 test tests/python/pants_test/util:strutil

Expand Down
6 changes: 3 additions & 3 deletions src/python/pants/backend/jvm/subsystems/jvm_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def __init__(self, target, platform_name, platforms_by_name):
.format(platform_name, target.address.spec if target else 'unknown target')]
if not platforms_by_name:
messages.append('In fact, no platforms are defined under {0}. These should typically be'
' specified in [{0}] in pants.ini.'.format(scope_name))
' specified in [{0}] in pants.toml.'.format(scope_name))
else:
messages.append('Perhaps you meant one of:{}'.format(
''.join('\n {}'.format(name) for name in sorted(platforms_by_name.keys()))
))
messages.append('\nThese are typically defined under [{}] in pants.ini.'
messages.append('\nThese are typically defined under [{}] in pants.toml.'
.format(scope_name))
super(JvmPlatform.UndefinedJvmPlatform, self).__init__(' '.join(messages))

Expand Down Expand Up @@ -112,7 +112,7 @@ def default_platform(self):
if name not in platforms_by_name:
raise self.IllegalDefaultPlatform(
"The default platform was set to '{0}', but no platform by that name has been "
"defined. Typically, this should be defined under [{1}] in pants.ini."
"defined. Typically, this should be defined under [{1}] in pants.toml."
.format(name, self.options_scope)
)
return JvmPlatformSettings(*platforms_by_name[name], name=name, by_default=True)
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/jvm/subsystems/jvm_tool_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def dep_spec(self, options):
if dep_spec.startswith('['):
raise ValueError(dedent("""\
JVM tool configuration now expects a single target address, use the
following in pants.ini:
following in pants.toml:
[{scope}]
{key}: //tool/classpath:address
{key} = "//tool/classpath:address"
""".format(scope=self.scope, key=self.key)))
return dep_spec

Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/jvm/targets/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Credentials(Target, metaclass=ABCMeta):
"""Credentials for a maven repository.
The ``publish.jar`` section of your ``pants.ini`` file can refer to one
The `publish.jar` section of your `pants.toml` file can refer to one
or more of these.
"""

Expand Down
6 changes: 2 additions & 4 deletions src/python/pants/backend/jvm/tasks/bootstrap_jvm_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ def get_alternate_target_roots(cls, options, address_mapper, build_graph):
This target has a default classpath configured, so you can simply remove:
[{scope}]
{option}: {tool}
from pants.ini (or any other config file) to use the default tool.
{option} = "{tool}"
from pants.toml (or any other config file) to use the default tool.
The default classpath is: {default_classpath}
Note that tool target addresses in pants.ini should be specified *without* quotes.
""").strip().format(tool=dep_spec,
option=jvm_tool.key,
scope=jvm_tool.scope,
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/jvm/tasks/bundle_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def register_options(cls, register):
"the bundle's root dir. If unset, all jars will go into the bundle's libs "
"directory, the root will only contain a synthetic jar with its manifest's "
"Class-Path set to those jars. This option is also defined in jvm_app target. "
"Precedence is CLI option > target option > pants.ini option.")
"Precedence is CLI option > target option > pants.toml option.")

@classmethod
def implementation_version(cls):
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/jvm/tasks/jar_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class JarPublish(HasTransitiveOptionMixin, ScmPublishMixin, JarTask):
publish artifacts to Maven-style repositories. Pants performs prerequisite
tasks like compiling, creating jars, and generating ``pom.xml`` files then
invokes Ivy to actually publish the artifacts, so publishing is largely
configured in ``ivysettings.xml``. ``BUILD`` and ``pants.ini`` files
configured in ``ivysettings.xml``. ``BUILD`` and ``pants.toml`` files
primarily provide linkage between publishable targets and the
Ivy ``resolvers`` used to publish them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def __init__(self, *args, **kwargs):
self._targets_to_compile_settings = None

# TODO: self._jvm_options doesn't seem to record changes from `--<scope>-jvm-options` on the
# command line (but this might work in pants.ini?)!
# command line (but this might work in pants.toml?)!
# JVM options for running the compiler.
self._jvm_options = self.get_options().jvm_options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def act_transitively(self):
hint_message="Currently, Pants defaults to `--dependencies-transitive`, which means that it "
"will find all transitive dependencies for the target, rather than only direct "
"dependencies. This is a useful feature, but surprising to be the default."
"\n\nTo prepare for this change to the default value, set in `pants.ini` under "
"\n\nTo prepare for this change to the default value, set in `pants.toml` under "
"the section `dependencies` the value `transitive: False`. In Pants 1.28.0, "
"you can safely remove the setting."
)
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/project_info/tasks/filedeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def act_transitively(self):
hint_message="Currently, Pants defaults to `--filedeps-transitive`, which means that it "
"will find all transitive files used by the target, rather than only direct "
"file dependencies. This is a useful feature, but surprising to be the default."
"\n\nTo prepare for this change to the default value, set in `pants.ini` under "
"\n\nTo prepare for this change to the default value, set in `pants.toml` under "
"the section `filedeps` the value `transitive: False`. In Pants 1.28.0, "
"you can safely remove the setting."
)
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ python_binary(
':bin',
'//:build_root',
'//:build_tools',
'//:pants_ini',
'//:pants_toml',
'//:3rdparty_directory',
'//:isort_cfg',
'//:pyproject',
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/binaries/binary_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class MissingMachineInfo(TaskError):
pass

class NoBaseUrlsError(TaskError):
"""Indicates that no urls were specified in pants.ini."""
"""Indicates that no urls were specified in pants.toml."""
pass

class BinaryResolutionError(TaskError):
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/build_graph/bundle_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def register_options(cls, register):
fingerprint=True,
help='Create an archive of this type from the bundle. '
'This option is also defined in app target. '
'Precedence is CLI option > target option > pants.ini option.')
'Precedence is CLI option > target option > pants.toml option.')
# `target.id` ensures global uniqueness, this flag is provided primarily for
# backward compatibility.
register('--use-basename-prefix', advanced=True, type=bool,
Expand All @@ -40,7 +40,7 @@ def get_bundle_dir(name, results_dir):
def resolved_option(options, target, key):
"""Get value for option "key".
Resolution precedence is CLI option > target option > pants.ini option.
Resolution precedence is CLI option > target option > pants.toml option.
:param options: Options returned by `task.get_option()`
:param target: Target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_mirrored_scalar_option_value(self, target):
if target_setting is not None:
return target_setting

# Otherwise, retrieve the value from the environment/pants.ini/hardcoded default.
# Otherwise, retrieve the value from the environment/pants.toml/hardcoded default.
return self.option_value


Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/goal/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Context:
"""Contains the context for a single run of pants.
Task implementations can access configuration data from pants.ini and any flags they have exposed
Task implementations can access configuration data from pants.toml and any flags they have exposed
here as well as information about the targets involved in the run.
Advanced uses of the context include adding new targets to it for upstream or downstream goals to
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/init/plugin_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _create_global_subsystem(self, subsystem_type):

# Ignore command line flags since we'd blow up on any we don't understand (most of them).
# If someone wants to bootstrap plugins in a one-off custom way they'll need to use env vars
# or a --pants-config-files pointing to a custom pants.ini snippet.
# or a --pants-config-files pointing to a custom pants.toml snippet.
defaulted_only_options = options.drop_flag_values()

# Finally, construct the Subsystem.
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/option/global_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def register_bootstrap_options(cls, register):
help='Use this pants version. Note Pants code only uses this to verify that you are '
'using the requested version, as Pants cannot dynamically change the version it '
'is using once the program is already running. This option is useful to set in '
'your pants.ini, however, and then you can grep the value to select which '
'your pants.toml, however, and then you can grep the value to select which '
'version to use for setup scripts (e.g. `./pants`), runner scripts, IDE plugins, '
'etc. For example, the setup script we distribute at https://www.pantsbuild.org/install.html#recommended-installation '
'uses this value to determine which Python version to run with. You may find the '
Expand Down
14 changes: 7 additions & 7 deletions src/python/pants/option/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Options:
- The value of the --foo-bar flag in global scope.
- The value of the PANTS_GLOBAL_FOO_BAR environment variable.
- The value of the PANTS_FOO_BAR environment variable.
- The value of the foo_bar key in the [GLOBAL] section of pants.ini.
- The value of the foo_bar key in the [GLOBAL] section of pants.toml.
- The hard-coded value provided at registration time.
- None.
Expand All @@ -46,9 +46,9 @@ class Options:
- The value of the PANTS_COMPILE_FOO_BAR environment variable.
- The value of the PANTS_GLOBAL_FOO_BAR environment variable.
- The value of the PANTS_FOO_BAR environment variable.
- The value of the foo_bar key in the [compile.java] section of pants.ini.
- The value of the foo_bar key in the [compile] section of pants.ini.
- The value of the foo_bar key in the [GLOBAL] section of pants.ini.
- The value of the foo_bar key in the [compile.java] section of pants.toml.
- The value of the foo_bar key in the [compile] section of pants.toml.
- The value of the foo_bar key in the [GLOBAL] section of pants.toml.
- The hard-coded value provided at registration time.
- None.
Expand All @@ -58,9 +58,9 @@ class Options:
- The value of the --foo-bar flag in scope 'compile'.
- The value of the PANTS_COMPILE_JAVA_FOO_BAR environment variable.
- The value of the PANTS_COMPILE_FOO_BAR environment variable.
- The value of the foo_bar key in the [compile.java] section of pants.ini.
- The value of the foo_bar key in the [compile] section of pants.ini.
- The value of the foo_bar key in the [GLOBAL] section of pants.ini
- The value of the foo_bar key in the [compile.java] section of pants.toml.
- The value of the foo_bar key in the [compile] section of pants.toml.
- The value of the foo_bar key in the [GLOBAL] section of pants.toml
(because of automatic config file fallback to that section).
- The hard-coded value provided at registration time.
- None.
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/option/options_bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def is_bootstrap_option(arg: str) -> bool:
bootstrap_option_values = initial_bootstrap_options.for_global_scope()

# Now re-read the config, post-bootstrapping. Note the order: First whatever we bootstrapped
# from (typically pants.ini), then config override, then rcfiles.
# from (typically pants.toml), then config override, then rcfiles.
full_config_paths = pre_bootstrap_config.sources()
if bootstrap_option_values.pantsrc:
rcfiles = [os.path.expanduser(str(rcfile)) for rcfile in bootstrap_option_values.pantsrc_files]
Expand Down
Loading

0 comments on commit d0433e1

Please sign in to comment.