From bdadf5704a5459c0fb42334c66d617015eab19ea Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Tue, 12 Jun 2012 09:56:38 -0400 Subject: [PATCH] Fix the Tycho build to work on Fedora. Minor fixes of limited scope needed to have Tycho building on Fedora. Remove org.eclipse.equinox.concurrent until present in Fedora Eclipse. Tycho upstream currently depends upon 0.15.0 when building 0.16.0-SNAPSHOT, which doesn't have reactor plugin version checking. In Fedora we depend on the previously built version which has that version checking. We must keep previous build version strings different to avoid a cyclic dependency, but doing so causes the version checking to fail, so we must provide a way to disable it. Disable by default. Update to using Jetty 9 API. Add support for compact profiles (http://openjdk.java.net/jeps/161). Update to using plexus-archiver 2.6. Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814 --- .../META-INF/MANIFEST.MF | 2 +- .../tycho/p2/target/ee/CustomEEResolutionHandler.java | 2 +- .../main/java/org/eclipse/tycho/test/util/HttpServer.java | 8 ++++++-- .../tycho-bundles-external/tycho-bundles-external.product | 1 - .../tycho-standalone-p2-director/p2 Director.product | 1 - .../src/main/java/org/eclipse/tycho/core/ee/EEVersion.java | 13 ++++++++++++- .../tycho/core/maven/TychoMavenLifecycleParticipant.java | 4 +++- .../tycho/plugins/p2/director/ProductArchiverMojo.java | 9 +++------ .../eclipse/tycho/test/AbstractTychoIntegrationTest.java | 11 +++++------ 9 files changed, 31 insertions(+), 20 deletions(-) diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF index f59f155..6d3813b 100644 --- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF +++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Fragment-Host: org.eclipse.tycho.p2.maven.repository Require-Bundle: org.junit, org.eclipse.equinox.p2.publisher, org.eclipse.equinox.ds, - org.mockito + org.mockito.mockito-core Import-Package: org.eclipse.tycho.locking.facade, org.eclipse.tycho.repository.local.testutil, org.eclipse.tycho.repository.streaming.testutil, diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java index 6773a40..c66c991 100644 --- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java +++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java @@ -59,7 +59,7 @@ class CustomEEResolutionHandler extends ExecutionEnvironmentResolutionHandler { String name = capability.getName(); String version = capability.getVersion().toString(); - if (JREAction.NAMESPACE_OSGI_EE.equals(namespace)) { + if ("osgi.ee".equals(namespace)) { result.add(new SystemCapability(Type.OSGI_EE, name, version)); } else if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(namespace)) { result.add(new SystemCapability(Type.JAVA_PACKAGE, name, version)); diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java index 57b4e10..47423e5 100644 --- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java +++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java @@ -17,9 +17,13 @@ import java.util.List; import java.util.Map; import java.util.Random; +import org.eclipse.jetty.security.ConstraintMapping; +import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.security.HashLoginService; +import org.eclipse.jetty.server.AbstractNetworkConnector; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.bio.SocketConnector; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.junit.rules.ExternalResource; @@ -77,7 +81,7 @@ public class HttpServer extends ExternalResource { private static RunningServer startServerOnPort(int port) throws Exception { Server jetty = new Server(); - Connector connector = new SocketConnector(); + AbstractNetworkConnector connector = new ServerConnector(jetty); connector.setPort(port); jetty.addConnector(connector); diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product index 9f6cb78..41705c5 100644 --- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product +++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product @@ -43,7 +43,6 @@ - diff --git a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product index 6739b3a..af9237b 100644 --- a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product +++ b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product @@ -42,7 +42,6 @@ - diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/EEVersion.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/EEVersion.java index 6455a7c..4d09e34 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/EEVersion.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/EEVersion.java @@ -18,7 +18,8 @@ public class EEVersion implements Comparable { public enum EEType { // order is significant for comparison - OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JRE("JRE"), JAVA_SE("JavaSE"); + OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JRE("JRE"), JAVA_SE("JavaSE"), JAVA_SE_COMPACT1( + "JavaSE/compact1"), JAVA_SE_COMPACT2("JavaSE/compact2"), JAVA_SE_COMPACT3("JavaSE/compact3"); private final String profileName; @@ -51,6 +52,16 @@ public class EEVersion implements Comparable { * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(EEVersion other) { + // JavaSE/compact{1..3} > JavaSE-N except when N = 1.8 + final Version JAVA8 = Version.parseVersion("1.8"); + if (type.equals(EEType.JAVA_SE) && version.equals(JAVA8) + && other.type.profileName.contains("JavaSE/compact")) { + return 1; + + } else if (other.type.equals(EEType.JAVA_SE) && other.version.equals(JAVA8) + && type.profileName.contains("JavaSE/compact")) { + return -1; + } int result = type.compareTo(other.type); if (result != 0) { return result; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java index 4cc937c..59335b9 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java @@ -77,7 +77,9 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic } private void validate(List projects) throws MavenExecutionException { - validateConsistentTychoVersion(projects); + if (System.getProperty("tycho.enableVersionCheck") != null) { + validateConsistentTychoVersion(projects); + } validateUniqueBaseDirs(projects); } diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java index 6a5c967..957b737 100644 --- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java +++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java @@ -26,6 +26,7 @@ import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.tar.TarArchiver; +import org.codehaus.plexus.archiver.tar.TarArchiver.TarCompressionMethod; import org.codehaus.plexus.archiver.tar.TarLongFileMode; import org.eclipse.tycho.core.facade.TargetEnvironment; import org.eclipse.tycho.plugins.tar.TarGzArchiver; @@ -98,13 +99,9 @@ public final class ProductArchiverMojo extends AbstractProductMojo { productArchivers.put("tar.gz", new ProductArchiver() { @Override Archiver getArchiver() throws ArchiverException { - TarArchiver.TarCompressionMethod tarCompressionMethod = new TarArchiver.TarCompressionMethod(); - tarCompressionMethod.setValue("gzip"); // surprisingly, compression names are private in plexus - tarArchiver.setCompression(tarCompressionMethod); + tarArchiver.setCompression(TarCompressionMethod.gzip); // avoid lots of long file path (> 100 chars) warnings - TarLongFileMode gnuMode = new TarLongFileMode(); - gnuMode.setValue(TarLongFileMode.GNU); - tarArchiver.setLongfile(gnuMode); + tarArchiver.setLongfile(TarLongFileMode.gnu); return tarArchiver; } }); diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java index a8173df..cf2cf57 100644 --- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java +++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java @@ -110,12 +110,11 @@ public abstract class AbstractTychoIntegrationTest { verifier.getCliOptions().add(customOptions); } - if (System.getProperty(SYSPROP_STATELOCATION) != null) { - verifier.setForkJvm(false); - String m2eresolver = System.getProperty("tychodev-maven.ext.class.path"); // XXX - if (m2eresolver != null) { - verifier.addCliOption("-Dmaven.ext.class.path=" + m2eresolver); - } + String m2eState = System.getProperty("m2eclipse.workspace.state"); + String m2eResolver = System.getProperty("m2eclipse.workspace.resolver"); + + if (m2eState != null && m2eResolver != null) { + verifier.getVerifierProperties().put("m2eclipse.workspace.state", m2eState); } return verifier; -- 1.9.3