-
-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor the compilation and linking pipeline to use subsystems
- Loading branch information
1 parent
f84eed2
commit 3843d5f
Showing
6 changed files
with
242 additions
and
201 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/python/pants/backend/native/subsystems/native_compile_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# coding=utf-8 | ||
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants.subsystem.subsystem import Subsystem | ||
|
||
|
||
class NativeCompileSettings(Subsystem): | ||
"""???""" | ||
|
||
# FIXME: add NB: to note how you have to override this or whatever | ||
default_header_file_extensions = None | ||
default_source_file_extensions = None | ||
|
||
@classmethod | ||
def register_options(cls, register): | ||
super(NativeCompileSettings, cls).register_options(register) | ||
|
||
register('--strict-deps', type=bool, default=True, fingerprint=True, advanced=True, | ||
help='???/The default for the "strict_deps" argument for targets of this language.') | ||
|
||
register('--fatal-warnings', type=bool, default=True, fingerprint=True, advanced=True, | ||
help='???/The default for the "fatal_warnings" argument for targets of this language.') | ||
|
||
# TODO: make a list of file extension option type? | ||
register('--header-file-extensions', type=list, default=cls.default_header_file_extensions, | ||
fingerprint=True, advanced=True, | ||
help='???/the allowed file extensions, as a list of strings (file extensions)') | ||
register('--source-file-extensions', type=list, default=cls.default_source_file_extensions, | ||
fingerprint=True, advanced=True, | ||
help='???/the allowed file extensions, as a list of strings (file extensions)') | ||
|
||
def get_subsystem_target_mirrored_field_value(self, field_name, target): | ||
"""???/for fields with the same name on subsystems and tasks""" | ||
tgt_setting = getattr(target, field_name) | ||
if tgt_setting is None: | ||
return getattr(self.get_options(), field_name) | ||
return tgt_setting | ||
|
||
|
||
class CCompileSettings(NativeCompileSettings): | ||
options_scope = 'c-compile-settings' | ||
|
||
default_header_file_extensions = ['.h'] | ||
default_source_file_extensions = ['.c'] | ||
|
||
|
||
class CppCompileSettings(NativeCompileSettings): | ||
options_scope = 'cpp-compile-settings' | ||
|
||
default_header_file_extensions = ['.h', '.hpp', '.tpp'] | ||
default_source_file_extensions = ['.cpp', '.cxx', '.cc'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.