diff --git a/contrib/cpp/src/python/pants/contrib/cpp/register.py b/contrib/cpp/src/python/pants/contrib/cpp/register.py index 223925f00fb..5cf51541ebf 100644 --- a/contrib/cpp/src/python/pants/contrib/cpp/register.py +++ b/contrib/cpp/src/python/pants/contrib/cpp/register.py @@ -25,7 +25,7 @@ def build_file_aliases(): ) def register_goals(): - task(name='cpp-compile', action=CppCompile).install('compile') - task(name='cpp-library', action=CppLibraryCreate).install('binary') - task(name='cpp-binary', action=CppBinaryCreate).install('binary') - task(name='cpp-run', action=CppRun).install('run') + task(name='cpp', action=CppCompile).install('compile') + task(name='cpplib', action=CppLibraryCreate).install('binary') + task(name='cpp', action=CppBinaryCreate).install('binary') + task(name='cpp', action=CppRun).install('run') diff --git a/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_compile.py b/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_compile.py index 8a1e7e40d5a..86ffaf1fd11 100644 --- a/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_compile.py +++ b/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_compile.py @@ -14,17 +14,17 @@ class CppCompile(CppTask): - """Compiles object files from C++ sources.""" + """Compile C++ sources into object files.""" @classmethod def register_options(cls, register): super(CppCompile, cls).register_options(register) - register('--cc-options', + register('--cc-options', advanced=True, action='append', default=[], fingerprint=True, help='Append these options to the compiler command line.') - register('--cc-extensions', - default=['cc', 'cxx', 'cpp'], - help=('The list of extensions (without the .) to consider when ' - 'determining if a file is a C++ source file.')) + register('--cc-extensions', advanced=True, action='append', fingerprint=True, + default=['.cc', '.cxx', '.cpp'], + help=('The list of extensions to consider when determining if a file is a ' + 'C++ source file.')) @classmethod def product_types(cls): @@ -39,7 +39,7 @@ def execute(self): def is_cc(source): _, ext = os.path.splitext(source) - return ext[1:] in self.get_options().cc_extensions + return ext in self.get_options().cc_extensions targets = self.context.targets(self.is_cpp) @@ -84,8 +84,7 @@ def _compile(self, target, results_dir, source): cmd.extend(['-c']) cmd.extend(('-I{0}'.format(i) for i in include_dirs)) cmd.extend(['-o' + obj, abs_source]) - if self.get_options().cc_options != None: - cmd.extend([self.get_options().cc_options]) + cmd.extend(self.get_options().cc_options) # TODO: submit_async_work with self.run_command, [(cmd)] as a Work object. with self.context.new_workunit(name='cpp-compile', labels=[WorkUnit.COMPILER]) as workunit: diff --git a/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_task.py b/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_task.py index 1cadceb24d0..f776b1fb455 100644 --- a/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_task.py +++ b/contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_task.py @@ -32,7 +32,7 @@ def is_binary(target): @classmethod def register_options(cls, register): super(CppTask, cls).register_options(register) - register('--compiler', + register('--compiler', advanced=True, fingerprint=True, help='Set a specific compiler to use (eg, g++-4.8, clang++)') def execute(self): diff --git a/migrations/options/src/python/migrate_config.py b/migrations/options/src/python/migrate_config.py index cae81e2e9c0..aac5833b91b 100644 --- a/migrations/options/src/python/migrate_config.py +++ b/migrations/options/src/python/migrate_config.py @@ -255,6 +255,9 @@ ('compile.zinc-java', 'enabled'): ('compile.java', 'use-jmake'), ('compile.scala', 'args'): ('compile.zinc', 'args'), + + ('compile.cpp-compile', 'cc_options'): ('compile.cpp', 'cc_options'), + ('compile.cpp-compile', 'cc_extensions'): ('compile.cpp', 'cc_extensions'), } ng_daemons_note = ('The global "ng_daemons" option has been replaced by a "use_nailgun" option ' @@ -352,6 +355,11 @@ 'to "disable jmake for java", more precisely, instead of ' '--compile-zinc-java-enabled, use --no-compile-java-use-jmake', ('compile.scala', 'args'): 'ALL `compile.scala` options have moved to `compile.zinc`.', + + ('compile.cpp-compile', 'cc_options'): 'Value used to be a string, is now a list.', + ('compile.cpp-compile', 'cc_extensions'): 'Value used to be a string (but default was a list), ' + 'is now a list. Values also now include the dot, e.g.,' + 'it\'s now .cpp, not cpp.', } diff --git a/src/python/pants/backend/jvm/tasks/checkstyle.py b/src/python/pants/backend/jvm/tasks/checkstyle.py index 0e7e7d121c7..0fcfa9d0f40 100644 --- a/src/python/pants/backend/jvm/tasks/checkstyle.py +++ b/src/python/pants/backend/jvm/tasks/checkstyle.py @@ -18,6 +18,7 @@ class Checkstyle(NailgunTask): + """Check Java code for style violations.""" _CHECKSTYLE_MAIN = 'com.puppycrawl.tools.checkstyle.Main' @@ -30,14 +31,13 @@ def register_options(cls, register): super(Checkstyle, cls).register_options(register) register('--skip', action='store_true', fingerprint=True, help='Skip checkstyle.') - register('--configuration', type=file_option, fingerprint=True, + register('--configuration', advanced=True, type=file_option, fingerprint=True, help='Path to the checkstyle configuration file.') - register('--properties', type=dict_option, default={}, fingerprint=True, + register('--properties', advanced=True, type=dict_option, default={}, fingerprint=True, help='Dictionary of property mappings to use for checkstyle.properties.') - register('--confs', default=['default'], - help='One or more ivy configurations to resolve for this target. This parameter is ' - 'not intended for general use. ') - register('--jvm-options', action='append', metavar='