From 04f02e85d7ee73d578a6ce2e6f8578607900cec5 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Tue, 7 May 2024 10:52:49 +0200 Subject: [PATCH] Minimal reproducer test-case for #3824 Add a minimal reproducer test-case for issue https://github.com/eclipse-tycho/tycho/issues/3824 regarding the validation failure of transitive generated 'osgi.extender=osgi.component' requirements in bundles containing DS components of version 1.4. --- .../tycho-ds-dependency/.mvn/extensions.xml | 8 +++ .../tycho-ds-dependency/plugin.a/.classpath | 7 +++ .../plugin.a/META-INF/MANIFEST.MF | 6 +++ .../plugin.a/build.properties | 4 ++ .../plugin.a/src/foo/bar/MyComponent.java | 12 +++++ .../tycho-ds-dependency/plugin.b/.classpath | 7 +++ .../plugin.b/META-INF/MANIFEST.MF | 6 +++ .../plugin.b/build.properties | 2 + .../projects/tycho-ds-dependency/pom.xml | 51 +++++++++++++++++++ .../compiler/CompilerClasspathEntryTest.java | 10 ++++ 10 files changed, 113 insertions(+) create mode 100644 tycho-its/projects/tycho-ds-dependency/.mvn/extensions.xml create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.a/.classpath create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.a/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.a/build.properties create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.a/src/foo/bar/MyComponent.java create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.b/.classpath create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.b/META-INF/MANIFEST.MF create mode 100644 tycho-its/projects/tycho-ds-dependency/plugin.b/build.properties create mode 100644 tycho-its/projects/tycho-ds-dependency/pom.xml diff --git a/tycho-its/projects/tycho-ds-dependency/.mvn/extensions.xml b/tycho-its/projects/tycho-ds-dependency/.mvn/extensions.xml new file mode 100644 index 0000000000..ff2889110d --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + + org.eclipse.tycho + tycho-build + ${tycho-version} + + diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.a/.classpath b/tycho-its/projects/tycho-ds-dependency/plugin.a/.classpath new file mode 100644 index 0000000000..81fe078c20 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.a/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.a/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-ds-dependency/plugin.a/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..c68de2a3f8 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.a/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: plugin.a +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-17 +Import-Package: org.osgi.service.event;version="[1.4.0,2.0.0)" diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.a/build.properties b/tycho-its/projects/tycho-ds-dependency/plugin.a/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.a/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.a/src/foo/bar/MyComponent.java b/tycho-its/projects/tycho-ds-dependency/plugin.a/src/foo/bar/MyComponent.java new file mode 100644 index 0000000000..d7d5f90546 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.a/src/foo/bar/MyComponent.java @@ -0,0 +1,12 @@ +package foo.bar; + +import org.osgi.service.component.annotations.Component; +import org.osgi.service.event.EventHandler; +import org.osgi.service.event.Event; + +@Component(service = EventHandler.class) +public class MyComponent implements EventHandler { + @Override + public void handleEvent(Event event) { + } +} diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.b/.classpath b/tycho-its/projects/tycho-ds-dependency/plugin.b/.classpath new file mode 100644 index 0000000000..81fe078c20 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.b/META-INF/MANIFEST.MF b/tycho-its/projects/tycho-ds-dependency/plugin.b/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..4f00fc0d85 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.b/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: plugin.b +Bundle-Version: 1.0.0.qualifier +Require-Bundle: plugin.a;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-17 diff --git a/tycho-its/projects/tycho-ds-dependency/plugin.b/build.properties b/tycho-its/projects/tycho-ds-dependency/plugin.b/build.properties new file mode 100644 index 0000000000..7594fab8d5 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/plugin.b/build.properties @@ -0,0 +1,2 @@ +bin.includes = META-INF/,\ + . diff --git a/tycho-its/projects/tycho-ds-dependency/pom.xml b/tycho-its/projects/tycho-ds-dependency/pom.xml new file mode 100644 index 0000000000..b93d0c8b05 --- /dev/null +++ b/tycho-its/projects/tycho-ds-dependency/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + foo + foo + 1.0.0-SNAPSHOT + pom + + + plugin.a + plugin.b + + + + UTF-8 + + + + + platform + ${target-platform} + p2 + + + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + + org.eclipse.tycho + tycho-ds-plugin + ${tycho-version} + + 1.4 + true + + + + + + + \ No newline at end of file diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java index 757cb1718b..2e17799291 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java @@ -17,6 +17,7 @@ import java.io.File; import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.stream.Collectors; @@ -89,6 +90,15 @@ private void verifyDs(Verifier verifier) throws VerificationException { assertFalse(new File(generated, "tycho.ds.TestComponent2.xml").isFile()); } + @Test + public void testTransitiveDSComponents() throws Exception { + Verifier verifier = getVerifier("tycho-ds-dependency", true, true); + verifier.executeGoals(List.of("clean", "verify")); + verifier.verifyErrorFreeLog(); + Path generated = Path.of(verifier.getBasedir(), "plugin.a/target/classes/OSGI-INF"); + assertTrue(Files.isRegularFile(generated.resolve("foo.bar.MyComponent.xml"))); + } + @Test public void testOSGiAnnotations() throws Exception { Verifier verifier = getVerifier("compiler.annotations", false, true);