Skip to content

Commit

Permalink
Minimal reproducer test-case for eclipse-tycho#3824
Browse files Browse the repository at this point in the history
Add a minimal reproducer test-case for issue
eclipse-tycho#3824

regarding the validation failure of transitive generated
'osgi.extender=osgi.component' requirements in bundles containing DS
components of version 1.4.
  • Loading branch information
HannesWell authored and laeubi committed May 31, 2024
1 parent 3fa8b30 commit 04f02e8
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tycho-its/projects/tycho-ds-dependency/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-build</artifactId>
<version>${tycho-version}</version>
</extension>
</extensions>
7 changes: 7 additions & 0 deletions tycho-its/projects/tycho-ds-dependency/plugin.a/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -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)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -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) {
}
}
7 changes: 7 additions & 0 deletions tycho-its/projects/tycho-ds-dependency/plugin.b/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.includes = META-INF/,\
.
51 changes: 51 additions & 0 deletions tycho-its/projects/tycho-ds-dependency/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>foo</groupId>
<artifactId>foo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>plugin.a</module>
<module>plugin.b</module>
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>platform</id>
<url>${target-platform}</url>
<layout>p2</layout>
</repository>
</repositories>

<build>
<plugins>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-ds-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<dsVersion>1.4</dsVersion>
<enabled>true</enabled>
</configuration>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 04f02e8

Please sign in to comment.