From aad4b7be46109302090d8966748ef2807cba1a6b Mon Sep 17 00:00:00 2001 From: John Sirois Date: Mon, 25 Jun 2018 17:51:58 -0600 Subject: [PATCH] Prepare the 1.9.0.dev0 release. (#6018) --- src/python/pants/VERSION | 2 +- .../backend/jvm/subsystems/scala_platform.py | 3 - .../pants/backend/jvm/subsystems/zinc.py | 65 +++++-------------- .../jvm/tasks/jvm_compile/jvm_compile.py | 32 ++------- .../tasks/jvm_compile/zinc/zinc_compile.py | 31 --------- .../backend/jvm/tasks/jvm_dependency_check.py | 51 ++------------- src/python/pants/notes/master.rst | 63 ++++++++++++++++++ .../java/test_javac_plugin_integration.py | 6 +- .../scala/test_scalac_plugin_integration.py | 8 +-- 9 files changed, 99 insertions(+), 162 deletions(-) diff --git a/src/python/pants/VERSION b/src/python/pants/VERSION index 9e1d210f991..eb595b2a77f 100644 --- a/src/python/pants/VERSION +++ b/src/python/pants/VERSION @@ -1 +1 @@ -1.8.0rc0 +1.9.0.dev0 diff --git a/src/python/pants/backend/jvm/subsystems/scala_platform.py b/src/python/pants/backend/jvm/subsystems/scala_platform.py index 76180e73df7..3d816a85aa2 100644 --- a/src/python/pants/backend/jvm/subsystems/scala_platform.py +++ b/src/python/pants/backend/jvm/subsystems/scala_platform.py @@ -41,9 +41,6 @@ class ScalaPlatform(JvmToolMixin, ZincLanguageMixin, InjectablesMixin, Subsystem """ options_scope = 'scala' - deprecated_options_scope = 'scala-platform' - deprecated_options_scope_removal_version = '1.9.0.dev0' - @classmethod def _create_jardep(cls, name, version): return JarDependency(org='org.scala-lang', diff --git a/src/python/pants/backend/jvm/subsystems/zinc.py b/src/python/pants/backend/jvm/subsystems/zinc.py index b12cde60cca..6ffb6af7976 100644 --- a/src/python/pants/backend/jvm/subsystems/zinc.py +++ b/src/python/pants/backend/jvm/subsystems/zinc.py @@ -33,7 +33,9 @@ class Factory(Subsystem, JvmToolMixin): @classmethod def subsystem_dependencies(cls): - return super(Zinc.Factory, cls).subsystem_dependencies() + (DependencyContext, Java, ScalaPlatform) + return super(Zinc.Factory, cls).subsystem_dependencies() + (DependencyContext, + Java, + ScalaPlatform) @classmethod def register_options(cls, register): @@ -73,11 +75,13 @@ def register_options(cls, register): cls.register_jvm_tool(register, 'compiler-interface', classpath=[ - JarDependency(org='org.scala-sbt', name='compiler-interface', rev=zinc_rev), + JarDependency(org='org.scala-sbt', + name='compiler-interface', + rev=zinc_rev), ], - # NB: We force a noop-jarjar'ing of the interface, since it is now broken - # up into multiple jars, but zinc does not yet support a sequence of jars - # for the interface. + # NB: We force a noop-jarjar'ing of the interface, since it is now + # broken up into multiple jars, but zinc does not yet support a sequence + # of jars for the interface. main='no.such.main.Main', custom_rules=shader_rules) @@ -158,52 +162,17 @@ def rebase_map_args(self): ','.join('{}:{}'.format(src, dst) for src, dst in rebases.items()) ) - @staticmethod - def _select_jvm_tool_mixin(left, right, options): - if left is None: - return right - if any(not left.get_options().is_default(opt) - for opt in options - if getattr(left.get_options(), opt, None) is not None): - return left - return right - - @memoized_method - def javac_compiler_plugins_src(self, zinc_compile_instance=None): - """Returns an instance of JvmToolMixin that should provide javac compiler plugins. - - TODO: Remove this method once the deprecation of `(scalac|javac)_plugins` on Zinc has - completed in `1.9.0.dev0`. - """ - return Zinc._select_jvm_tool_mixin(zinc_compile_instance, - Java.global_instance(), - ['javac_plugins', 'javac_plugin_args', 'javac_plugin_dep']) - @memoized_method - def scalac_compiler_plugins_src(self, zinc_compile_instance=None): - """Returns an instance of JvmToolMixin that should provide scalac compiler plugins. - - TODO: Remove this method once the deprecation of `(scalac|javac)_plugins` on Zinc has - completed in `1.9.0.dev0`. - """ - return Zinc._select_jvm_tool_mixin(zinc_compile_instance, - ScalaPlatform.global_instance(), - ['scalac_plugins', 'scalac_plugin_args', 'scalac_plugin_dep']) - - @memoized_method - def _compiler_plugins_cp_entries(self, zinc_compile_instance=None): - """Any additional global compiletime classpath entries for compiler plugins. - - TODO: Remove parameter once the deprecation of `(scalac|javac)_plugins` on Zinc has - completed in `1.9.0.dev0`. - """ - java_options_src = self.javac_compiler_plugins_src(zinc_compile_instance) - scala_options_src = self.scalac_compiler_plugins_src(zinc_compile_instance) + def _compiler_plugins_cp_entries(self): + """Any additional global compiletime classpath entries for compiler plugins.""" + java_options_src = Java.global_instance() + scala_options_src = ScalaPlatform.global_instance() def cp(instance, toolname): scope = instance.options_scope return instance.tool_classpath_from_products(self._products, toolname, scope=scope) - classpaths = cp(java_options_src, 'javac-plugin-dep') + cp(scala_options_src, 'scalac-plugin-dep') + classpaths = (cp(java_options_src, 'javac-plugin-dep') + + cp(scala_options_src, 'scalac-plugin-dep')) return [(conf, jar) for conf in self.DEFAULT_CONFS for jar in classpaths] @memoized_property @@ -212,7 +181,7 @@ def extractor(self): self.ZINC_EXTRACTOR_TOOL_NAME, scope=self._zinc_factory.options_scope) - def compile_classpath(self, classpath_product_key, target, extra_cp_entries=None, zinc_compile_instance=None): + def compile_classpath(self, classpath_product_key, target, extra_cp_entries=None): """Compute the compile classpath for the given target.""" classpath_product = self._products.get_data(classpath_product_key) @@ -221,7 +190,7 @@ def compile_classpath(self, classpath_product_key, target, extra_cp_entries=None else: dependencies = DependencyContext.global_instance().all_dependencies(target) - all_extra_cp_entries = list(self._compiler_plugins_cp_entries(zinc_compile_instance)) + all_extra_cp_entries = list(self._compiler_plugins_cp_entries()) if extra_cp_entries: all_extra_cp_entries.extend(extra_cp_entries) diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py index b3299f4d58d..fd3bd2681d3 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py @@ -60,11 +60,6 @@ def register_options(cls, register): default=list(cls.get_args_default(register.bootstrap)), fingerprint=True, help='Pass these extra args to the compiler.') - register('--confs', advanced=True, type=list, default=Zinc.DEFAULT_CONFS, - removal_version='1.9.0.dev0', - removal_hint='Compiling for confs other than `default` is no longer supported.', - help='Compile for these Ivy confs.') - register('--clear-invalid-analysis', advanced=True, type=bool, help='When set, any invalid/incompatible analysis files will be deleted ' 'automatically. When unset, an error is raised instead.') @@ -110,29 +105,15 @@ def register_options(cls, register): 'constraints). Choose \'random\' to choose random sizes for each target, which ' 'may be useful for distributed builds.') - register('--capture-log', advanced=True, type=bool, - removal_version='1.9.0.dev0', - removal_hint='Now enabled by default: this option has no effect.', - help='Capture compilation output to per-target logs.') - register('--capture-classpath', advanced=True, type=bool, default=True, fingerprint=True, help='Capture classpath to per-target newline-delimited text files. These files will ' 'be packaged into any jar artifacts that are created from the jvm targets.') - register('--unused-deps', choices=['ignore', 'warn', 'fatal'], default='ignore', - fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Option has moved to `--lint-jvm-dep-check-unnecessary-deps` and is ' - 'ignored in this location.', - help='Controls whether unused deps are checked, and whether they cause warnings or ' - 'errors. This option uses zinc\'s analysis to determine which deps are unused, ' - 'and can thus result in false negatives: thus it is disabled by default.') - register('--suggest-missing-deps', type=bool, help='Suggest missing dependencies on a best-effort basis from target\'s transitive' 'deps for compilation failures that are due to class not found.') - + register('--buildozer', help='Path to buildozer for suggest-missing-deps command lines. ' 'If absent, no command line will be suggested to fix missing deps.') @@ -327,7 +308,7 @@ def __init__(self, *args, **kwargs): self._args.extend(self.get_options().debug_symbol_args) # The ivy confs for which we're building. - self._confs = self.get_options().confs + self._confs = Zinc.DEFAULT_CONFS # Determines which sources are relevant to this target. self._sources_predicate = self.select_source @@ -510,8 +491,8 @@ def _compile_vts(self, vts, ctx, upstream_analysis, classpath, progress_message, settings, fatal_warnings, zinc_file_manager, - self._get_plugin_map('javac', self._zinc.javac_compiler_plugins_src(self), ctx.target), - self._get_plugin_map('scalac', self._zinc.scalac_compiler_plugins_src(self), ctx.target), + self._get_plugin_map('javac', Java.global_instance(), ctx.target), + self._get_plugin_map('scalac', ScalaPlatform.global_instance(), ctx.target), ) self._capture_logs(compile_workunit, ctx.log_dir) except TaskError: @@ -587,7 +568,7 @@ def _find_logs(self, compile_workunit): def _find_missing_deps(self, compile_logs, target): with self.context.new_workunit('missing-deps-suggest', labels=[WorkUnitLabel.COMPILER]): compile_failure_log = '\n'.join(read_file(log).decode('utf-8') for log in compile_logs) - + missing_dep_suggestions, no_suggestions = self._missing_deps_finder.find( compile_failure_log, target) @@ -772,8 +753,7 @@ def _cp_entries_for_ctx(self, ctx, classpath_product_key): cp_entries = [ctx.classes_dir] cp_entries.extend(self._zinc.compile_classpath(classpath_product_key, ctx.target, - extra_cp_entries=self._extra_compile_time_classpath, - zinc_compile_instance=self)) + extra_cp_entries=self._extra_compile_time_classpath)) return cp_entries def _record_target_stats(self, target, classpath_len, sources_len, compiletime, is_incremental, diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/zinc/zinc_compile.py b/src/python/pants/backend/jvm/tasks/jvm_compile/zinc/zinc_compile.py index b8ba7ab69c4..abde94af700 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/zinc/zinc_compile.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/zinc/zinc_compile.py @@ -499,37 +499,6 @@ def process_info_file(cp_elem, info_file): class ZincCompile(BaseZincCompile): """Compile Scala and Java code to classfiles using Zinc.""" - @classmethod - def register_options(cls, register): - super(ZincCompile, cls).register_options(register) - register('--javac-plugins', advanced=True, type=list, fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Use `--java-javac-plugins` instead.', - help='Use these javac plugins.') - register('--javac-plugin-args', advanced=True, type=dict, default={}, fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Use `--java-javac-plugin-args` instead.', - help='Map from javac plugin name to list of arguments for that plugin.') - cls.register_jvm_tool(register, 'javac-plugin-dep', classpath=[], - removal_version='1.9.0.dev0', - removal_hint='Use `--java-javac-plugin-dep` instead.', - help='Search for javac plugins here, as well as in any ' - 'explicit dependencies.') - - register('--scalac-plugins', advanced=True, type=list, fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Use `--scala-scalac-plugins` instead.', - help='Use these scalac plugins.') - register('--scalac-plugin-args', advanced=True, type=dict, default={}, fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Use `--scala-scalac-plugin-args` instead.', - help='Map from scalac plugin name to list of arguments for that plugin.') - cls.register_jvm_tool(register, 'scalac-plugin-dep', classpath=[], - removal_version='1.9.0.dev0', - removal_hint='Use `--scala-scalac-plugin-dep` instead.', - help='Search for scalac plugins here, as well as in any ' - 'explicit dependencies.') - @classmethod def product_types(cls): return ['runtime_classpath', 'zinc_analysis', 'zinc_args'] diff --git a/src/python/pants/backend/jvm/tasks/jvm_dependency_check.py b/src/python/pants/backend/jvm/tasks/jvm_dependency_check.py index fc77fc81f49..8322d554d1a 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_dependency_check.py +++ b/src/python/pants/backend/jvm/tasks/jvm_dependency_check.py @@ -27,20 +27,9 @@ class JvmDependencyCheck(Task): """Checks true dependencies of a JVM target and ensures that they are consistent with BUILD files.""" - deprecated_scope = 'compile.jvm-dep-check' - deprecated_scope_removal_version = '1.9.0.dev0' - @classmethod def register_options(cls, register): super(JvmDependencyCheck, cls).register_options(register) - register('--missing-deps', choices=['off', 'warn', 'fatal'], default='off', - fingerprint=True, - removal_version='1.9.0.dev0', - removal_hint='Undeclared transitive dependencies are no longer possible.', - help='Check for missing dependencies in compiled code. Reports actual ' - 'dependencies A -> B where there is no transitive BUILD file dependency path ' - 'from A to B. If fatal, missing deps are treated as a build error.') - register('--missing-direct-deps', choices=['off', 'warn', 'fatal'], default='off', fingerprint=True, @@ -69,7 +58,7 @@ def subsystem_dependencies(cls): @staticmethod def _skip(options): """Return true if the task should be entirely skipped, and thus have no product requirements.""" - values = [options.missing_deps, options.missing_direct_deps, options.unnecessary_deps] + values = [options.missing_direct_deps, options.unnecessary_deps] return all(v == 'off' for v in values) @classmethod @@ -88,7 +77,6 @@ def munge_flag(flag): flag_value = self.get_options().get(flag, None) return None if flag_value == 'off' else flag_value - self._check_missing_deps = munge_flag('missing_deps') self._check_missing_direct_deps = munge_flag('missing_direct_deps') self._check_unnecessary_deps = munge_flag('unnecessary_deps') self._target_whitelist = [Address.parse(s) for s in self.get_options().missing_deps_whitelist] @@ -125,8 +113,8 @@ def check(self, src_tgt, actual_deps): See docstring for _compute_missing_deps for details. """ - if self._check_missing_deps or self._check_missing_direct_deps or self._check_unnecessary_deps: - missing_file_deps, missing_tgt_deps, missing_direct_tgt_deps = \ + if self._check_missing_direct_deps or self._check_unnecessary_deps: + missing_file_deps, missing_direct_tgt_deps = \ self._compute_missing_deps(src_tgt, actual_deps) buildroot = get_buildroot() @@ -141,23 +129,6 @@ def filter_whitelisted(missing_deps): return [(tgt_pair, evidence) for (tgt_pair, evidence) in missing_deps if tgt_pair[0].address not in self._target_whitelist] - missing_tgt_deps = filter_whitelisted(missing_tgt_deps) - - if self._check_missing_deps and (missing_file_deps or missing_tgt_deps): - log_fn = (self.context.log.error if self._check_missing_deps == 'fatal' - else self.context.log.warn) - for (tgt_pair, evidence) in missing_tgt_deps: - evidence_str = '\n'.join([' {} uses {}'.format(shorten(e[0]), shorten(e[1])) - for e in evidence]) - log_fn('Missing BUILD dependency {} -> {} because:\n{}' - .format(tgt_pair[0].address.spec, tgt_pair[1].address.spec, - evidence_str)) - for (src_tgt, dep) in missing_file_deps: - log_fn('Missing BUILD dependency {} -> {}' - .format(src_tgt.address.spec, shorten(dep))) - if self._check_missing_deps == 'fatal': - raise TaskError('Missing deps.') - missing_direct_tgt_deps = filter_whitelisted(missing_direct_tgt_deps) if self._check_missing_direct_deps and missing_direct_tgt_deps: @@ -193,15 +164,12 @@ def _compute_missing_deps(self, src_tgt, actual_deps): - actual_deps: a map src -> list of actual deps (source, class or jar file) as noted by the compiler. - Returns a triple (missing_file_deps, missing_tgt_deps, missing_direct_tgt_deps) where: + Returns a tuple (missing_file_deps, missing_direct_tgt_deps) where: - missing_file_deps: a list of dep_files where src_tgt requires dep_file, and we're unable to map to a target (because its target isn't in the total set of targets in play, and we don't want to parse every BUILD file in the workspace just to find it). - - missing_tgt_deps: a list of dep_tgt where src_tgt is missing a necessary transitive - dependency on dep_tgt. - - missing_direct_tgt_deps: a list of dep_tgts where src_tgt is missing a direct dependency on dep_tgt but has a transitive dep on it. @@ -227,14 +195,8 @@ def target_or_java_dep_in_targets(target, targets): else: return False - # TODO: If recomputing these every time becomes a performance issue, memoize for - # already-seen targets and incrementally compute for new targets not seen in a previous - # partition, in this or a previous chunk. - transitive_deps_by_target = analyzer.compute_transitive_deps_by_target(self.context.targets()) - # Find deps that are actual but not specified. missing_file_deps = OrderedSet() # (src, src). - missing_tgt_deps_map = defaultdict(list) # (tgt, tgt) -> a list of (src, src) as evidence. missing_direct_tgt_deps_map = defaultdict(list) # The same, but for direct deps. targets_by_file = analyzer.targets_by_file(self.context.targets()) @@ -250,15 +212,12 @@ def target_or_java_dep_in_targets(target, targets): elif not target_or_java_dep_in_targets(src_tgt, actual_dep_tgts): # Obviously intra-target deps are fine. canonical_actual_dep_tgt = next(iter(actual_dep_tgts)) - if actual_dep_tgts.isdisjoint(transitive_deps_by_target.get(src_tgt, [])): - missing_tgt_deps_map[(src_tgt, canonical_actual_dep_tgt)].append((src, actual_dep)) - elif canonical_actual_dep_tgt not in src_tgt.dependencies: + if canonical_actual_dep_tgt not in src_tgt.dependencies: # The canonical dep is the only one a direct dependency makes sense on. missing_direct_tgt_deps_map[(src_tgt, canonical_actual_dep_tgt)].append( (src, actual_dep)) return (list(missing_file_deps), - missing_tgt_deps_map.items(), missing_direct_tgt_deps_map.items()) def _do_check_unnecessary_deps(self, target, actual_deps, log_fn): diff --git a/src/python/pants/notes/master.rst b/src/python/pants/notes/master.rst index ffc7c07029f..61761c777f8 100644 --- a/src/python/pants/notes/master.rst +++ b/src/python/pants/notes/master.rst @@ -4,6 +4,69 @@ Master Pre-Releases This document describes ``dev`` releases which occur weekly from master, and which do not undergo the vetting associated with ``stable`` releases. +1.9.0.dev0 (06/25/2018) +----------------------- + +New features +~~~~~~~~~~~~ + +* Release Pants as a pex. (#6014) + `PR #6014 `_ + +* C/C++ targets which can be compiled/linked and used in python_dist() with ctypes (#5815) + `PR #5815 `_ + +API Changes +~~~~~~~~~~~ + +* Deprecate sources except EagerFilesetWithSpec (#5993) + `PR #5993 `_ + +* source attribute is automatically promoted to sources (#5908) + `PR #5908 `_ + +Bugfixes +~~~~~~~~ + +* Run scalafix before scalafmt (#6011) + `PR #6011 `_ + +Refactoring, Improvements, and Tooling +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Add .vscode/ folder to .gitignore (#6020) + `PR #6020 `_ + +* [engine] Selecting for ExecuteProcessResult will Throw on non-zero exit (#6000) + `PR #6000 `_ + +* Context always has a scheduler in tests (#5997) + `PR #5997 `_ + +* Engine looks up default sources when parsing (#5989) + `PR #5989 `_ + +* Fix TestSetupPyInterpreter.test_setuptools_version (#5988) + `PR #5988 `_ + +* Caching tests are parsed through the engine (#5985) + `PR #5985 `_ + +* Override get_sources for pants plugins (#5984) + `PR #5984 `_ + +* make_target upgrades sources to EagerFilesetWithSpec (#5974) + `PR #5974 `_ + +* Robustify test_namespace_effective PYTHONPATH. (#5976) + `PR #5976 `_ + +Documentation Updates +~~~~~~~~~~~~~~~~~~~~~ + +* 1.7.0 release notes (#5983) + `PR #5983 `_ + 1.8.0rc0 (06/18/2018) --------------------- diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_javac_plugin_integration.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_javac_plugin_integration.py index ed54f0b1d2e..a6c0f8274d5 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_javac_plugin_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_javac_plugin_integration.py @@ -27,7 +27,7 @@ def _do_test(self, expected_args, config, target): # all targets, and "local" means specified on an individual target. def _do_test_global(self, args): config = { - 'compile.zinc': { + 'java': { 'javac_plugins': ['simple_javac_plugin'], 'javac_plugin_args': { 'simple_javac_plugin': args @@ -39,7 +39,7 @@ def _do_test_global(self, args): def _do_test_local_with_global_args(self, args): config = { - 'compile.zinc': { + 'java': { 'javac_plugin_args': { 'simple_javac_plugin': args } @@ -55,7 +55,7 @@ def test_global(self): def test_global_with_local_args(self): self._do_test(['args', 'from', 'target', 'global_with_local_args'], { - 'compile.zinc': { + 'java': { 'javac_plugins': ['simple_javac_plugin'], }, }, diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scalac_plugin_integration.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scalac_plugin_integration.py index f2dd56a78d4..0833c92b1ec 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scalac_plugin_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scalac_plugin_integration.py @@ -23,7 +23,7 @@ def _do_test(self, expected_args, config, target): # all targets, and "local" means specified on an individual target. def _do_test_global(self, args): config = { - 'compile.zinc': { + 'scala': { 'scalac_plugins': ['simple_scalac_plugin'], 'scalac_plugin_args': { 'simple_scalac_plugin': args @@ -35,7 +35,7 @@ def _do_test_global(self, args): def _do_test_local_with_global_args(self, args): config = { - 'compile.zinc': { + 'scala': { 'scalac_plugin_args': { 'simple_scalac_plugin': args } @@ -51,7 +51,7 @@ def test_global(self): def test_global_with_local_args(self): self._do_test(['args', 'from', 'target', 'global_with_local_args'], { - 'compile.zinc': { + 'scala': { 'scalac_plugins': ['simple_scalac_plugin'], }, }, @@ -70,7 +70,7 @@ def test_plugin_uses_other_plugin(self): # we will use other_simple_scalac_plugin (because it's globally specified). # This is a regression test for https://github.com/pantsbuild/pants/issues/4475. config = { - 'compile.zinc': { + 'scala': { 'scalac_plugins': ['other_simple_scalac_plugin'], 'scalac_plugin_args': { 'other_simple_scalac_plugin': ['foo']