diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-07-01 18:14:34 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-01 18:14:34 +0300 |
| commit | 026e386ec2bd79fbf4fcd21e93df19c5a22f3ebf (patch) | |
| tree | ce997fb9df71fa4463f746c1c787168147839392 /test cases | |
| parent | 14cc2efcfef9a404498b3532ffa8130cc092f6f6 (diff) | |
| parent | 576493982da325a739f04e5455ef0643b49d94f1 (diff) | |
| download | meson-026e386ec2bd79fbf4fcd21e93df19c5a22f3ebf.tar.gz | |
Merge pull request #6902 from xclaesse/auto-fallback
Implicit dependency fallback when a subproject wrap or dir exists
Diffstat (limited to 'test cases')
12 files changed, 83 insertions, 4 deletions
diff --git a/test cases/common/102 subproject subdir/meson.build b/test cases/common/102 subproject subdir/meson.build index 8299a371f..a891ca992 100644 --- a/test cases/common/102 subproject subdir/meson.build +++ b/test cases/common/102 subproject subdir/meson.build @@ -25,3 +25,32 @@ dependency('sub-novar', fallback : 'sub_novar') # Verify a subproject can force a dependency to be not-found d = dependency('sub-notfound', fallback : 'sub_novar', required : false) assert(not d.found(), 'Dependency should be not-found') + +# Verify that implicit fallback works because subprojects/sub_implicit directory exists +d = dependency('sub_implicit') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `dependency_names=sub_implicit_provide1` and the subproject overrides sub_implicit_provide1. +d = dependency('sub_implicit_provide1') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `sub_implicit_provide2=sub_implicit_provide2_dep` and does not override +# sub_implicit_provide2. +d = dependency('sub_implicit_provide2') +assert(d.found(), 'Should implicitly fallback') + +# sub_implicit.wrap provides glib-2.0 and we already configured that subproject, +# so we must not return the system dependency here. Using glib-2.0 here because +# some CI runners have it installed. +d = dependency('glib-2.0', required : false) +assert(d.found()) +assert(d.type_name() == 'internal') + +# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject, +# so we must not return the system dependency here. But since the subproject did +# not override that dependency and its not required, not-found should be returned. +# Using gobject-2.0 here because some CI runners have it installed. +d = dependency('gobject-2.0', required : false) +assert(not d.found()) diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap new file mode 100644 index 000000000..a809c43b1 --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap @@ -0,0 +1,6 @@ +[wrap-file] + +[provide] +glib-2.0 = glib_dep +dependency_names = sub_implicit_provide1, gobject-2.0 +sub_implicit_provide2 = sub_implicit_provide2_dep diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build new file mode 100644 index 000000000..24609ae09 --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build @@ -0,0 +1,11 @@ +project('sub_implicit', 'c', version : '1.0') + +dep = declare_dependency() +meson.override_dependency('sub_implicit', dep) +meson.override_dependency('sub_implicit_provide1', dep) + +# This one is not overriden but the wrap file tells the variable name to use. +sub_implicit_provide2_dep = dep + +# This one is not overriden but the wrap file tells the variable name to use. +glib_dep = dep diff --git a/test cases/common/187 find override/meson.build b/test cases/common/187 find override/meson.build index 3b8af8091..b27745905 100644 --- a/test cases/common/187 find override/meson.build +++ b/test cases/common/187 find override/meson.build @@ -10,3 +10,6 @@ if not gencodegen.found() endif subdir('otherdir') + +tool = find_program('sometool') +assert(tool.found()) diff --git a/test cases/common/187 find override/subprojects/sub.wrap b/test cases/common/187 find override/subprojects/sub.wrap new file mode 100644 index 000000000..17aa3323f --- /dev/null +++ b/test cases/common/187 find override/subprojects/sub.wrap @@ -0,0 +1,5 @@ +[wrap-file] +directory = sub + +[provide] +program_names = sometool diff --git a/test cases/common/187 find override/subprojects/sub/meson.build b/test cases/common/187 find override/subprojects/sub/meson.build new file mode 100644 index 000000000..640f2704c --- /dev/null +++ b/test cases/common/187 find override/subprojects/sub/meson.build @@ -0,0 +1,4 @@ +project('tools') + +exe = find_program('gencodegen') +meson.override_find_program('sometool', exe) diff --git a/test cases/failing/106 fallback consistency/meson.build b/test cases/failing/106 fallback consistency/meson.build new file mode 100644 index 000000000..1b007f5c8 --- /dev/null +++ b/test cases/failing/106 fallback consistency/meson.build @@ -0,0 +1,3 @@ +project('fallback consistency') + +dependency('foo') diff --git a/test cases/failing/106 fallback consistency/subprojects/foo.wrap b/test cases/failing/106 fallback consistency/subprojects/foo.wrap new file mode 100644 index 000000000..28055d958 --- /dev/null +++ b/test cases/failing/106 fallback consistency/subprojects/foo.wrap @@ -0,0 +1,6 @@ +[wrap-file] +source_url = http://host.invalid/foo.tar.gz +source_filename = foo.tar.gz + +[provide] +foo = bar_dep diff --git a/test cases/failing/106 fallback consistency/subprojects/foo/meson.build b/test cases/failing/106 fallback consistency/subprojects/foo/meson.build new file mode 100644 index 000000000..fb58a4ab3 --- /dev/null +++ b/test cases/failing/106 fallback consistency/subprojects/foo/meson.build @@ -0,0 +1,6 @@ +project('sub') + +foo_dep = declare_dependency() +meson.override_dependency('foo', foo_dep) + +bar_dep = declare_dependency() diff --git a/test cases/failing/106 fallback consistency/test.json b/test cases/failing/106 fallback consistency/test.json new file mode 100644 index 000000000..af1a42973 --- /dev/null +++ b/test cases/failing/106 fallback consistency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/106 fallback consistency/meson.build:3:0: ERROR: Inconsistency: Subproject has overridden the dependency with another variable than 'bar_dep'" + } + ] +} diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build index 94f424deb..164e679c4 100644 --- a/test cases/linuxlike/5 dependency versions/meson.build +++ b/test cases/linuxlike/5 dependency versions/meson.build @@ -31,10 +31,10 @@ dependency('somebrokenlib', version : '>=1.0', required : false) # Search for an external dependency that won't be found, but must later be # found via fallbacks -somelibnotfound = dependency('somelib', required : false) +somelibnotfound = dependency('somelib1', required : false) assert(somelibnotfound.found() == false, 'somelibnotfound was found?') # Find internal dependency without version -somelibver = dependency('somelib', +somelibver = dependency('somelib1', fallback : ['somelibnover', 'some_dep']) assert(somelibver.type_name() == 'internal', 'somelibver should be of type "internal", not ' + somelibver.type_name()) # Find an internal dependency again with the same name and a specific version diff --git a/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap b/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap index 09ba4e87f..11b217878 100644 --- a/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap +++ b/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap @@ -1,2 +1 @@ -The contents of this wrap file are never evaluated so they -can be anything. +[wrap-file] |
