Skip to content
Permalink
Browse files

Traceback

  • Loading branch information
stuhood committed Jul 17, 2015
1 parent 38a6f78 commit 08e97eaabd28f43be75bd0e192af0001d6773dc5
Showing with 51 additions and 47 deletions.
  1. +51 −47 src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py
@@ -339,50 +339,54 @@ def _register_vts(self, compile_contexts):
computed_classes_by_source_by_context = self._strategy.compute_classes_by_source(
compile_contexts)
resource_mapping = self._strategy.compute_resource_mapping(compile_contexts)
for compile_context in compile_contexts:
computed_classes_by_source = computed_classes_by_source_by_context[compile_context]
target = compile_context.target
classes_dir = compile_context.classes_dir

def add_products_by_target(files):
for f in files:
clsname = self._strategy.class_name_for_class_file(compile_context, f)
if clsname:
# Is a class.
classes_by_target[target].add_abs_paths(classes_dir, [f])
resources = resource_mapping.get(clsname, [])
resources_by_target[target].add_abs_paths(classes_dir, resources)
else:
# Is a resource.
resources_by_target[target].add_abs_paths(classes_dir, [f])

# Collect classfiles (absolute) that were claimed by sources (relative)
for source in compile_context.sources:
classes = computed_classes_by_source.get(source, [])
add_products_by_target(classes)
if classes_by_source is not None:
classes_by_source[source].add_abs_paths(classes_dir, classes)

# And any that were not claimed by sources (NB: `None` map key.)
unclaimed_classes = computed_classes_by_source.get(None, [])
if unclaimed_classes:
self.context.log.debug(
items_to_report_element(unclaimed_classes, 'class'),
' not claimed by analysis for ',
str(compile_context.target)
)
add_products_by_target(unclaimed_classes)

# Register resource products.
for compile_context in compile_contexts:
extra_resources = self.extra_products(compile_context.target)
# Add to resources_by_target (if it was requested).
if resources_by_target is not None:
target_resources = resources_by_target[compile_context.target]
for root, abs_paths in extra_resources:
target_resources.add_abs_paths(root, abs_paths)
# And to the compile_classpath, to make them available within the next round.
# TODO(stuhood): This is redundant with resources_by_target, but resources_by_target
# are not available during compilation. https://github.com/pantsbuild/pants/issues/206
entries = [(conf, root) for conf in self._confs for root, _ in extra_resources]
compile_classpath.add_for_target(compile_context.target, entries)
try:
for compile_context in compile_contexts:
computed_classes_by_source = computed_classes_by_source_by_context[compile_context]
target = compile_context.target
classes_dir = compile_context.classes_dir

def add_products_by_target(files):
for f in files:
clsname = self._strategy.class_name_for_class_file(compile_context, f)
if clsname:
# Is a class.
classes_by_target[target].add_abs_paths(classes_dir, [f])
resources = resource_mapping.get(clsname, [])
resources_by_target[target].add_abs_paths(classes_dir, resources)
else:
# Is a resource.
resources_by_target[target].add_abs_paths(classes_dir, [f])

# Collect classfiles (absolute) that were claimed by sources (relative)
for source in compile_context.sources:
classes = computed_classes_by_source.get(source, [])
add_products_by_target(classes)
if classes_by_source is not None:
classes_by_source[source].add_abs_paths(classes_dir, classes)

# And any that were not claimed by sources (NB: `None` map key.)
unclaimed_classes = computed_classes_by_source.get(None, [])
if unclaimed_classes:
self.context.log.debug(
items_to_report_element(unclaimed_classes, 'class'),
' not claimed by analysis for ',
str(compile_context.target)
)
add_products_by_target(unclaimed_classes)

# Register resource products.
for compile_context in compile_contexts:
extra_resources = self.extra_products(compile_context.target)
# Add to resources_by_target (if it was requested).
if resources_by_target is not None:
target_resources = resources_by_target[compile_context.target]
for root, abs_paths in extra_resources:
target_resources.add_abs_paths(root, abs_paths)
# And to the compile_classpath, to make them available within the next round.
# TODO(stuhood): This is redundant with resources_by_target, but resources_by_target
# are not available during compilation. https://github.com/pantsbuild/pants/issues/206
entries = [(conf, root) for conf in self._confs for root, _ in extra_resources]
compile_classpath.add_for_target(compile_context.target, entries)
except:
traceback.print_exc(file=sys.stdout)
raise

0 comments on commit 08e97ea

Please sign in to comment.
You can’t perform that action at this time.