Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2015-10-27 08:39:40 -0400
committerJan Sievers2015-10-27 08:48:34 -0400
commit9a2c2c2f78adc50b3dfd91f84251c14c68ac6f7d (patch)
treeda14e69f404bb169b7a1ab3ead397ee647a54394
parent2fdf5d734fc260cd5a0b729526924aa16ee8935e (diff)
downloadorg.eclipse.tycho-9a2c2c2f78adc50b3dfd91f84251c14c68ac6f7d.tar.gz
org.eclipse.tycho-9a2c2c2f78adc50b3dfd91f84251c14c68ac6f7d.tar.xz
org.eclipse.tycho-9a2c2c2f78adc50b3dfd91f84251c14c68ac6f7d.zip
Bug 463670: correctly handle literal ".qualifier"tycho-0.24.0tycho-0.24.x
Detect Luna or earlier executable feature by comparing against the Luna SR2 version instead of Mars SR0. This way, a Mars version even with literal ".qualifier" will be correctly detected as Mars or later as the significant difference is already in the micro (third) digit (102 in Luna vs 200 in Mars). Change-Id: I79d177444737dc2bb4e69ff5c789184dd0dc5b30 Signed-off-by: Jan Sievers <jan.sievers@sap.com>
-rw-r--r--tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java12
-rw-r--r--tycho-p2/tycho-p2-publisher-plugin/src/test/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojoTest.java33
2 files changed, 41 insertions, 4 deletions
diff --git a/tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java b/tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
index f2b729a62..1a10ec237 100644
--- a/tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
+++ b/tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
@@ -53,8 +53,8 @@ import org.osgi.framework.Version;
@Mojo(name = "publish-products", defaultPhase = LifecyclePhase.PACKAGE)
public final class PublishProductMojo extends AbstractPublishMojo {
- // as per http://download.eclipse.org/releases/mars/201506241002/features/org.eclipse.equinox.executable_3.6.200.v20150602-1417.jar
- private static final Version MARS_EXECUTABLE_FEATURE_VERSION = Version.parseVersion("3.6.200.v20150602-1417");
+ // as per http://download.eclipse.org/releases/luna/201502271000/features/org.eclipse.equinox.executable_3.6.102.v20150204-1316.jar
+ private static final Version LUNA_SR2_EXECUTABLE_FEATURE_VERSION = Version.parseVersion("3.6.102.v20150204-1316");
/**
* <p>
@@ -148,14 +148,18 @@ public final class PublishProductMojo extends AbstractPublishMojo {
return;
}
Version featureVersion = Version.parseVersion(executablesFeature.getKey().getVersion());
- if (featureVersion.compareTo(MARS_EXECUTABLE_FEATURE_VERSION) < 0) {
+ if (isLunaOrOlder(featureVersion)) {
throw new MojoExecutionException(
- "Detected pre-Mars launcher feature org.eclipse.equinox.executable version " + featureVersion
+ "Detected Luna or older launcher feature org.eclipse.equinox.executable version " + featureVersion
+ ".\n Native product launchers for MacOSX can only be built against Eclipse Mars or newer."
+ "\nTo fix this, you can either build against Eclipse Mars or newer (recommended) or go back to Tycho <= 0.22.0");
}
}
+ static boolean isLunaOrOlder(Version featureVersion) {
+ return featureVersion.compareTo(LUNA_SR2_EXECUTABLE_FEATURE_VERSION) <= 0;
+ }
+
private boolean macOSConfigured() {
for (TargetEnvironment env : getEnvironments()) {
if (PlatformPropertiesUtils.OS_MACOSX.equals(env.getOs())) {
diff --git a/tycho-p2/tycho-p2-publisher-plugin/src/test/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojoTest.java b/tycho-p2/tycho-p2-publisher-plugin/src/test/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojoTest.java
new file mode 100644
index 000000000..f927979f2
--- /dev/null
+++ b/tycho-p2/tycho-p2-publisher-plugin/src/test/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojoTest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2015 SAP SE and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP SE - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.plugins.p2.publisher;
+
+import static org.eclipse.tycho.plugins.p2.publisher.PublishProductMojo.isLunaOrOlder;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+public class PublishProductMojoTest {
+
+ @Test
+ public void testIsLunaOrOlder() throws Exception {
+ Version lunaSR2Version = Version.parseVersion("3.6.102.v20150204-1316");
+ assertTrue(isLunaOrOlder(lunaSR2Version));
+ Version lunaSR0Version = Version.parseVersion("3.6.100.v20140603-1326");
+ assertTrue(isLunaOrOlder(lunaSR0Version));
+ Version marsSR0Version = Version.parseVersion("3.6.200.v20150602-1417");
+ assertFalse(isLunaOrOlder(marsSR0Version));
+ Version marsLiteralQualifierVersion = Version.parseVersion("3.6.200.qualifier");
+ assertFalse(isLunaOrOlder(marsLiteralQualifierVersion));
+ }
+}

Back to the top