def test_debug_config_default(self): config = create_config() self.assertEquals(5005, JvmDebugConfig.debug_port(config)) self.assertEquals([ '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005' ], JvmDebugConfig.debug_args(config))
def test_debug_config_override(self): config = create_config(dedent(""" [jvm] debug_port: 12345 debug_args: ['foo', 'bar', 'port=%(debug_port)s'] """)) self.assertEquals(12345, JvmDebugConfig.debug_port(config)) self.assertEquals(['foo', 'bar', 'port=12345'], JvmDebugConfig.debug_args(config))
def test_debug_config_override(self): config = create_config( dedent(""" [jvm] debug_port: 12345 debug_args: ['foo', 'bar', 'port=%(debug_port)s'] """)) self.assertEquals(12345, JvmDebugConfig.debug_port(config)) self.assertEquals(['foo', 'bar', 'port=12345'], JvmDebugConfig.debug_args(config))
def __init__(self, *args, **kwargs): super(IdeGen, self).__init__(*args, **kwargs) self.project_name = self.get_options().project_name self.python = self.get_options().python self.skip_java = not self.get_options().java self.skip_scala = not self.get_options().scala self.use_source_root = self.get_options().use_source_root self.java_language_level = self.get_options().java_language_level if self.get_options().java_jdk_name: self.java_jdk = self.get_options().java_jdk_name else: self.java_jdk = '1.%d' % self.java_language_level # Always tack on the project name to the work dir so each project gets its own linked jars, # etc. See https://github.com/pantsbuild/pants/issues/564 if self.get_options().project_dir: self.gen_project_workdir = os.path.abspath( os.path.join(self.get_options().project_dir, self.project_name)) else: self.gen_project_workdir = os.path.abspath( os.path.join(self.workdir, self.__class__.__name__, self.project_name)) self.cwd = ( os.path.abspath(self.get_options().project_cwd) if self.get_options().project_cwd else self.gen_project_workdir ) self.intransitive = self.get_options().intransitive # Everywhere else, debug_port is specified in the 'jvm' section. Use that as a default if none # is specified in the 'ide' section. jvm_config_debug_port = JvmDebugConfig.debug_port(self.context.config) self.debug_port = self.context.config.getint('ide', 'debug_port', default=jvm_config_debug_port)
def __init__(self, *args, **kwargs): super(BenchmarkRun, self).__init__(*args, **kwargs) config = self.context.config self.confs = config.getlist('benchmark-run', 'confs', default=['default']) self.jvm_args = config.getlist('benchmark-run', 'jvm_args', default=['-Xmx1g', '-XX:MaxPermSize=256m']) self._benchmark_bootstrap_key = 'benchmark-tool' benchmark_bootstrap_tools = config.getlist('benchmark-run', 'bootstrap-tools', default=['//:benchmark-caliper-0.5']) self.register_jvm_tool(self._benchmark_bootstrap_key, benchmark_bootstrap_tools) self._agent_bootstrap_key = 'benchmark-agent' agent_bootstrap_tools = config.getlist('benchmark-run', 'agent_profile', default=[':benchmark-java-allocation-instrumenter-2.1']) self.register_jvm_tool(self._agent_bootstrap_key, agent_bootstrap_tools) # TODO(Steve Gury): # Find all the target classes from the Benchmark target itself # https://jira.twitter.biz/browse/AWESOME-1938 self.caliper_args = self.context.options.target_class if self.context.options.memory_profiling: self.caliper_args += ['--measureMemory'] if self.context.options.debug: self.jvm_args.extend(JvmDebugConfig.debug_args(self.context.config)) self.caliper_args += ['--debug'] self.caliper_args.extend(self.context.options.extra_caliper_args)
def __init__(self, *args, **kwargs): super(IdeGen, self).__init__(*args, **kwargs) self.project_name = self.get_options().project_name self.python = self.get_options().python self.skip_java = not self.get_options().java self.skip_scala = not self.get_options().scala self.use_source_root = self.get_options().use_source_root self.java_language_level = self.get_options().java_language_level if self.get_options().java_jdk_name: self.java_jdk = self.get_options().java_jdk_name else: self.java_jdk = '1.%d' % self.java_language_level # Always tack on the project name to the work dir so each project gets its own linked jars, # etc. See https://github.com/pantsbuild/pants/issues/564 if self.get_options().project_dir: self.gen_project_workdir = os.path.abspath( os.path.join(self.get_options().project_dir, self.project_name)) else: self.gen_project_workdir = os.path.abspath( os.path.join(self.workdir, self.__class__.__name__, self.project_name)) self.cwd = (os.path.abspath(self.get_options().project_cwd) if self.get_options().project_cwd else self.gen_project_workdir) self.intransitive = self.get_options().intransitive self.checkstyle_suppression_files = self.context.config.get( 'checkstyle', 'suppression_files', type=list, default=[]) # Everywhere else, debug_port is specified in the 'jvm' section. Use that as a default if none # is specified in the 'ide' section. jvm_config_debug_port = JvmDebugConfig.debug_port(self.context.config) self.debug_port = self.context.config.getint( 'ide', 'debug_port', default=jvm_config_debug_port) self.checkstyle_bootstrap_key = 'checkstyle' self.register_jvm_tool_from_config(self.checkstyle_bootstrap_key, self.context.config, ini_section='checkstyle', ini_key='bootstrap-tools', default=['//:twitter-checkstyle']) self.scalac_bootstrap_key = None if not self.skip_scala: self.scalac_bootstrap_key = 'scalac' self.register_jvm_tool_from_config( self.scalac_bootstrap_key, self.context.config, ini_section='scala-compile', ini_key='compile-bootstrap-tools', default=['//:scala-compiler-2.9.3'])
def __init__(self, *args, **kwargs): super(IdeGen, self).__init__(*args, **kwargs) self.project_name = self.context.options.ide_gen_project_name self.python = self.context.options.ide_gen_python self.skip_java = not self.context.options.ide_gen_java self.skip_scala = not self.context.options.ide_gen_scala self.use_source_root = self.context.options.ide_gen_use_source_root self.java_language_level = self.context.options.ide_gen_java_language_level if self.context.options.ide_gen_java_jdk: self.java_jdk = self.context.options.ide_gen_java_jdk else: self.java_jdk = '1.%d' % self.java_language_level # Always tack on the project name to the work dir so each project gets its own linked jars, # etc. See https://github.com/pantsbuild/pants/issues/564 if self.context.options.ide_gen_project_dir: self.gen_project_workdir = os.path.abspath( os.path.join(self.context.options.ide_gen_project_dir, self.project_name)) else: self.gen_project_workdir = os.path.abspath( os.path.join(self.workdir, self.__class__.__name__, self.project_name)) self.cwd = ( os.path.abspath(self.context.options.ide_gen_project_cwd) if self.context.options.ide_gen_project_cwd else self.gen_project_workdir ) self.intransitive = self.context.options.ide_gen_intransitive self.checkstyle_suppression_files = self.context.config.getdefault( 'checkstyle_suppression_files', type=list, default=[] ) # Everywhere else, debug_port is specified in the 'jvm' section. Use that as a default if none # is specified in the 'ide' section. jvm_config_debug_port = JvmDebugConfig.debug_port(self.context.config) self.debug_port = self.context.config.getint('ide', 'debug_port', default=jvm_config_debug_port) self.checkstyle_bootstrap_key = 'checkstyle' self.register_jvm_tool_from_config(self.checkstyle_bootstrap_key, self.context.config, ini_section='checkstyle', ini_key='bootstrap-tools', default=['//:twitter-checkstyle']) self.scalac_bootstrap_key = None if not self.skip_scala: self.scalac_bootstrap_key = 'scalac' self.register_jvm_tool_from_config(self.scalac_bootstrap_key, self.context.config, ini_section='scala-compile', ini_key='compile-bootstrap-tools', default=['//:scala-compiler-2.9.3'])
def __init__(self, *args, **kwargs): super(JvmRun, self).__init__(*args, **kwargs) self.jvm_args = self.context.config.getlist('jvm-run', 'jvm_args', default=[]) if self.context.options.run_jvmargs: for arg in self.context.options.run_jvmargs: self.jvm_args.extend(safe_shlex_split(arg)) self.args = [] if self.context.options.run_args: for arg in self.context.options.run_args: self.args.extend(safe_shlex_split(arg)) if self.context.options.run_debug: self.jvm_args.extend(JvmDebugConfig.debug_args(self.context.config)) self.confs = self.context.config.getlist('jvm-run', 'confs', default=['default']) self.only_write_cmd_line = self.context.options.only_write_cmd_line
def __init__(self, *args, **kwargs): super(JvmTask, self).__init__(*args, **kwargs) self.jvm_options = [] for jvm_option in self.get_options().jvm_options: self.jvm_options.extend(safe_shlex_split(jvm_option)) if self.get_options().debug: self.jvm_options.extend(JvmDebugConfig.debug_args(self.context.config)) self.args = [] for arg in self.get_options().args: self.args.extend(safe_shlex_split(arg)) self.confs = self.get_options().confs
def __init__(self, *args, **kwargs): super(SpecsRun, self).__init__(*args, **kwargs) self._specs_bootstrap_key = 'specs' bootstrap_tools = self.context.config.getlist('specs-run', 'bootstrap-tools', default=['//:scala-specs-2.9.3']) self.register_jvm_tool(self._specs_bootstrap_key, bootstrap_tools) self.confs = self.context.config.getlist('specs-run', 'confs', default=['default']) self._jvm_options = self.context.config.getlist('specs-run', 'jvm_args', default=[]) if self.context.options.specs_run_jvm_options: self._jvm_options.extend(self.context.options.specs_run_jvm_options) if self.context.options.specs_run_debug: self._jvm_options.extend(JvmDebugConfig.debug_args(self.context.config)) self.skip = self.context.options.specs_run_skip self.color = self.context.options.specs_run_color self.tests = self.context.options.specs_run_tests
def __init__(self, *args, **kwargs): super(IdeGen, self).__init__(*args, **kwargs) self.project_name = self.get_options().project_name self.python = self.get_options().python self.skip_java = not self.get_options().java self.skip_scala = not self.get_options().scala self.use_source_root = self.get_options().use_source_root self.java_language_level = self.get_options().java_language_level if self.get_options().java_jdk_name: self.java_jdk = self.get_options().java_jdk_name else: self.java_jdk = '1.%d' % self.java_language_level # Always tack on the project name to the work dir so each project gets its own linked jars, # etc. See https://github.com/pantsbuild/pants/issues/564 if self.get_options().project_dir: self.gen_project_workdir = os.path.abspath( os.path.join(self.get_options().project_dir, self.project_name)) else: self.gen_project_workdir = os.path.abspath( os.path.join(self.workdir, self.__class__.__name__, self.project_name)) self.cwd = (os.path.abspath(self.get_options().project_cwd) if self.get_options().project_cwd else self.gen_project_workdir) self.intransitive = self.get_options().intransitive # Everywhere else, debug_port is specified in the 'jvm' section. Use that as a default if none # is specified in the 'ide' section. jvm_config_debug_port = JvmDebugConfig.debug_port(self.context.config) self.debug_port = self.context.config.getint( 'ide', 'debug_port', default=jvm_config_debug_port)
def test_debug_config_default(self): config = create_config() self.assertEquals(5005, JvmDebugConfig.debug_port(config)) self.assertEquals(['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'], JvmDebugConfig.debug_args(config))