Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2015-10-05 11:24:03 -0400
committerJan Sievers2015-10-05 11:24:03 -0400
commit7d1b1b863bedec59bb75308992985eea16fdcf9a (patch)
treecdea86ffbc02df127acf7596ba3ff42aaf6e7ac6
parent80f1c23819c28ff25c65683ec1a03985e2a7a665 (diff)
downloadorg.eclipse.tycho-7d1b1b863bedec59bb75308992985eea16fdcf9a.tar.gz
org.eclipse.tycho-7d1b1b863bedec59bb75308992985eea16fdcf9a.tar.xz
org.eclipse.tycho-7d1b1b863bedec59bb75308992985eea16fdcf9a.zip
Bug 463670: Fail if native mac product built against Luna or earlier
If a product with native launchers is built for MacOSX, check the version of the launcher feature org.eclipse.equinox.executables. If the detected version is pre-Mars, fail the build with a clear error message. Change-Id: I0d8fd5054e423ca9ca0d896bfa6a171270952f11 Signed-off-by: Jan Sievers <jan.sievers@sap.com>
-rw-r--r--tycho-its/projects/product.crosstalk/a.product2
-rw-r--r--tycho-its/projects/product.crosstalk/b.product2
-rw-r--r--tycho-p2/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java30
3 files changed, 31 insertions, 3 deletions
diff --git a/tycho-its/projects/product.crosstalk/a.product b/tycho-its/projects/product.crosstalk/a.product
index 601bfc535..0f3c82141 100644
--- a/tycho-its/projects/product.crosstalk/a.product
+++ b/tycho-its/projects/product.crosstalk/a.product
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product uid="product-a" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="true">
+<product uid="product-a" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="false">
<configIni use="default">
</configIni>
diff --git a/tycho-its/projects/product.crosstalk/b.product b/tycho-its/projects/product.crosstalk/b.product
index e20f14e97..a5dd98e70 100644
--- a/tycho-its/projects/product.crosstalk/b.product
+++ b/tycho-its/projects/product.crosstalk/b.product
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product uid="product-b" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="true">
+<product uid="product-b" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="false">
<configIni use="default">
</configIni>
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 417d50419..f2b729a62 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
@@ -31,13 +31,16 @@ import org.eclipse.tycho.ArtifactType;
import org.eclipse.tycho.artifacts.DependencyArtifacts;
import org.eclipse.tycho.core.maven.TychoInterpolator;
import org.eclipse.tycho.core.resolver.shared.DependencySeed;
+import org.eclipse.tycho.core.resolver.shared.PlatformPropertiesUtils;
import org.eclipse.tycho.core.shared.Interpolator;
+import org.eclipse.tycho.core.shared.TargetEnvironment;
import org.eclipse.tycho.core.utils.TychoProjectUtils;
import org.eclipse.tycho.locking.facade.FileLockService;
import org.eclipse.tycho.locking.facade.FileLocker;
import org.eclipse.tycho.model.ProductConfiguration;
import org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool;
import org.eclipse.tycho.p2.tools.publisher.facade.PublisherServiceFactory;
+import org.osgi.framework.Version;
/**
* <p>
@@ -50,6 +53,9 @@ import org.eclipse.tycho.p2.tools.publisher.facade.PublisherServiceFactory;
@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");
+
/**
* <p>
* The name of the p2 installation flavor to create. De facto, this parameter is set to
@@ -108,7 +114,7 @@ public final class PublishProductMojo extends AbstractPublishMojo {
throw new MojoExecutionException(
"Unable to locate feature 'org.eclipse.equinox.executable'. This feature is required for native product launchers.");
}
-
+ checkMacOSLauncherCompatibility(artifact);
File equinoxExecFeature = artifact.getLocation();
if (equinoxExecFeature.isDirectory()) {
return equinoxExecFeature.getAbsoluteFile();
@@ -137,4 +143,26 @@ public final class PublishProductMojo extends AbstractPublishMojo {
}
}
+ private void checkMacOSLauncherCompatibility(ArtifactDescriptor executablesFeature) throws MojoExecutionException {
+ if (!macOSConfigured()) {
+ return;
+ }
+ Version featureVersion = Version.parseVersion(executablesFeature.getKey().getVersion());
+ if (featureVersion.compareTo(MARS_EXECUTABLE_FEATURE_VERSION) < 0) {
+ throw new MojoExecutionException(
+ "Detected pre-Mars 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");
+ }
+ }
+
+ private boolean macOSConfigured() {
+ for (TargetEnvironment env : getEnvironments()) {
+ if (PlatformPropertiesUtils.OS_MACOSX.equals(env.getOs())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}

Back to the top