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

1.7.0 deprecations #5681

Merged
merged 19 commits into from Apr 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,6 +15,6 @@ python_library(
dependencies = [
'src/python/pants/base:build_environment',
'src/python/pants/base:exceptions',
'src/python/pants/binaries:binary_util'
'src/python/pants/binaries'
]
)
Expand Up @@ -43,10 +43,6 @@ def subsystem_dependencies(cls):

@classmethod
def register_options(cls, register):
register('--version', type=str, advanced=True,
removal_version='1.7.0.dev0',
removal_hint='Use --version in scope buildozer-binary instead.',
help='Version of buildozer.')
register('--add-dependencies', type=str, help='The dependency or dependencies to add')
register('--remove-dependencies', type=str, help='The dependency or dependencies to remove')
register('--command', type=str, help='A custom buildozer command to execute')
Expand Down
2 changes: 1 addition & 1 deletion contrib/go/src/python/pants/contrib/go/subsystems/BUILD
Expand Up @@ -8,7 +8,7 @@ python_library(
'3rdparty/python:six',
'contrib/go/src/python/pants/contrib/go/targets',
'src/python/pants/base:workunit',
'src/python/pants/binaries:binary_util',
'src/python/pants/binaries',
'src/python/pants/fs',
'src/python/pants/option',
'src/python/pants/scm:git',
Expand Down
Expand Up @@ -22,14 +22,6 @@ class GoDistribution(NativeTool):
default_version = '1.8.3'
archive_type = 'tgz'

@classmethod
def register_options(cls, register):
super(GoDistribution, cls).register_options(register)
register('--supportdir', advanced=True, default='bin/go',
removal_version='1.7.0.dev0', removal_hint='No longer supported.',
help='Find the go distributions under this dir. Used as part of the path to lookup '
'the distribution with --binary-util-baseurls and --pants-bootstrapdir')

@memoized_property
def goroot(self):
"""Returns the $GOROOT for this go distribution.
Expand Down
Expand Up @@ -130,7 +130,7 @@ def test_go_thrift_gen_multi(self):
with self._create_thrift_project(thrift_files) as (srcdir, config):
args = [
# Necessary to use a newer thrift version.
'--thrift-binary-version=0.10.0',
'--thrift-version=0.10.0',
'compile',
os.path.join(srcdir, 'src/go/usethrift')
]
Expand Down
Expand Up @@ -4,7 +4,7 @@
python_library(
dependencies=[
'src/python/pants/base:deprecated',
'src/python/pants/binaries:binary_util',
'src/python/pants/binaries',
'src/python/pants/subsystem',
'src/python/pants/util:contextutil',
'src/python/pants/util:memo',
Expand Down
Expand Up @@ -8,7 +8,6 @@
import os

from pants.base.build_environment import get_buildroot
from pants.base.deprecated import deprecated
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.task.fmt_task_mixin import FmtTaskMixin
Expand Down Expand Up @@ -190,10 +189,3 @@ class JavascriptStyleFmt(FmtTaskMixin, JavascriptStyleBase):
:API: public
"""
fix = True


# Deprecated old name for class.
class JavascriptStyle(JavascriptStyleLint):
@deprecated('1.7.0.dev0', 'Replace with JavascriptStyleLint.')
def __init__(self, *args, **kwargs):
super(JavascriptStyle, self).__init__(*args, **kwargs)
Expand Up @@ -6,7 +6,6 @@ contrib_plugin(
dependencies=[
'contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle:all',
'contrib/python/src/python/pants/contrib/python/checks/tasks',
'contrib/python/src/python/pants/contrib/python/checks/tasks2',
'src/python/pants/goal:task_registrar',
],
distribution_name='pantsbuild.pants.contrib.python.checks',
Expand Down
Expand Up @@ -35,8 +35,8 @@ class Error(TaskError):
"""A richer failure exception type useful for tests."""

def __init__(self, *args, **kwargs):
compiled = kwargs.pop('compiled')
failed = kwargs.pop('failed')
compiled = kwargs.pop(b'compiled')
failed = kwargs.pop(b'failed')
super(PythonEval.Error, self).__init__(*args, **kwargs)
self.compiled = compiled
self.failed = failed
Expand All @@ -62,26 +62,9 @@ def register_options(cls, register):
super(PythonEval, cls).register_options(register)
register('--fail-slow', type=bool,
help='Compile all targets and present the full list of errors.')
register('--closure', type=bool,
removal_version='1.7.0.dev0', removal_hint='Use --transitive instead.',
help='Eval all targets in the closure individually instead of just the targets '
'specified on the command line.')

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

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

D'oh, of course.

def execute(self):
# The default for --closure is False, while the default for --transitive is True, so we
# can't just OR the two values, and have to explicitly detect when --transitive is not
# explicitly specified.
if self.get_options().is_default('transitive'):
if self.get_options().skip:
targets = []
else:
targets = (self.context.targets(self._is_evalable) if self.get_options().closure
else filter(self._is_evalable, self.context.target_roots))
else:
# TODO(benjy): After removing --closure, targets should always be set to this, and the
# entire other branch of this if statement (and the if statement itself) should be removed.
targets = self.get_targets(self._is_evalable)
with self.invalidated(targets,
with self.invalidated(self.get_targets(self._is_evalable),
invalidate_dependents=True,
topological_order=True) as invalidation_check:
compiled = self._compile_targets(invalidation_check.invalid_vts)
Expand Down Expand Up @@ -198,9 +181,9 @@ def _get_modules(target):
target.entry_point, target.address.spec))
module = components[0]
if len(components) == 2:
function = components[1]
func = components[1]
data = TemplateData(source=source,
import_statement='from {} import {}'.format(module, function))
import_statement='from {} import {}'.format(module, func))
else:
data = TemplateData(source=source, import_statement='import {}'.format(module))
modules.append(data)
Expand Down

This file was deleted.

Empty file.

This file was deleted.

Expand Up @@ -11,7 +11,7 @@
from pants.python.python_repos import PythonRepos
from pants_test.backend.python.tasks.python_task_test_base import PythonTaskTestBase

from pants.contrib.python.checks.tasks2.python_eval import PythonEval
from pants.contrib.python.checks.tasks.python_eval import PythonEval


class PythonEvalTest(PythonTaskTestBase):
Expand Down
2 changes: 1 addition & 1 deletion contrib/release_packages.sh
Expand Up @@ -31,7 +31,7 @@ function pkg_scrooge_install_test() {
--explain gen | grep "scrooge" &> /dev/null && \
execute_packaged_pants_with_internal_backends \
--plugins="['pantsbuild.pants.contrib.scrooge==${version}']" \
goals | grep "thrift-linter" &> /dev/null
--explain lint | grep "thrift" &> /dev/null
}

PKG_BUILDGEN=(
Expand Down
4 changes: 1 addition & 3 deletions contrib/scrooge/src/python/pants/contrib/scrooge/register.py
Expand Up @@ -8,11 +8,9 @@
from pants.goal.task_registrar import TaskRegistrar as task

from pants.contrib.scrooge.tasks.scrooge_gen import ScroogeGen
from pants.contrib.scrooge.tasks.thrift_linter import DeprecatedThriftLinter, ThriftLinter
from pants.contrib.scrooge.tasks.thrift_linter import ThriftLinter


def register_goals():
# Remove in 1.7.0.dev0.
task(name='thrift-linter', action=DeprecatedThriftLinter).install()
task(name='thrift', action=ThriftLinter).install('lint')
task(name='scrooge', action=ScroogeGen).install('gen')
5 changes: 3 additions & 2 deletions contrib/scrooge/src/python/pants/contrib/scrooge/tasks/BUILD
Expand Up @@ -12,9 +12,9 @@ python_library(
name='scrooge_gen',
sources=['scrooge_gen.py'],
dependencies=[
'3rdparty/python/twitter/commons:twitter.common.collections',
':java_thrift_library_fingerprint_strategy',
':thrift_util',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/backend/codegen/thrift/java',
'src/python/pants/backend/jvm/targets:java',
'src/python/pants/backend/jvm/targets:scala',
Expand All @@ -37,10 +37,11 @@ python_library(
':thrift_util',
'src/python/pants/backend/codegen/thrift/java',
'src/python/pants/backend/jvm/tasks:nailgun_task',
'src/python/pants/base:deprecated',
'src/python/pants/base:exceptions',
'src/python/pants/base:worker_pool',
'src/python/pants/base:workunit',
'src/python/pants/option',
'src/python/pants/task'
],
)

Expand Down
Expand Up @@ -9,7 +9,6 @@

from pants.backend.codegen.thrift.java.java_thrift_library import JavaThriftLibrary
from pants.backend.jvm.tasks.nailgun_task import NailgunTask
from pants.base.deprecated import deprecated_conditional
from pants.base.exceptions import TaskError
from pants.base.worker_pool import Work, WorkerPool
from pants.base.workunit import WorkUnitLabel
Expand All @@ -23,14 +22,16 @@ class ThriftLintError(Exception):
"""Raised on a lint failure."""


class ThriftLinterBase(NailgunTask):
class ThriftLinter(LintTaskMixin, NailgunTask):
"""Print lint warnings for thrift files."""

@staticmethod
def _is_thrift(target):
return isinstance(target, JavaThriftLibrary)

@classmethod
def register_options(cls, register):
super(ThriftLinterBase, cls).register_options(register)
super(ThriftLinter, cls).register_options(register)
register('--strict', type=bool, fingerprint=True,
help='Fail the goal if thrift linter errors are found. Overrides the '
'`strict-default` option.')
Expand Down Expand Up @@ -132,27 +133,3 @@ def execute(self):

if errors:
raise TaskError('\n'.join(errors))


class DeprecatedThriftLinter(ThriftLinterBase):
"""Print lint warnings for thrift files."""

@classmethod
def register_options(cls, register):
super(DeprecatedThriftLinter, cls).register_options(register)
register('--skip', type=bool, fingerprint=True, help='Skip thrift linting.')

def execute(self):
deprecated_conditional(
lambda: True, removal_version='1.7.0.dev0',
entity_description='The thrift-linter goal',
hint_message='Use the lint goal and the lint.thrift options scope instead.')
super(DeprecatedThriftLinter, self).execute()


# TODO: After removing DeprecatedThriftLinter, merge this with ThriftLinterBase
# (i.e., mix LintTaskMixin into ThriftLinterBase, copy the docstring,
# and rename ThriftLinterBase to ThriftLinter).
class ThriftLinter(LintTaskMixin, ThriftLinterBase):
"""Print lint warnings for thrift files."""
pass
15 changes: 0 additions & 15 deletions src/docs/ide_support.md
Expand Up @@ -7,18 +7,3 @@ Pants Plugin for IntelliJ IDEA
The easiest way to use Pants with IntelliJ is to install the Pants plugin.
For details, see the
[IntelliJ-pants-plugin README](https://github.com/pantsbuild/intellij-pants-plugin/blob/master/README.md).


Ensime Project Generator
------------------------

Ensime is the ENhanced Scala Interaction Mode for GNU Emacs, providing code
navigation, type inspection and more. To install ensime follow the instructions at
<https://github.com/ensime/ensime-server>

Pants can generate an ensime project file:

:::bash
$ ./pants ensime src/java/com/archie/path/to:target

This will generate a project for the code in the specified target and all its transitive dependencies.
2 changes: 1 addition & 1 deletion src/python/pants/backend/codegen/protobuf/java/BUILD
Expand Up @@ -13,7 +13,7 @@ python_library(
'src/python/pants/base:payload',
'src/python/pants/base:payload_field',
'src/python/pants/base:workunit',
'src/python/pants/binaries:binary_util',
'src/python/pants/binaries',
'src/python/pants/build_graph',
'src/python/pants/fs',
'src/python/pants/goal:task_registrar',
Expand Down
21 changes: 3 additions & 18 deletions src/python/pants/backend/codegen/protobuf/java/protobuf_gen.py
Expand Up @@ -35,32 +35,17 @@ def subsystem_dependencies(cls):
def register_options(cls, register):
super(ProtobufGen, cls).register_options(register)

# The protoc version and the plugin names are used as proxies for the identity of the protoc
# executable environment here. Although version is an obvious proxy for the protoc binary
# itself, plugin names are less so and plugin authors must include a version in the name for
# The protoc plugin names are used as proxies for the identity of the protoc
# executable environment here. Plugin authors must include a version in the name for
# proper invalidation of protobuf products in the face of plugin modification that affects
# plugin outputs.
register('--version', advanced=True, fingerprint=True,
removal_version='1.7.0.dev0',
removal_hint='Use --version in scope protoc instead.',
help='Version of protoc. Used to create the default --javadeps and as part of '
'the path to lookup the tool with --pants-support-baseurls and '
'--pants-bootstrapdir. When changing this parameter you may also need to '
'update --javadeps.',
default='2.4.1')
register('--protoc-plugins', advanced=True, fingerprint=True, type=list,
help='Names of protobuf plugins to invoke. Protoc will look for an executable '
'named protoc-gen-$NAME on PATH.')

register('--extra_path', advanced=True, type=list,
help='Prepend this path onto PATH in the environment before executing protoc. '
'Intended to help protoc find its plugins.',
default=None)
register('--supportdir', advanced=True,
removal_version='1.7.0.dev0', removal_hint='Will no longer be configurable.',
help='Path to use for the protoc binary. Used as part of the path to lookup the'
'tool under --pants-bootstrapdir.',
default='bin/protobuf')
register('--javadeps', advanced=True, type=list,
help='Dependencies to bootstrap this task for generating java code. When changing '
'this parameter you may also need to update --version.',
Expand Down Expand Up @@ -139,7 +124,7 @@ def execute_codegen(self, target, target_workdir):

args.extend(sources)

# Tack on extra path entries. These can be used to find protoc plugins
# Tack on extra path entries. These can be used to find protoc plugins.
protoc_environ = os.environ.copy()
if self._extra_paths:
protoc_environ['PATH'] = os.pathsep.join(self._extra_paths
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/codegen/protobuf/subsystems/BUILD
Expand Up @@ -3,6 +3,6 @@

python_library(
dependencies = [
'src/python/pants/binaries:binary_util'
'src/python/pants/binaries'
],
)
15 changes: 0 additions & 15 deletions src/python/pants/backend/codegen/ragel/java/ragel_gen.py
Expand Up @@ -24,21 +24,6 @@ class RagelGen(SimpleCodegenTask):
def subsystem_dependencies(cls):
return super(RagelGen, cls).subsystem_dependencies() + (Ragel.scoped(cls),)

@classmethod
def register_options(cls, register):
super(RagelGen, cls).register_options(register)
register('--supportdir', default='bin/ragel', advanced=True,
removal_version='1.7.0.dev0', removal_hint='No longer in use.',
help='The path to find the ragel binary. Used as part of the path to lookup the'
'tool with --pants-support-baseurls and --pants_bootstrapdir.')

# We take the cautious approach here and assume a version bump will always correspond to
# changes in ragel codegen products.
register('--version', default='6.9', advanced=True, fingerprint=True,
removal_version='1.7.0.dev0', removal_hint='Use --version in scope ragel.',
help='The version of ragel to use. Used as part of the path to lookup the'
'tool with --pants-support-baseurls and --pants-bootstrapdir')

def __init__(self, *args, **kwargs):
super(RagelGen, self).__init__(*args, **kwargs)
self._java_out = os.path.join(self.workdir, 'gen-java')
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/codegen/ragel/subsystems/BUILD
Expand Up @@ -3,6 +3,6 @@

python_library(
dependencies = [
'src/python/pants/binaries:binary_util'
'src/python/pants/binaries'
],
)
1 change: 0 additions & 1 deletion src/python/pants/backend/codegen/thrift/lib/BUILD
Expand Up @@ -7,7 +7,6 @@ python_library(
'src/python/pants/base:build_environment',
'src/python/pants/base:exceptions',
'src/python/pants/base:workunit',
'src/python/pants/binaries:thrift_util',
'src/python/pants/option',
'src/python/pants/task',
'src/python/pants/util:memo',
Expand Down