diff --git a/src/python/pants/engine/BUILD b/src/python/pants/engine/BUILD index 08ad5123e970..4bb770e45e90 100644 --- a/src/python/pants/engine/BUILD +++ b/src/python/pants/engine/BUILD @@ -185,6 +185,12 @@ python_library( ], ) + +python_library( + name='console', + sources=['console.py'] +) + resources( name='native_engine_shared_library', sources=['native_engine.so'] diff --git a/src/python/pants/init/BUILD b/src/python/pants/init/BUILD index 33ecbab4c4cc..eadfed048418 100644 --- a/src/python/pants/init/BUILD +++ b/src/python/pants/init/BUILD @@ -22,6 +22,7 @@ python_library( 'src/python/pants/engine/legacy:source_mapper', 'src/python/pants/engine/legacy:structs', 'src/python/pants/engine:build_files', + 'src/python/pants/engine:console', 'src/python/pants/engine:mapper', 'src/python/pants/engine:native', 'src/python/pants/engine:parser', @@ -30,6 +31,7 @@ python_library( 'src/python/pants/goal:run_tracker', 'src/python/pants/option', 'src/python/pants/process', + 'src/python/pants/rules/core', 'src/python/pants/subsystem', 'src/python/pants/util:dirutil', 'src/python/pants/util:memo', diff --git a/src/python/pants/init/engine_initializer.py b/src/python/pants/init/engine_initializer.py index 743a7c4b6240..a5db0125cd3f 100644 --- a/src/python/pants/init/engine_initializer.py +++ b/src/python/pants/init/engine_initializer.py @@ -40,7 +40,6 @@ GlobMatchErrorBehavior) from pants.option.options_bootstrapper import OptionsBootstrapper from pants.rules.core.register import create_core_rules -from pants.util.collections import combined_dict from pants.util.objects import datatype @@ -225,22 +224,25 @@ def create_build_graph(self, target_roots, build_root=None): return graph, address_mapper -def _make_goal_map_from_rules(rules): - goal_map = {} - goal_to_rule = [(rule.goal, rule) for rule in rules if getattr(rule, 'goal', None) is not None] - for goal, rule in goal_to_rule: - if goal in goal_map: - raise GoalMappingError( - 'could not map goal `{}` to rule `{}`: already claimed by product `{}`' - .format(goal, rule, goal_map[goal]) - ) - goal_map[goal] = rule.output_type - return goal_map - - class EngineInitializer(object): """Constructs the components necessary to run the v2 engine with v1 BuildGraph compatibility.""" + class GoalMappingError(Exception): + """Raised when a goal cannot be mapped to an @rule.""" + + @staticmethod + def _make_goal_map_from_rules(rules): + goal_map = {} + goal_to_rule = [(rule.goal, rule) for rule in rules if getattr(rule, 'goal', None) is not None] + for goal, rule in goal_to_rule: + if goal in goal_map: + raise EngineInitializer.GoalMappingError( + 'could not map goal `{}` to rule `{}`: already claimed by product `{}`' + .format(goal, rule, goal_map[goal]) + ) + goal_map[goal] = rule.output_type + return goal_map + @staticmethod def setup_legacy_graph(native, bootstrap_options, build_configuration): """Construct and return the components necessary for LegacyBuildGraph construction.""" @@ -345,7 +347,7 @@ def setup_legacy_graph_extended( rules ) - goal_map = _make_goal_map_from_rules(rules) + goal_map = EngineInitializer._make_goal_map_from_rules(rules) scheduler = Scheduler( native, diff --git a/src/python/pants/pantsd/service/pailgun_service.py b/src/python/pants/pantsd/service/pailgun_service.py index 523e26e51db2..6ceef862bcaa 100644 --- a/src/python/pants/pantsd/service/pailgun_service.py +++ b/src/python/pants/pantsd/service/pailgun_service.py @@ -7,8 +7,6 @@ import logging import select -import sys -import traceback from contextlib import contextmanager from pants.pantsd.pailgun_server import PailgunServer