Skip to content

Commit fe1a224

Browse files
committed
Bug: 5047 added test to reproduce issue
1 parent e20ff1c commit fe1a224

10 files changed

Lines changed: 175 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>packaging.buildtimestamp</groupId>
8+
<artifactId>packaging.buildtimestamp.parent</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<groupId>packaging.buildtimestamp</groupId>
13+
<artifactId>packaging.buildtimestamp.mavenplugin</artifactId>
14+
<version>1.0.0-SNAPSHOT</version>
15+
<packaging>jar</packaging>
16+
17+
<properties>
18+
<theBuildTimestamp>${maven.build.timestamp}</theBuildTimestamp>
19+
</properties>
20+
21+
22+
<build>
23+
<resources>
24+
<resource>
25+
<directory>src/main/resources</directory>
26+
<filtering>true</filtering>
27+
</resource>
28+
</resources>
29+
</build>
30+
31+
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
${theBuildTimestamp}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bundle-ManifestVersion: 2
2+
Bundle-SymbolicName: packaging.buildtimestamp.plugin01;singleton:=true
3+
Bundle-Version: 1.0.0.qualifier
4+
Bundle-ClassPath: .
5+
Bundle-Name: packaging.buildtimestamp.plugin01
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin.includes = META-INF/,\
2+
.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>packaging.buildtimestamp</groupId>
8+
<artifactId>packaging.buildtimestamp.parent</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<groupId>packaging.buildtimestamp</groupId>
13+
<artifactId>packaging.buildtimestamp.plugin01</artifactId>
14+
<version>1.0.0-SNAPSHOT</version>
15+
<packaging>eclipse-plugin</packaging>
16+
17+
</project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bundle-ManifestVersion: 2
2+
Bundle-SymbolicName: packaging.buildtimestamp.plugin02;singleton:=true
3+
Bundle-Version: 1.0.1.qualifier
4+
Bundle-ClassPath: .
5+
Bundle-Name: packaging.buildtimestamp.plugin02
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin.includes = META-INF/,\
2+
.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>packaging.buildtimestamp</groupId>
8+
<artifactId>packaging.buildtimestamp.parent</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<groupId>packaging.buildtimestamp</groupId>
13+
<artifactId>packaging.buildtimestamp.plugin02</artifactId>
14+
<version>1.0.1-SNAPSHOT</version>
15+
<packaging>eclipse-plugin</packaging>
16+
17+
</project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>packaging.buildtimestamp</groupId>
7+
<artifactId>packaging.buildtimestamp.parent</artifactId>
8+
<version>1.0.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<maven.build.timestamp.format>yyyyMMddHHmmssSSS</maven.build.timestamp.format>
13+
</properties>
14+
15+
<modules>
16+
<module>plugin01</module>
17+
<module>plugin02</module>
18+
<module>mavenPlugin</module>
19+
</modules>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<groupId>org.eclipse.tycho</groupId>
25+
<artifactId>tycho-maven-plugin</artifactId>
26+
<version>${tycho-version}</version>
27+
<extensions>true</extensions>
28+
</plugin>
29+
<plugin>
30+
<groupId>org.eclipse.tycho</groupId>
31+
<artifactId>tycho-packaging-plugin</artifactId>
32+
<version>${tycho-version}</version>
33+
<configuration>
34+
<forceContextQualifier>1</forceContextQualifier>
35+
</configuration>
36+
</plugin>
37+
</plugins>
38+
</build>
39+
40+
</project>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016, 2021 Bachmann electronic GmbH. and others.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License 2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Bachmann electronic GmbH. - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.tycho.test.packaging;
14+
15+
import java.io.File;
16+
import java.nio.file.Files;
17+
import java.nio.file.Paths;
18+
19+
import org.apache.maven.it.Verifier;
20+
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
21+
import org.junit.Assert;
22+
import org.junit.Test;
23+
24+
/**
25+
* This test uses a project that contains 3 plugins (2 eclipse-plugins and one
26+
* maven plugin). The maven plugin contains a text file where the
27+
* maven.build.buildtimestamp is written to. It compares the content of that
28+
* file with the qualifier of the Bundle-Version in the eclipse plugins manifest
29+
* files.
30+
*
31+
* The test is ensuring qualifier to be presented
32+
*/
33+
public class DefaultBuildSimpleQualifierTest extends AbstractTychoIntegrationTest {
34+
35+
@Test
36+
public void testDefaulBuildTimestampIsTheMavenBuildTimestamp() throws Exception {
37+
Verifier verifier = getVerifier("/packaging.buildsimplequalifier", false);
38+
verifier.executeGoal("verify");
39+
verifier.verifyErrorFreeLog();
40+
File baseDir = new File(verifier.getBasedir());
41+
42+
String plugin1Manifest = Files.readString(Paths.get(baseDir.getAbsolutePath(), "plugin01/target/MANIFEST.MF"));
43+
String plugin2Manifest = Files.readString(Paths.get(baseDir.getAbsolutePath(), "plugin02/target/MANIFEST.MF"));
44+
String expectedBundle1Version = "Bundle-Version: 1.0.0.1";
45+
String expectedBundle2Version = "Bundle-Version: 1.0.1.1";
46+
Assert.assertTrue(
47+
"Expected Bundle-Version in MANIFEST: '" + expectedBundle1Version + "'\nbut was\n" + plugin1Manifest,
48+
plugin1Manifest.contains(expectedBundle1Version));
49+
50+
Assert.assertTrue(
51+
"Expected Bundle-Version in MANIFEST: '" + expectedBundle2Version + "'\nbut was\n" + plugin2Manifest,
52+
plugin2Manifest.contains(expectedBundle2Version));
53+
}
54+
55+
}

0 commit comments

Comments
 (0)