aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-10-16 14:02:53 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-12-16 12:23:23 -0800
commit7ffc678514e6d86ba7072d726f0ccc99a0ccdbc5 (patch)
treedf50d647c852359641d1244094d02fbb155143ab /mesonbuild/build.py
parentd32d0d6b53dc84e35f6b26fbcfaf23a37ab6b002 (diff)
downloadmeson-7ffc678514e6d86ba7072d726f0ccc99a0ccdbc5.zip
meson-7ffc678514e6d86ba7072d726f0ccc99a0ccdbc5.tar.gz
meson-7ffc678514e6d86ba7072d726f0ccc99a0ccdbc5.tar.bz2
build/interpreter: split representation of Headers
This was all layering violations before. Now we have Headers in the build module, and a holder in the interpreter. All of the type validation is done in interpreter method for `install_headers`.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 5b7a679..ca1d86f 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -39,6 +39,7 @@ from .interpreterbase import FeatureNew
if T.TYPE_CHECKING:
from .interpreter import Test
+ from .mesonlib import FileMode
pch_kwargs = set(['c_pch', 'cpp_pch'])
@@ -122,6 +123,34 @@ class DependencyOverride:
self.node = node
self.explicit = explicit
+class Headers:
+
+ def __init__(self, sources: T.List[File], install_subdir: T.Optional[str],
+ install_dir: T.Optional[str], install_mode: T.Optional['FileMode']):
+ self.sources = sources
+ self.install_subdir = install_subdir
+ self.custom_install_dir = install_dir
+ self.custom_install_mode = install_mode
+
+ # TODO: we really don't need any of these methods, but they're preserved to
+ # keep APIs relying on them working.
+
+ def set_install_subdir(self, subdir: str) -> None:
+ self.install_subdir = subdir
+
+ def get_install_subdir(self) -> str:
+ return self.install_subdir
+
+ def get_sources(self) -> T.List[File]:
+ return self.sources
+
+ def get_custom_install_dir(self) -> T.Optional[str]:
+ return self.custom_install_dir
+
+ def get_custom_install_mode(self) -> T.Optional['FileMode']:
+ return self.custom_install_mode
+
+
class Build:
"""A class that holds the status of one build including
all dependencies and so on.
@@ -140,7 +169,7 @@ class Build:
self.projects_link_args = PerMachine({}, {}) # type: PerMachine[T.Dict[str, T.List[str]]]
self.tests = [] # type: T.List['Test']
self.benchmarks = [] # type: T.List['Test']
- self.headers = []
+ self.headers: T.List[Headers] = []
self.man = []
self.data = []
self.static_linker = PerMachine(None, None) # type: PerMachine[StaticLinker]