diff options
| author | Florian "sp1rit" <sp1rit@disroot.org> | 2025-06-11 19:10:12 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-06-23 19:59:53 +0300 |
| commit | fea9f6918a6647430f4e22ca908f074b3e93e489 (patch) | |
| tree | 102087d670e2f9b5145bccdf7ac84f1c3c10f838 /unittests | |
| parent | 19d3e4dc30bd3210eb85e29a538ad1606adef1bc (diff) | |
| download | meson-fea9f6918a6647430f4e22ca908f074b3e93e489.tar.gz | |
vala: Also add --target-glib if glib is built as subproject
Previously, meson would only check if glib was part of
target.external_dependencies and add --target-glib appropriately. This
however had the downside of meson not adding --target-glib if glib was
included as a subproject, potentially breaking otherwise builds.
Instead of checking external_dependencies, check target.added_deps for
an occurrence of 'glib-2.0' and then pick the appropriate codepath
(either from the external dependency based on version_reqs or for the
internal dependency based on the actual version, potentially downgraded
to the latest release version)
Related-to: #14694
Diffstat (limited to 'unittests')
| -rw-r--r-- | unittests/platformagnostictests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index ba2c38f75..9c5e2bd2c 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -95,6 +95,23 @@ class PlatformAgnosticTests(BasePlatformTests): testdir = os.path.join(self.unit_test_dir, '102 python without pkgconfig') self.init(testdir, override_envvars={'PKG_CONFIG': 'notfound'}) + def test_vala_target_with_internal_glib(self): + testdir = os.path.join(self.unit_test_dir, '129 vala internal glib') + for run in [{ 'version': '2.84.4', 'expected': '2.84'}, { 'version': '2.85.2', 'expected': '2.84' }]: + self.new_builddir() + self.init(testdir, extra_args=[f'-Dglib-version={run["version"]}']) + try: + with open(os.path.join(self.builddir, 'meson-info', 'intro-targets.json'), 'r', encoding='utf-8') as tgt_intro: + intro = json.load(tgt_intro) + target = list(filter(lambda tgt: tgt['name'] == 'vala-tgt', intro)) + self.assertLength(target, 1) + sources = target[0]['target_sources'] + vala_sources = filter(lambda src: src.get('language') == 'vala', sources) + for src in vala_sources: + self.assertIn(('--target-glib', run['expected']), zip(src['parameters'], src['parameters'][1:])) + except FileNotFoundError: + self.skipTest('Current backend does not produce introspection data') + def test_debug_function_outputs_to_meson_log(self): testdir = os.path.join(self.unit_test_dir, '104 debug function') log_msg = 'This is an example debug output, should only end up in debug log' |
