Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
Add --compile-zinc-debug-symbols option
Browse files Browse the repository at this point in the history
This standardizes providing debug-symbol flags, to help prevent going out of sync between
cache population nodes and IDEs.

Testing Done:
CI: https://travis-ci.org/pantsbuild/pants/builds/87220079

Bugs closed: 2428

Reviewed at https://rbcommons.com/s/twitter/r/3013/
  • Loading branch information
wisechengyi authored and stuhood committed Oct 24, 2015
1 parent dd9d7ec commit 5297be8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,24 @@ def register_options(cls, register):
help='When set, any invalid/incompatible analysis files will be deleted '
'automatically. When unset, an error is raised instead.')

register('--warnings', default=True, action='store_true',
register('--warnings', default=True, action='store_true', fingerprint=True,
help='Compile with all configured warnings enabled.')

register('--warning-args', advanced=True, action='append',
register('--warning-args', advanced=True, action='append', fingerprint=True,
default=list(cls.get_warning_args_default()),
help='Extra compiler args to use when warnings are enabled.')

register('--no-warning-args', advanced=True, action='append',
register('--no-warning-args', advanced=True, action='append', fingerprint=True,
default=list(cls.get_no_warning_args_default()),
help='Extra compiler args to use when warnings are disabled.')

register('--debug-symbols', default=False, action='store_true', fingerprint=True,
help='Compile with debug symbol enabled.')

register('--debug-symbol-args', advanced=True, action='append', fingerprint=True,
default=['-C-g:lines,source,vars'],
help='Extra args to enable debug symbol.')

register('--delete-scratch', advanced=True, default=True, action='store_true',
help='Leave intermediate scratch files around, for debugging build problems.')

Expand Down Expand Up @@ -257,6 +264,9 @@ def __init__(self, *args, **kwargs):
else:
self._args.extend(self.get_options().no_warning_args)

if self.get_options().debug_symbols:
self._args.extend(self.get_options().debug_symbol_args)

# The ivy confs for which we're building.
self._confs = self.get_options().confs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def test_scalac_plugin_compile(self):
self.assertEqual('org.pantsbuild.testproject.scalac.plugin.HelloScalac',
root.find('classname').text)

def test_scalac_debug_symbol(self):
with self.do_test_compile('testprojects/src/scala/org/pantsbuild/testproject/scalac/plugin',
expected_files=['HelloScalac.class', 'scalac-plugin.xml'],
extra_args=['--compile-zinc-debug-symbols']) as found:
pass

def test_zinc_unsupported_option(self):
with temporary_dir(root_dir=self.workdir_root()) as workdir:
with temporary_dir(root_dir=self.workdir_root()) as cachedir:
Expand Down

0 comments on commit 5297be8

Please sign in to comment.