diff options
author | Benjamin Gilbert <bgilbert@backtick.net> | 2022-12-13 21:12:41 -0500 |
---|---|---|
committer | Benjamin Gilbert <bgilbert@backtick.net> | 2022-12-14 15:37:59 -0500 |
commit | 35e230e48ca42f4ccb872d1d01f9280f8015b417 (patch) | |
tree | a55a759f1f3a37e6a8d2b1f3ebd4268fc0df57c6 /unittests/machinefiletests.py | |
parent | 51c889ddbc8e83a73ef4d1f2556609bae2a046ce (diff) | |
download | meson-35e230e48ca42f4ccb872d1d01f9280f8015b417.zip meson-35e230e48ca42f4ccb872d1d01f9280f8015b417.tar.gz meson-35e230e48ca42f4ccb872d1d01f9280f8015b417.tar.bz2 |
depfixer: silence fix_jar() and make it do something
fix_jar() tries to remove an existing Class-Path entry from the jar
manifest by postprocessing the manifest and passing it to `jar -um`.
However, `jar -um` can only add/replace manifest entries, not remove
them, and it also complains loudly when replacing an entry:
Dec 13, 2022 7:11:19 PM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Manifest-Version.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Thus fix_jar() produces one such warning for each entry in the manifest
and accomplishes nothing else.
Use jar -uM instead. This completely removes the manifest from the jar
and allows adding it back as a normal zip member, fixing fix_jar() and
avoiding the warnings.
Fixes: https://github.com/mesonbuild/meson/issues/10491
Fixes: c70a051e93 ("java: remove manifest classpath from installed jar")
Diffstat (limited to 'unittests/machinefiletests.py')
-rw-r--r-- | unittests/machinefiletests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/unittests/machinefiletests.py b/unittests/machinefiletests.py index 7d75ebc..bf109b2 100644 --- a/unittests/machinefiletests.py +++ b/unittests/machinefiletests.py @@ -42,6 +42,7 @@ import mesonbuild.modules.pkgconfig from run_tests import ( + Backend, get_fake_env ) @@ -368,6 +369,23 @@ class NativeFileTests(BasePlatformTests): self._single_implementation_compiler( 'java', 'javac', 'javac 9.99.77', '9.99.77') + @skip_if_not_language('java') + def test_java_classpath(self): + if self.backend is not Backend.ninja: + raise SkipTest('Jar is only supported with Ninja') + testdir = os.path.join(self.unit_test_dir, '110 classpath') + self.init(testdir) + self.build() + one_build_path = get_classpath(os.path.join(self.builddir, 'one.jar')) + self.assertIsNone(one_build_path) + two_build_path = get_classpath(os.path.join(self.builddir, 'two.jar')) + self.assertEqual(two_build_path, 'one.jar') + self.install() + one_install_path = get_classpath(os.path.join(self.installdir, 'usr/bin/one.jar')) + self.assertIsNone(one_install_path) + two_install_path = get_classpath(os.path.join(self.installdir, 'usr/bin/two.jar')) + self.assertIsNone(two_install_path) + @skip_if_not_language('swift') def test_swift_compiler(self): wrapper = self.helper_create_binary_wrapper( |