diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-03-10 10:52:12 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-05-25 22:41:03 -0400 |
commit | 8f68f5435dfbb2f476aaa7927399e16fdc80422e (patch) | |
tree | deb94c277e1fb3f0dba202ea50604ab36d5d0536 /mesonbuild | |
parent | bd68e8c61343b3fd108a2f5cacaa7d931b0209d0 (diff) | |
download | meson-8f68f5435dfbb2f476aaa7927399e16fdc80422e.zip meson-8f68f5435dfbb2f476aaa7927399e16fdc80422e.tar.gz meson-8f68f5435dfbb2f476aaa7927399e16fdc80422e.tar.bz2 |
interpreter: add type restrictions to declare_dependency link_whole
Including that we don't accept SharedLibraries or CustomTarget[Index]s
that are a shared library
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index e787b7a..df00ed3 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -687,10 +687,19 @@ class Interpreter(InterpreterBase, HoldableObject): for d in deps: if not isinstance(d, dependencies.Dependency): raise InterpreterException('Invalid dependency') + + dep_err = 'declare_dependency: Entries in "{}" may only be self-built targets, external dependencies (including libraries) must go to "dependencies".' + for l in libs: if isinstance(l, dependencies.Dependency): - raise InterpreterException('''Entries in "link_with" may only be self-built targets, -external dependencies (including libraries) must go to "dependencies".''') + raise InvalidArguments(dep_err.format('link_with')) + for l in libs_whole: + if isinstance(l, dependencies.Dependency): + raise InvalidArguments(dep_err.format('link_whole')) + if isinstance(l, build.SharedLibrary): + raise InvalidArguments('declare_dependency: SharedLibrary objects are not allowed in "link_whole"') + if isinstance(l, (build.CustomTarget, build.CustomTargetIndex)) and l.links_dynamically(): + raise InvalidArguments('declare_dependency: CustomTarget and CustomTargetIndex returning shared libaries are not allowed in "link_whole"') dep = dependencies.InternalDependency(version, incs, compile_args, link_args, libs, libs_whole, sources, deps, variables, d_module_versions, d_import_dirs) |