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

Make requirements on codegen products optional. #6357

Merged
merged 2 commits into from
Aug 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/python/pants/backend/jvm/tasks/coursier_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,10 @@ def product_types(cls):
@classmethod
def prepare(cls, options, round_manager):
super(CoursierResolve, cls).prepare(options, round_manager)
round_manager.require_data('java')
round_manager.require_data('scala')
# Codegen may inject extra resolvable deps, so make sure we have a product dependency
# on relevant codegen tasks, if any.
round_manager.optional_data('java')
round_manager.optional_data('scala')

@classmethod
def register_options(cls, register):
Expand Down
6 changes: 4 additions & 2 deletions src/python/pants/backend/jvm/tasks/ivy_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def product_types(cls):
@classmethod
def prepare(cls, options, round_manager):
super(IvyResolve, cls).prepare(options, round_manager)
round_manager.require_data('java')
round_manager.require_data('scala')
# Codegen may inject extra resolvable deps, so make sure we have a product dependency
# on relevant codegen tasks, if any.
round_manager.optional_data('java')
round_manager.optional_data('scala')

def __init__(self, *args, **kwargs):
super(IvyResolve, self).__init__(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/python/tasks/gather_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def product_types(cls):
@classmethod
def prepare(cls, options, round_manager):
round_manager.require_data(PythonInterpreter)
round_manager.require_data('python') # For codegen.
round_manager.optional_data('python') # For codegen.

def execute(self):
targets = self._collect_source_targets()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def cache_target_dirs(self):

@classmethod
def prepare(cls, options, round_manager):
# See comment below for why we don't use the GatherSources.PYTHON_SOURCES product.
round_manager.require_data(PythonInterpreter)
round_manager.require_data('python') # For codegen.
round_manager.optional_data('python') # For codegen.
round_manager.optional_product(PythonRequirementLibrary) # For local dists.

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def _python_native_code_settings(self):
def prepare(cls, options, round_manager):
round_manager.require_data(PythonInterpreter)
round_manager.optional_product(PythonRequirementLibrary) # For local dists.
# Codegen may inject extra resolvable deps, so make sure we have a product dependency
# on relevant codegen tasks, if any.
round_manager.optional_data('python')

def resolve_requirements(self, interpreter, req_libs):
"""Requirements resolution for PEX files.
Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/goal/run_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ def initialize(self):
raise AssertionError('RunTracker.initialize must not be called multiple times.')

# Initialize the run.

# Select a globally unique ID for the run, that sorts by time.
millis = int((self._run_timestamp * 1000) % 1000)
run_id = 'pants_run_{}_{}_{}'.format(
time.strftime('%Y_%m_%d_%H_%M_%S', time.localtime(self._run_timestamp)),
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def check_artifact_cache(self, vts):
def do_check_artifact_cache(self, vts, post_process_cached_vts=None):
"""Checks the artifact cache for the specified list of VersionedTargetSets.

Returns a pair (cached, uncached) of VersionedTargets that were
Returns a tuple (cached, uncached, uncached_causes) of VersionedTargets that were
satisfied/unsatisfied from the cache.
"""
if not vts:
Expand Down