forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
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
- also add `PythonNativeCode` subsystem to bridge the native and python backends refactor the compilation and linking pipeline to use subsystems add some notes fix rebase issues add link to pantsbuild#5788 -- maybe use variants for args for static libs move `native_source_extensions` to a new `PythonNativeCode` subsystem update native toolchain docs and remove bad old tests move tgt_closure_platforms into the new `PythonNativeCode` subsystem remove unnecessary logging remove compile_settings_class in favor of another abstractmethod refactor `NativeCompile` and add documentation improve debug logging in NativeCompile document NativeCompileSettings refactor and add docstrings convert provides= to ctypes_dylib= and add many more docstrings remove or improve TODOs improve or remove FIXMEs improve some docstrings, demote a FIXME, and add a TODO link FIXMEs to a ticket add notes to the ctypes testproject update mock object for strict deps -- test passes fix failing integration test on osx add hack to let travis pass fix the system_id key in llvm and add a shameful hack to pass travis
- Loading branch information
1 parent
0868e07
commit c80b28c
Showing
41 changed files
with
715 additions
and
591 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
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,54 @@ | ||
# 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): | ||
"""Any settings relevant to a compiler invocation.""" | ||
|
||
default_header_file_extensions = None | ||
default_source_file_extensions = None | ||
|
||
@classmethod | ||
def register_options(cls, register): | ||
super(NativeCompileSettings, cls).register_options(register) | ||
|
||
# TODO: have some more formal method of mirroring options between a target and a subsystem? | ||
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 extensions for header files, as a list of strings.') | ||
register('--source-file-extensions', type=list, default=cls.default_source_file_extensions, | ||
fingerprint=True, advanced=True, | ||
help='The allowed extensions for source files, as a list of strings.') | ||
|
||
def get_subsystem_target_mirrored_field_value(self, field_name, target): | ||
"""Get the attribute `field_name` from `target` if set, else from this subsystem's options.""" | ||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.