diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2018-12-30 11:31:03 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-01-06 12:19:31 +0100 |
commit | 5c39dd0668ffe301aee66453b86591bbdb29a954 (patch) | |
tree | 729d3b6d5492b0d0c6ad90f4e3b18b7b4c943352 /mesonbuild | |
parent | 1268597df590413539099f0f3797fae7bcb5c09a (diff) | |
download | meson-5c39dd0668ffe301aee66453b86591bbdb29a954.zip meson-5c39dd0668ffe301aee66453b86591bbdb29a954.tar.gz meson-5c39dd0668ffe301aee66453b86591bbdb29a954.tar.bz2 |
Doc updates and throw if no target type is set
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/backends.py | 8 | ||||
-rw-r--r-- | mesonbuild/build.py | 15 |
2 files changed, 9 insertions, 14 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index b3b6df9..0291e7e 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1183,10 +1183,4 @@ class Backend: 'generated_sources': [] }] - return [{ - 'language': 'unknown', - 'compiler': [], - 'parameters': [], - 'sources': [], - 'generated_sources': [] - }] + return [] diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 642c2d5..5a243a4 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -345,7 +345,8 @@ a hard error in the future.''' % name) self.install = False self.build_always_stale = False self.option_overrides = {} - self.typename = 'unknown target' + if not hasattr(self, 'typename'): + raise RuntimeError('Target type is not set for target class "{}". This is a bug'.format(type(self).__name__)) def get_install_dir(self, environment): # Find the installation directory. @@ -1365,10 +1366,10 @@ class Executable(BuildTarget): known_kwargs = known_exe_kwargs def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): + self.typename = 'executable' 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'): @@ -1455,10 +1456,10 @@ class StaticLibrary(BuildTarget): known_kwargs = known_stlib_kwargs def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): + self.typename = 'static library' 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: @@ -1515,6 +1516,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 @@ -1527,7 +1529,6 @@ class SharedLibrary(BuildTarget): # The import library that GCC would generate (and prefer) self.gcc_import_filename = None super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs) - self.typename = 'shared library' if 'rust' in self.compilers: # If no crate type is specified, or it's the generic lib type, use dylib if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'lib': @@ -1850,8 +1851,8 @@ class CustomTarget(Target): ]) def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False): - super().__init__(name, subdir, subproject, False) self.typename = 'custom' + super().__init__(name, subdir, subproject, False) self.dependencies = [] self.extra_depends = [] self.depend_files = [] # Files that this target depends on but are not on the command line. @@ -2092,8 +2093,8 @@ class CustomTarget(Target): class RunTarget(Target): def __init__(self, name, command, args, dependencies, subdir, subproject): - super().__init__(name, subdir, subproject, False) self.typename = 'run' + super().__init__(name, subdir, subproject, False) self.command = command self.args = args self.dependencies = dependencies @@ -2130,6 +2131,7 @@ class Jar(BuildTarget): known_kwargs = known_jar_kwargs def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): + self.typename = 'jar' super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs) for s in self.sources: if not s.endswith('.java'): @@ -2137,7 +2139,6 @@ 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', []) |