aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2018-11-28 19:40:16 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-01-06 12:19:28 +0100
commita5be893b19daf9e1f08eacc5d7f01389f6e40956 (patch)
tree1497e3a6e6d0d3efc172160f99306852ccc73ca4 /mesonbuild/build.py
parent74274e23ca42260e9be24c3cfaf7550c6c1505d2 (diff)
downloadmeson-a5be893b19daf9e1f08eacc5d7f01389f6e40956.zip
meson-a5be893b19daf9e1f08eacc5d7f01389f6e40956.tar.gz
meson-a5be893b19daf9e1f08eacc5d7f01389f6e40956.tar.bz2
Some code cleanup
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 5d0fefa..1054451 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -345,6 +345,7 @@ a hard error in the future.''' % name)
self.install = False
self.build_always_stale = False
self.option_overrides = {}
+ self.typename = 'unknown target'
def get_install_dir(self, environment):
# Find the installation directory.
@@ -366,6 +367,9 @@ a hard error in the future.''' % name)
def get_subdir(self):
return self.subdir
+ def get_typename(self):
+ return self.typename
+
@staticmethod
def _get_id_hash(target_id):
# We don't really need cryptographic security here.
@@ -1364,6 +1368,7 @@ class Executable(BuildTarget):
if 'pie' not in kwargs and 'b_pie' in environment.coredata.base_options:
kwargs['pie'] = environment.coredata.base_options['b_pie'].value
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
+ self.typename = 'executable'
# Unless overridden, executables have no suffix or prefix. Except on
# Windows and with C#/Mono executables where the suffix is 'exe'
if not hasattr(self, 'prefix'):
@@ -1453,6 +1458,7 @@ class StaticLibrary(BuildTarget):
if 'pic' not in kwargs and 'b_staticpic' in environment.coredata.base_options:
kwargs['pic'] = environment.coredata.base_options['b_staticpic'].value
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
+ self.typename = 'static library'
if 'cs' in self.compilers:
raise InvalidArguments('Static libraries not supported for C#.')
if 'rust' in self.compilers:
@@ -1509,6 +1515,7 @@ class SharedLibrary(BuildTarget):
known_kwargs = known_shlib_kwargs
def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs):
+ self.typename = 'shared library'
self.soversion = None
self.ltversion = None
# Max length 2, first element is compatibility_version, second is current_version
@@ -1817,6 +1824,7 @@ class SharedModule(SharedLibrary):
if 'soversion' in kwargs:
raise MesonException('Shared modules must not specify the soversion kwarg.')
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
+ self.typename = 'shared module'
def get_default_install_dir(self, environment):
return environment.get_shared_module_dir()
@@ -1843,6 +1851,7 @@ class CustomTarget(Target):
def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False):
super().__init__(name, subdir, subproject, False)
+ self.typename = 'custom'
self.dependencies = []
self.extra_depends = []
self.depend_files = [] # Files that this target depends on but are not on the command line.
@@ -2084,6 +2093,7 @@ class CustomTarget(Target):
class RunTarget(Target):
def __init__(self, name, command, args, dependencies, subdir, subproject):
super().__init__(name, subdir, subproject, False)
+ self.typename = 'run'
self.command = command
self.args = args
self.dependencies = dependencies
@@ -2124,6 +2134,7 @@ class Jar(BuildTarget):
for t in self.link_targets:
if not isinstance(t, Jar):
raise InvalidArguments('Link target %s is not a jar target.' % t)
+ self.typename = 'jar'
self.filename = self.name + '.jar'
self.outputs = [self.filename]
self.java_args = kwargs.get('java_args', [])
@@ -2160,6 +2171,7 @@ class CustomTargetIndex:
"""
def __init__(self, target, output):
+ self.typename = 'custom'
self.target = target
self.output = output