Skip to content

Commit

Permalink
Fix git history...v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Livingston committed Jun 22, 2018
1 parent 19b2824 commit 91641b7
Show file tree
Hide file tree
Showing 138 changed files with 3,887 additions and 1,249 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Created by running `./build-support/bin/contributors.sh`.
+ Bardur Arantsson
+ Benjy Weinberger
+ Bill Farner
+ Billy "Hyun Joon" Seol
+ Brandon Milton
+ Brian Larson
+ Brian Wickman
Expand Down
20 changes: 10 additions & 10 deletions build-support/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,16 @@ function build_pex() {
case "${mode}" in
build)
case "$(uname)" in
Darwin)
local platform="${osx_platform}"
;;
Linux)
local platform="${linux_platform}"
;;
*)
echo >&2 "Unknown uname"
exit 1
;;
Darwin)
local platform="${osx_platform}"
;;
Linux)
local platform="${linux_platform}"
;;
*)
echo >&2 "Unknown uname"
exit 1
;;
esac
local platforms=("${platform}")
local dest="${ROOT}/dist/pants.${PANTS_UNSTABLE_VERSION}.${platform}.pex"
Expand Down
3 changes: 3 additions & 0 deletions contrib/go/src/python/pants/contrib/go/targets/go_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
class GoBinary(GoLocalSource):
"""A local Go main package."""

default_sources_globs = '*'
default_sources_exclude_globs = ('BUILD', 'BUILD.*')

@classmethod
def alias(cls):
return 'go_binary'
Expand Down
3 changes: 2 additions & 1 deletion contrib/go/src/python/pants/contrib/go/targets/go_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
class GoLibrary(GoLocalSource):
"""A local Go package."""

default_sources_globs = '*.go'
default_sources_globs = '*'
default_sources_exclude_globs = ('BUILD', 'BUILD.*')

@classmethod
def alias(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def __init__(self,

super(PantsPlugin, self).__init__(address,
payload,
sources=['register.py'],
provides=setup_py,
**kwargs)

Expand Down
1 change: 1 addition & 0 deletions pants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ branch_notes: {
'1.5.x': 'src/python/pants/notes/1.5.x.rst',
'1.6.x': 'src/python/pants/notes/1.6.x.rst',
'1.7.x': 'src/python/pants/notes/1.7.x.rst',
'1.8.x': 'src/python/pants/notes/1.8.x.rst',
}


Expand Down
2 changes: 2 additions & 0 deletions src/docs/docsite.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"notes-1.5.x": "dist/markdown/html/src/python/pants/notes/1.5.x.html",
"notes-1.6.x": "dist/markdown/html/src/python/pants/notes/1.6.x.html",
"notes-1.7.x": "dist/markdown/html/src/python/pants/notes/1.7.x.html",
"notes-1.8.x": "dist/markdown/html/src/python/pants/notes/1.8.x.html",
"notes-master": "dist/markdown/html/src/python/pants/notes/master.html",
"notes-master": "dist/markdown/html/src/python/pants/notes/master.html",
"options": "dist/markdown/html/src/docs/options.html",
Expand Down Expand Up @@ -175,6 +176,7 @@
},
{"collapsible_heading": "Release Notes",
"pages" : [
"notes-1.8.x",
"notes-1.7.x",
"notes-1.6.x",
"notes-1.5.x",
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.0.dev3
1.8.0rc0
8 changes: 4 additions & 4 deletions src/python/pants/backend/docgen/targets/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ def _compute_fingerprint(self):
return combine_hashes(artifact.fingerprint() for artifact in self)

def __init__(self,
sources,
address=None,
payload=None,
source=None,
format=None,
links=None,
provides=None,
**kwargs):
"""
:param source: Path to page source file.
:param sources: Page source file. Exactly one will be present.
:param format: Page's format, ``md`` or ``rst``. By default, Pants infers from ``source`` file
extension: ``.rst`` is ReStructured Text; anything else is Markdown.
:param links: Other ``page`` targets that this `page` links to.
Expand All @@ -97,12 +97,12 @@ def __init__(self,
"""
payload = payload or Payload()
if not format:
if source and source.lower().endswith('.rst'):
if sources.files[0].lower().endswith('.rst'):
format = 'rst'
else:
format = 'md'
payload.add_fields({
'sources': self.create_sources_field(sources=[source],
'sources': self.create_sources_field(sources=sources,
sources_rel_path=address.spec_path,
key_arg='sources'),
'format': PrimitiveField(format),
Expand Down
16 changes: 6 additions & 10 deletions src/python/pants/backend/jvm/subsystems/dependency_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@

import hashlib

from pants.backend.codegen.protobuf.java.java_protobuf_library import JavaProtobufLibrary
from pants.backend.codegen.thrift.java.java_thrift_library import JavaThriftLibrary
from pants.backend.jvm.subsystems.java import Java
from pants.backend.jvm.subsystems.scala_platform import ScalaPlatform
from pants.backend.jvm.targets.annotation_processor import AnnotationProcessor
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.backend.jvm.targets.javac_plugin import JavacPlugin
from pants.backend.jvm.targets.scalac_plugin import ScalacPlugin
from pants.base.fingerprint_strategy import FingerprintStrategy
from pants.build_graph.aliased_target import AliasTarget
from pants.build_graph.dependency_context import DependencyContext as DependencyContextBase
from pants.build_graph.resources import Resources
from pants.build_graph.target import Target
from pants.build_graph.target_scopes import Scopes
from pants.subsystem.subsystem import Subsystem

Expand All @@ -27,7 +24,7 @@ class SyntheticTargetNotFound(Exception):
"""Exports were resolved for a thrift target which hasn't had a synthetic target generated yet."""


class DependencyContext(Subsystem):
class DependencyContext(Subsystem, DependencyContextBase):
"""Implements calculating `exports` and exception (compiler-plugin) aware dependencies.
This is a subsystem because in future the compiler plugin types should be injected
Expand All @@ -36,10 +33,8 @@ class DependencyContext(Subsystem):

options_scope = 'jvm-dependency-context'

types_with_closure = (AnnotationProcessor, JavacPlugin, ScalacPlugin)
target_closure_kwargs = dict(include_scopes=Scopes.JVM_COMPILE_SCOPES, respect_intransitive=True)
compiler_plugin_types = (AnnotationProcessor, JavacPlugin, ScalacPlugin)
alias_types = (AliasTarget, Target)
codegen_types = (JavaThriftLibrary, JavaProtobufLibrary)

@classmethod
def subsystem_dependencies(cls):
Expand All @@ -63,8 +58,9 @@ def defaulted_property(self, target, selector):
If the target does not override the language property, returns true iff the property
is true for any of the matched languages for the target.
"""
if selector(target) is not None:
return selector(target)
target_property_selected = selector(target)
if target_property_selected is not None:
return target_property_selected

prop = False
if target.has_sources('.java'):
Expand Down
17 changes: 4 additions & 13 deletions src/python/pants/backend/jvm/targets/jvm_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def __init__(self,
payload=None,
main=None,
basename=None,
source=None,
sources=None,
deploy_excludes=None,
deploy_jar_rules=None,
manifest_entries=None,
Expand All @@ -317,8 +317,8 @@ def __init__(self,
:param string basename: Base name for the generated ``.jar`` file, e.g.,
``'hello'``. (By default, uses ``name`` param) Note this is unsafe
because of the possible conflict when multiple binaries are built.
:param string source: Name of one ``.java`` or ``.scala`` file (a good
place for a ``main``).
:param EagerFilesetWithSpec sources: Zero or one source files. If more than one source is
required, they should be put in a library target which should be added to dependencies.
:param dependencies: Targets (probably ``java_library`` and
``scala_library`` targets) to "link" in.
:type dependencies: list of target specs
Expand All @@ -340,8 +340,6 @@ def __init__(self,
self.address = address # Set in case a TargetDefinitionException is thrown early
if main and not isinstance(main, string_types):
raise TargetDefinitionException(self, 'main must be a fully qualified classname')
if source and not isinstance(source, string_types):
raise TargetDefinitionException(self, 'source must be a single relative file path')
if deploy_jar_rules and not isinstance(deploy_jar_rules, JarRules):
raise TargetDefinitionException(self,
'deploy_jar_rules must be a JarRules specification. got {}'
Expand All @@ -350,13 +348,6 @@ def __init__(self,
raise TargetDefinitionException(self,
'manifest_entries must be a dict. got {}'
.format(type(manifest_entries).__name__))
sources = [source] if source else None
if 'sources' in kwargs:
raise self.IllegalArgument(address.spec,
'jvm_binary only supports a single "source" argument, typically used to specify a main '
'class source file. Other sources should instead be placed in a java_library, which '
'should be referenced in the jvm_binary\'s dependencies.'
)
payload = payload or Payload()
payload.add_fields({
'basename': PrimitiveField(basename or name),
Expand All @@ -372,7 +363,7 @@ def __init__(self,
super(JvmBinary, self).__init__(name=name,
address=address,
payload=payload,
sources=self.assert_list(sources, key_arg='sources'),
sources=sources,
**kwargs)

@property
Expand Down
18 changes: 18 additions & 0 deletions src/python/pants/backend/jvm/tasks/coverage/cobertura.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@

from twitter.common.collections import OrderedSet

from pants.backend.jvm.tasks.classpath_util import ClasspathUtil
from pants.backend.jvm.tasks.coverage.engine import CoverageEngine
from pants.base.exceptions import TaskError
from pants.build_graph.build_graph import BuildGraph
from pants.build_graph.target_scopes import Scopes
from pants.java.jar.jar_dependency import JarDependency
from pants.java.util import safe_classpath
from pants.subsystem.subsystem import Subsystem
from pants.util.contextutil import temporary_file
from pants.util.dirutil import relativize_paths, safe_mkdir, safe_mkdir_for, safe_walk, touch
Expand Down Expand Up @@ -53,6 +57,8 @@ def register_junit_options(register, register_jvm_tool):
help='Regex patterns passed to cobertura specifying which classes should NOT be '
'instrumented. (see the "excludeclasses" element description here: '
'https://github.com/cobertura/cobertura/wiki/Ant-Task-Reference')
register('--coverage-cobertura-include-user-classpath', type=bool, fingerprint=True, default=True,
help='Use the user classpath to aid in instrumenting classes')

def slf4j_jar(name):
return JarDependency(org='org.slf4j', name=name, rev='1.7.5')
Expand Down Expand Up @@ -101,6 +107,7 @@ def __init__(self, settings, targets, execute_java_for_targets):
self._rootdirs = defaultdict(OrderedSet)
self._include_classes = options.coverage_cobertura_include_classes
self._exclude_classes = options.coverage_cobertura_exclude_classes
self._include_user_classpath = options.coverage_cobertura_include_user_classpath
self._targets = targets
self._execute_java = functools.partial(execute_java_for_targets, targets)

Expand Down Expand Up @@ -192,6 +199,17 @@ def instrument(self, output_dir):
'--datafile',
self._canonical_datafile,
]

if self._include_user_classpath:
closure = BuildGraph.closure(self._targets, bfs=True, include_scopes=Scopes.JVM_TEST_SCOPES,
respect_intransitive=True)

aux_classpath = safe_classpath(
ClasspathUtil.classpath(closure, runtime_classpath),
synthetic_jar_dir=None)
args.append('--auxClasspath')
args.extend(aux_classpath)

# apply class incl/excl filters
if len(self._include_classes) > 0:
for pattern in self._include_classes:
Expand Down
4 changes: 4 additions & 0 deletions src/python/pants/backend/native/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ python_library(
'src/python/pants/backend/native/config',
'src/python/pants/backend/native/subsystems',
'src/python/pants/backend/native/subsystems/binaries',
'src/python/pants/backend/native/targets',
'src/python/pants/backend/native/tasks',
'src/python/pants/build_graph',
'src/python/pants/goal:task_registrar',
],
)
28 changes: 15 additions & 13 deletions src/python/pants/backend/native/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
from pants.util.osutil import all_normalized_os_names, get_normalized_os_name


class UnsupportedPlatformError(Exception):
"""Thrown if the native toolchain is invoked on an unrecognized platform.
Note that the native toolchain should work on all of Pants's supported
platforms."""


class Platform(datatype(['normalized_os_name'])):

class UnsupportedPlatformError(Exception):
"""Thrown if pants is running on an unrecognized platform."""

@classmethod
def create(cls):
return Platform(get_normalized_os_name())
Expand All @@ -29,14 +25,14 @@ def create(cls):

def resolve_platform_specific(self, platform_specific_funs):
arg_keys = frozenset(platform_specific_funs.keys())
unknown_plats = self._NORMED_OS_NAMES - arg_keys
unknown_plats = self._NORMALIZED_OS_NAMES - arg_keys
if unknown_plats:
raise UnsupportedPlatformError(
raise self.UnsupportedPlatformError(
"platform_specific_funs {} must support platforms {}"
.format(platform_specific_funs, list(unknown_plats)))
extra_plats = arg_keys - self._NORMED_OS_NAMES
extra_plats = arg_keys - self._NORMALIZED_OS_NAMES
if extra_plats:
raise UnsupportedPlatformError(
raise self.UnsupportedPlatformError(
"platform_specific_funs {} has unrecognized platforms {}"
.format(platform_specific_funs, list(extra_plats)))

Expand All @@ -48,30 +44,36 @@ class Executable(object):

@abstractproperty
def path_entries(self):
"""???"""
"""A list of directory paths containing this executable, to be used in a subprocess's PATH.
This may be multiple directories, e.g. if the main executable program invokes any subprocesses.
"""

@abstractproperty
def exe_filename(self):
"""???"""
"""The "entry point" -- which file to invoke when PATH is set to `path_entries()`."""


class Linker(datatype([
'path_entries',
'exe_filename',
('platform', Platform),
]), Executable):
pass


class CCompiler(datatype([
'path_entries',
'exe_filename',
('platform', Platform),
]), Executable):
pass


class CppCompiler(datatype([
'path_entries',
'exe_filename',
('platform', Platform),
]), Executable):
pass

Expand Down
Loading

0 comments on commit 91641b7

Please sign in to comment.