<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> from pants . backend . codegen . register import build_file_aliases as register_codegen <EOL> from pants . backend . codegen . targets . java_wire_library import JavaWireLibrary <EOL> from pants . backend . codegen . tasks . wire_gen import WireGen <EOL> from pants . backend . jvm . targets . jar_dependency import JarDependency <EOL> from pants . backend . jvm . targets . jar_library import JarLibrary <EOL> from pants . build_graph . register import build_file_aliases as register_core <EOL> from pants_test . tasks . task_test_base import TaskTestBase <EOL> class WireGenTest ( TaskTestBase ) : <EOL> TARGET_WORKDIR = "<STR_LIT>" <EOL> @ classmethod <EOL> def task_type ( cls ) : <EOL> return WireGen <EOL> @ property <EOL> def alias_groups ( self ) : <EOL> return register_core ( ) . merge ( register_codegen ( ) ) <EOL> def _create_fake_wire_tool ( self , version = '<STR_LIT>' ) : <EOL> self . make_target ( '<STR_LIT>' , JarLibrary , jars = [ <EOL> JarDependency ( org = '<STR_LIT>' , name = '<STR_LIT>' , rev = version ) , <EOL> ] ) <EOL> def test_compiler_args ( self ) : <EOL> self . _create_fake_wire_tool ( ) <EOL> simple_wire_target = self . make_target ( '<STR_LIT>' , JavaWireLibrary , <EOL> sources = [ '<STR_LIT>' ] ) <EOL> context = self . context ( target_roots = [ simple_wire_target ] ) <EOL> task = self . create_task ( context ) <EOL> self . assertEquals ( [ <EOL> '<STR_LIT>' . format ( self . TARGET_WORKDIR ) , <EOL> '<STR_LIT>' . format ( self . build_root ) , <EOL> '<STR_LIT>' ] , <EOL> task . format_args_for_target ( simple_wire_target , self . TARGET_WORKDIR ) ) <EOL> def test_compiler_args_wirev1 ( self ) : <EOL> self . _create_fake_wire_tool ( ) <EOL> wire_targetv1 = self . make_target ( '<STR_LIT>' , JavaWireLibrary , <EOL> sources = [ '<STR_LIT>' ] , <EOL> service_writer = '<STR_LIT>' , <EOL> service_writer_options = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> task = self . create_task ( self . context ( target_roots = [ wire_targetv1 ] ) ) <EOL> self . assertEquals ( [ <EOL> '<STR_LIT>' . format ( self . TARGET_WORKDIR ) , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' . format ( self . build_root ) , <EOL> '<STR_LIT>' ] , <EOL> task . format_args_for_target ( wire_targetv1 , self . TARGET_WORKDIR ) ) <EOL> def test_compiler_args_all ( self ) : <EOL> self . _create_fake_wire_tool ( version = '<STR_LIT>' ) <EOL> kitchen_sink = self . make_target ( '<STR_LIT>' , JavaWireLibrary , <EOL> sources = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> registry_class = '<STR_LIT>' , <EOL> service_writer = '<STR_LIT>' , <EOL> no_options = True , <EOL> roots = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> enum_options = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , ) <EOL> task = self . create_task ( self . context ( target_roots = [ kitchen_sink ] ) ) <EOL> self . assertEquals ( [ <EOL> '<STR_LIT>' . format ( self . TARGET_WORKDIR ) , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . format ( self . build_root ) , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> task . format_args_for_target ( kitchen_sink , self . TARGET_WORKDIR ) ) <EOL> def test_compiler_args_proto_paths ( self ) : <EOL> self . _create_fake_wire_tool ( ) <EOL> parent_target = self . make_target ( '<STR_LIT>' , JavaWireLibrary , <EOL> sources = [ '<STR_LIT>' ] ) <EOL> simple_wire_target = self . make_target ( '<STR_LIT>' , JavaWireLibrary , <EOL> sources = [ '<STR_LIT>' ] , dependencies = [ parent_target ] ) <EOL> context = self . context ( target_roots = [ parent_target , simple_wire_target ] ) <EOL> task = self . create_task ( context ) <EOL> self . assertEquals ( [ <EOL> '<STR_LIT>' . format ( self . TARGET_WORKDIR ) , <EOL> '<STR_LIT>' . format ( self . build_root ) , <EOL> '<STR_LIT>' ] , <EOL> task . format_args_for_target ( simple_wire_target , self . TARGET_WORKDIR ) ) </s>
