Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-10-23 11:20:19 +0000
committerAlexander Kurtakov2019-10-23 11:58:59 +0000
commitf41bfb7ef08cd5dde36d1dcd6380765c6fe4847c (patch)
treeeab9cc53fb111d9cd41d5bcecb6c6ff7804fa745
parent2e4ff33a4120812c2f235f6fab1b2e5b16e2e26a (diff)
downloadorg.eclipse.tycho.extras-f41bfb7ef08cd5dde36d1dcd6380765c6fe4847c.tar.gz
org.eclipse.tycho.extras-f41bfb7ef08cd5dde36d1dcd6380765c6fe4847c.tar.xz
org.eclipse.tycho.extras-f41bfb7ef08cd5dde36d1dcd6380765c6fe4847c.zip
Bug 552346 - Pomless builds show incorrect project names after update to
1.5.0 Fix bundles reading. Accompanied by tests. Change-Id: I6b0adb9f5d12509254c4e653b8bb231d481cc900 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoBundleMapping.java5
-rw-r--r--tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java29
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle1/META-INF/MANIFEST.MF1
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle2/META-INF/MANIFEST.MF7
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle2/build.properties2
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle2/plugin.properties1
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle3/META-INF/MANIFEST.MF6
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle3/OSGI-INF/l10n/bundle.properties1
-rw-r--r--tycho-pomless/src/test/resources/testpomless/bundle3/build.properties2
9 files changed, 52 insertions, 2 deletions
diff --git a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoBundleMapping.java b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoBundleMapping.java
index 8394a03..d450750 100644
--- a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoBundleMapping.java
+++ b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoBundleMapping.java
@@ -149,14 +149,14 @@ public class TychoBundleMapping extends AbstractTychoMapping {
throws IOException {
String location = headers.getValue("Bundle-Localization");
if (location == null || location.isEmpty()) {
- location = "OSGI-INF/l10n/bundle.properties";
+ location = "OSGI-INF/l10n/bundle";
}
String rawValue = headers.getValue(attributeName);
if (rawValue != null && !rawValue.isEmpty()) {
if (rawValue.startsWith("%")) {
String key = rawValue.substring(1);
//we always use the default here to have consistent build regardless of locale settings
- File l10nFile = new File(manifestFile.getParentFile().getParentFile(), location);
+ File l10nFile = new File(manifestFile.getParentFile().getParentFile(), location + ".properties");
if (l10nFile.exists()) {
Properties properties = new Properties();
try (InputStream stream = new FileInputStream(l10nFile)) {
@@ -169,6 +169,7 @@ public class TychoBundleMapping extends AbstractTychoMapping {
}
return key;
}
+ return rawValue;
}
return null;
}
diff --git a/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java b/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java
index 0c220de..e83153f 100644
--- a/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java
+++ b/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java
@@ -39,6 +39,7 @@ public class TychoModelReaderTest extends PlexusTestCase {
createReaderOptions(buildProperties));
assertEquals("4.0.0", model.getModelVersion());
assertEquals("pomless.bundle", model.getArtifactId());
+ assertEquals("Pomless Bundle", model.getName());
assertEquals("0.1.0-SNAPSHOT", model.getVersion());
assertEquals("eclipse-plugin", model.getPackaging());
assertParent(model.getParent());
@@ -46,6 +47,34 @@ public class TychoModelReaderTest extends PlexusTestCase {
}
@Test
+ public void testReadBundle2() throws Exception {
+ File buildProperties = new File(getPolyglotTestDir(), "bundle2/" + TychoBundleMapping.MANIFEST_MF_MARKER);
+ Model model = getTychoModelReader(TychoBundleMapping.PACKAGING).read(buildProperties,
+ createReaderOptions(buildProperties));
+ assertEquals("4.0.0", model.getModelVersion());
+ assertEquals("pomless.bundle", model.getArtifactId());
+ assertEquals("Pomless Bundle", model.getName());
+ assertEquals("0.1.0-SNAPSHOT", model.getVersion());
+ assertEquals("eclipse-plugin", model.getPackaging());
+ assertParent(model.getParent());
+ assertLocation("bundle2/META-INF/MANIFEST.MF", model.getLocation(""));
+ }
+
+ @Test
+ public void testReadBundle3() throws Exception {
+ File buildProperties = new File(getPolyglotTestDir(), "bundle3/" + TychoBundleMapping.MANIFEST_MF_MARKER);
+ Model model = getTychoModelReader(TychoBundleMapping.PACKAGING).read(buildProperties,
+ createReaderOptions(buildProperties));
+ assertEquals("4.0.0", model.getModelVersion());
+ assertEquals("pomless.bundle", model.getArtifactId());
+ assertEquals("Pomless Bundle", model.getName());
+ assertEquals("0.1.0-SNAPSHOT", model.getVersion());
+ assertEquals("eclipse-plugin", model.getPackaging());
+ assertParent(model.getParent());
+ assertLocation("bundle3/META-INF/MANIFEST.MF", model.getLocation(""));
+ }
+
+ @Test
public void testReadTestBundle() throws Exception {
File buildProperties = new File(getPolyglotTestDir(), "bundle1.tests/" + TychoBundleMapping.MANIFEST_MF_MARKER);
Model model = getTychoModelReader(TychoBundleMapping.PACKAGING).read(buildProperties,
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle1/META-INF/MANIFEST.MF b/tycho-pomless/src/test/resources/testpomless/bundle1/META-INF/MANIFEST.MF
index 390c98c..96e8b4f 100644
--- a/tycho-pomless/src/test/resources/testpomless/bundle1/META-INF/MANIFEST.MF
+++ b/tycho-pomless/src/test/resources/testpomless/bundle1/META-INF/MANIFEST.MF
@@ -2,4 +2,5 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: pomless.bundle;singleton:=true
Bundle-Version: 0.1.0.qualifier
+Bundle-Name: Pomless Bundle
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle2/META-INF/MANIFEST.MF b/tycho-pomless/src/test/resources/testpomless/bundle2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..280c646
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle2/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: pomless.bundle;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle2/build.properties b/tycho-pomless/src/test/resources/testpomless/bundle2/build.properties
new file mode 100644
index 0000000..c45bfb5
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle2/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/,.
+source.. = src/
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle2/plugin.properties b/tycho-pomless/src/test/resources/testpomless/bundle2/plugin.properties
new file mode 100644
index 0000000..6682759
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle2/plugin.properties
@@ -0,0 +1 @@
+pluginName = Pomless Bundle \ No newline at end of file
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle3/META-INF/MANIFEST.MF b/tycho-pomless/src/test/resources/testpomless/bundle3/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..adebc14
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle3/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: pomless.bundle;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Name: %pluginName
+
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle3/OSGI-INF/l10n/bundle.properties b/tycho-pomless/src/test/resources/testpomless/bundle3/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..6682759
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle3/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1 @@
+pluginName = Pomless Bundle \ No newline at end of file
diff --git a/tycho-pomless/src/test/resources/testpomless/bundle3/build.properties b/tycho-pomless/src/test/resources/testpomless/bundle3/build.properties
new file mode 100644
index 0000000..c45bfb5
--- /dev/null
+++ b/tycho-pomless/src/test/resources/testpomless/bundle3/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/,.
+source.. = src/

Back to the top