From c26ae38c86a8d8084323214326518795bdfc9417 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. (skipTychoVersionCheck) As of Eclipse Kepler, the bundle 'org.junit4' is no longer provided. Packages requiring JUnit 4 must use proper versioning on 'org.junit'. Update to using Jetty 9 API. Fix to build with Plexus Compiler 2.2 API. Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814 --- pom.xml | 9 ++--- tycho-artifactcomparator/pom.xml | 4 +-- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../p2/target/ee/CustomEEResolutionHandler.java | 2 +- .../org/eclipse/tycho/test/util/HttpServer.java | 5 +-- .../tycho-bundles-external.product | 1 - .../p2 Director.product | 1 - tycho-compiler-jdt/pom.xml | 4 --- .../eclipse/tycho/compiler/jdt/JDTCompiler.java | 40 ++++++++++++---------- .../apache/maven/plugin/AbstractCompilerMojo.java | 6 ++-- .../maven/plugin/CompilationFailureException.java | 4 +-- .../core/maven/TychoMavenLifecycleParticipant.java | 4 ++- .../tycho/test/AbstractTychoIntegrationTest.java | 11 +++--- .../tycho/testing/EmptyLifecycleExecutor.java | 8 +++++ 15 files changed, 52 insertions(+), 51 deletions(-) diff --git a/pom.xml b/pom.xml index 5776b0e..0aa43ea 100644 --- a/pom.xml +++ b/pom.xml @@ -208,12 +208,12 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \ org.codehaus.plexus plexus-compiler-api - 1.8.1 + 2.2 org.codehaus.plexus plexus-compiler-manager - 1.8.1 + 2.2 org.eclipse.tycho @@ -226,11 +226,6 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \ ${jdtVersion} - org.eclipse.tycho - org.eclipse.jdt.compiler.apt - ${jdtAptVersion} - - org.apache.maven.surefire surefire-booter 2.10 diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml index 27e15a9..5fa695c 100644 --- a/tycho-artifactcomparator/pom.xml +++ b/tycho-artifactcomparator/pom.xml @@ -24,7 +24,7 @@ org.ow2.asm - asm-debug-all + asm-all 4.0 @@ -54,4 +54,4 @@ - \ No newline at end of file + 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 e65eb5b..fc38d0c 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 @@ -6,7 +6,7 @@ Bundle-Version: 0.17.0.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.5 Fragment-Host: org.eclipse.tycho.p2.maven.repository -Require-Bundle: org.junit4;bundle-version="4.8.1", +Require-Bundle: org.junit;bundle-version="4.8.1", org.eclipse.equinox.p2.publisher;bundle-version="1.2.0", org.eclipse.equinox.ds;bundle-version="1.4.0", org.eclipse.tycho.p2.resolver.impl diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/META-INF/MANIFEST.MF b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/META-INF/MANIFEST.MF index 80be496..0af92d6 100644 --- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/META-INF/MANIFEST.MF +++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.tycho.p2.resolver.impl.test;singleton:=true Bundle-Version: 0.17.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Fragment-Host: org.eclipse.tycho.p2.resolver.impl -Require-Bundle: org.junit4, +Require-Bundle: org.junit, org.eclipse.equinox.ds, org.eclipse.equinox.p2.transport.ecf Bundle-ActivationPolicy: lazy 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 87c9e11..927cea5 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 1a27b00..eb110dc 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 @@ -20,9 +20,10 @@ 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.eclipse.jetty.util.security.Constraint; @@ -68,7 +69,7 @@ public class HttpServer { private static HttpServer doStartServer(String username, String password, int port) throws Exception { Server server = new Server(); - Connector connector = new SocketConnector(); + AbstractNetworkConnector connector = new ServerConnector(server); connector.setPort(port); server.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 dea801e..4733ad0 100644 --- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product +++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product @@ -41,7 +41,6 @@ - diff --git a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product index dd80b5e..797b4ba 100644 --- a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product +++ b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product @@ -41,7 +41,6 @@ - diff --git a/tycho-compiler-jdt/pom.xml b/tycho-compiler-jdt/pom.xml index 9872fd7..8a12fde 100644 --- a/tycho-compiler-jdt/pom.xml +++ b/tycho-compiler-jdt/pom.xml @@ -38,10 +38,6 @@ org.eclipse.jdt.core - org.eclipse.tycho - org.eclipse.jdt.compiler.apt - - org.codehaus.plexus plexus-compiler-api diff --git a/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java b/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java index f87983d..d5b1ca7 100644 --- a/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java +++ b/tycho-compiler-jdt/src/main/java/org/eclipse/tycho/compiler/jdt/JDTCompiler.java @@ -28,9 +28,10 @@ import java.util.regex.Pattern; import org.codehaus.plexus.compiler.AbstractCompiler; import org.codehaus.plexus.compiler.CompilerConfiguration; -import org.codehaus.plexus.compiler.CompilerError; +import org.codehaus.plexus.compiler.CompilerMessage; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerOutputStyle; +import org.codehaus.plexus.compiler.CompilerResult; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.cli.CommandLineException; @@ -69,7 +70,7 @@ public class JDTCompiler extends AbstractCompiler { // Compiler Implementation // ---------------------------------------------------------------------- - public List compile(CompilerConfiguration config) throws CompilerException { + public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException { CustomCompilerConfiguration custom = new CustomCompilerConfiguration(); File destinationDir = new File(config.getOutputLocation()); @@ -81,7 +82,7 @@ public class JDTCompiler extends AbstractCompiler { String[] sourceFiles = getSourceFiles(config); if (sourceFiles.length == 0) { - return Collections.emptyList(); + return new CompilerResult(); } getLogger().info( @@ -94,7 +95,7 @@ public class JDTCompiler extends AbstractCompiler { String[] args = buildCompilerArguments(config, custom, sourceFiles); - List messages; + CompilerResult messages; if (config.isFork()) { String executable = config.getExecutable(); @@ -277,10 +278,10 @@ public class JDTCompiler extends AbstractCompiler { * name of the executable to launch * @param args * arguments for the executable launched - * @return List of CompilerError objects with the errors encountered. + * @return List of CompilerMessage objects with the errors encountered. * @throws CompilerException */ - List compileOutOfProcess(File workingDirectory, String executable, String[] args) + CompilerResult compileOutOfProcess(File workingDirectory, String executable, String[] args) throws CompilerException { if (true /* fork is not supported */) { throw new UnsupportedOperationException("compileoutOfProcess not supported"); @@ -300,7 +301,7 @@ public class JDTCompiler extends AbstractCompiler { int returnCode; - List messages; + List messages; try { returnCode = CommandLineUtils.executeCommandLine(cli, out, err); @@ -314,11 +315,12 @@ public class JDTCompiler extends AbstractCompiler { if (returnCode != 0 && messages.isEmpty()) { // TODO: exception? - messages.add(new CompilerError("Failure executing javac, but could not parse the error:" + EOL + messages.add(new CompilerMessage("Failure executing javac, but could not parse the error:" + EOL + err.getOutput(), true)); } - return messages; + boolean success = (returnCode == 0) ? true : false; + return new CompilerResult(success, messages); } /** @@ -327,12 +329,12 @@ public class JDTCompiler extends AbstractCompiler { * * @param args * arguments for the compiler as they would be used in the command line javac - * @return List of CompilerError objects with the errors encountered. + * @return List of CompilerMessage objects with the errors encountered. * @throws CompilerException */ - List compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException { + CompilerResult compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException { - List messages; + List messages; StringWriter out = new StringWriter(); StringWriter err = new StringWriter(); @@ -357,19 +359,19 @@ public class JDTCompiler extends AbstractCompiler { // low-level, e.g. configuration error throw new CompilerException(err.toString()); } - return messages; + return new CompilerResult(success, messages); } /** - * Parse the output from the compiler into a list of CompilerError objects + * Parse the output from the compiler into a list of CompilerMessage objects * * @param input * The output of the compiler - * @return List of CompilerError objects + * @return List of CompilerMessage objects * @throws IOException */ - protected static List parseModernStream(BufferedReader input) throws IOException { - List errors = new ArrayList(); + protected static List parseModernStream(BufferedReader input) throws IOException { + List errors = new ArrayList(); String type = null; String file = null; int lineNr = -1; @@ -399,9 +401,9 @@ public class JDTCompiler extends AbstractCompiler { return errors; } - private static void addErrorIfFound(List errors, String type, String file, int line, String message) { + private static void addErrorIfFound(List errors, String type, String file, int line, String message) { if (type != null) { - errors.add(new CompilerError(file, "ERROR".equals(type), line, 0, line, 0, message)); + errors.add(new CompilerMessage(file, "ERROR".equals(type), line, 0, line, 0, message)); } } diff --git a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java index a6ffdcd..0f0b912 100644 --- a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java +++ b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/AbstractCompilerMojo.java @@ -29,7 +29,7 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.compiler.Compiler; import org.codehaus.plexus.compiler.CompilerConfiguration; -import org.codehaus.plexus.compiler.CompilerError; +import org.codehaus.plexus.compiler.CompilerMessage; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerOutputStyle; import org.codehaus.plexus.compiler.manager.CompilerManager; @@ -420,7 +420,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { List messages; try { - messages = compiler.compile(compilerConfiguration); + messages = compiler.performCompile(compilerConfiguration).getCompilerMessages(); } catch (Exception e) { // TODO: don't catch Exception throw new MojoExecutionException("Fatal error compiling", e); @@ -429,7 +429,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { boolean compilationError = false; for (Iterator i = messages.iterator(); i.hasNext();) { - CompilerError message = (CompilerError) i.next(); + CompilerMessage message = (CompilerMessage) i.next(); if (message.isError()) { compilationError = true; } else { diff --git a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java index 78dc4d8..8b73147 100644 --- a/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java +++ b/tycho-compiler-plugin/src/main/java/copied/org/apache/maven/plugin/CompilationFailureException.java @@ -20,7 +20,7 @@ import java.util.Iterator; import java.util.List; import org.apache.maven.plugin.MojoFailureException; -import org.codehaus.plexus.compiler.CompilerError; +import org.codehaus.plexus.compiler.CompilerMessage; public class CompilationFailureException extends MojoFailureException { /** @@ -37,7 +37,7 @@ public class CompilationFailureException extends MojoFailureException { StringBuffer sb = new StringBuffer(); for (Iterator it = messages.iterator(); it.hasNext();) { - CompilerError compilerError = (CompilerError) it.next(); + CompilerMessage compilerError = (CompilerMessage) it.next(); sb.append(compilerError).append(LS); } 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 3efb896..cccb6ff 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 @@ -84,7 +84,9 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic } private void validate(List projects) throws MavenExecutionException { - validateConsistentTychoVersion(projects); + if (System.getProperty("skipTychoVersionCheck") == null) { + validateConsistentTychoVersion(projects); + } validateUniqueBaseDirs(projects); } 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 5c4dcb3..9830aee 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 @@ -97,12 +97,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; diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/EmptyLifecycleExecutor.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/EmptyLifecycleExecutor.java index a9d80d3..3ddbe9c 100644 --- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/EmptyLifecycleExecutor.java +++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/EmptyLifecycleExecutor.java @@ -37,6 +37,14 @@ public class EmptyLifecycleExecutor implements LifecycleExecutor { return null; } + public MavenExecutionPlan calculateExecutionPlan(MavenSession session, boolean bool, String... tasks) + throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, + MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, + PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException, + PluginVersionResolutionException { + return null; + } + public MavenExecutionPlan calculateExecutionPlan(MavenSession session, String... tasks) throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, -- 1.8.1.4