From 5a5bb5a860b208da1d800773039605955475e25e Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Sat, 16 Mar 2013 21:19:47 -0400 Subject: [PATCH] Update to Plexus Compiler 2.2 API. Update bootstrap build for 0.17.0-SNAPSHOT to work against 0.16.0. --- sources | 2 +- tycho-fix-bootstrap-build.patch | 65 ++++++--- tycho-fix-build.patch | 238 +++++++++++++++++++++++++++++--- tycho.spec | 16 ++- 4 files changed, 284 insertions(+), 37 deletions(-) diff --git a/sources b/sources index 26d15d6..9374a3d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ +ac8c931e958eb696da26f82eeb10ffea maven-repo.tar.xz 336c6a9cae94df32da549e8fb7ce7473 org.eclipse.tycho-3351b14f403a08c0e6765081b88b877bf31fcdab.tar.bz2 -ef2ea56bb4866cef0a00f6784431aaef maven-repo.tar.xz diff --git a/tycho-fix-bootstrap-build.patch b/tycho-fix-bootstrap-build.patch index a0669e8..0adccb9 100644 --- a/tycho-fix-bootstrap-build.patch +++ b/tycho-fix-bootstrap-build.patch @@ -1,4 +1,4 @@ -From 354a8a3e10fac409b9d0115d1cb377ee711d2025 Mon Sep 17 00:00:00 2001 +From b0beb9a65686760c7a086043774a24aebb3a731f Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Mon, 19 Nov 2012 10:33:43 -0500 Subject: [PATCH] Minor fixes of limited scope to get a Tycho bootstrapped @@ -12,33 +12,62 @@ When doing a bootstrap build, we're using upstream jars with class files compiled as 'jsr14' (Allows running on 1.4 JDK and can compile against 1.5 sources). JDK 1.7 is not backwards compatible (eg. info on generics is ignored in these jars). + +Upstream is still building with Jetty 8 so our bootstrap build must do +the same. + +Change-Id: Ib8f471e5df40eb06da4f2d4ca6c2d3ab14f5dc99 --- - tycho-bundles/tycho-bundles-target/tycho.target | 10 +++++----- + .../main/java/org/eclipse/tycho/test/util/HttpServer.java | 5 ++--- + .../tycho-bundles-target/tycho-bundles-target.target | 8 ++++---- .../java/org/eclipse/tycho/core/osgitools/OsgiManifest.java | 12 ++++++------ tycho-surefire/pom.xml | 2 +- - 3 files changed, 12 insertions(+), 12 deletions(-) + 4 files changed, 13 insertions(+), 14 deletions(-) -diff --git a/tycho-bundles/tycho-bundles-target/tycho.target b/tycho-bundles/tycho-bundles-target/tycho.target -index 3436ba6..67ba8c6 100644 ---- a/tycho-bundles/tycho-bundles-target/tycho.target -+++ b/tycho-bundles/tycho-bundles-target/tycho.target -@@ -2,11 +2,11 @@ - +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 eb110dc..1a27b00 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,10 +20,9 @@ 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.ServerConnector; ++import org.eclipse.jetty.server.bio.SocketConnector; + import org.eclipse.jetty.servlet.ServletContextHandler; + import org.eclipse.jetty.servlet.ServletHolder; + import org.eclipse.jetty.util.security.Constraint; +@@ -69,7 +68,7 @@ public class HttpServer { + + private static HttpServer doStartServer(String username, String password, int port) throws Exception { + Server server = new Server(); +- AbstractNetworkConnector connector = new ServerConnector(server); ++ Connector connector = new SocketConnector(); + connector.setPort(port); + server.addConnector(connector); + +diff --git a/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target b/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target +index 8e105b4..2c66607 100644 +--- a/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target ++++ b/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target +@@ -2,10 +2,10 @@ + -- -- -- -- -- +- +- +- +- + + + + -+ + - diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiManifest.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiManifest.java index 37ce827..4cc7644 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiManifest.java @@ -95,7 +124,7 @@ index 37ce827..4cc7644 100644 throw new OsgiManifestParserException(location, e); } diff --git a/tycho-surefire/pom.xml b/tycho-surefire/pom.xml -index eab06be..6622176 100644 +index 985e8f3..46bef81 100644 --- a/tycho-surefire/pom.xml +++ b/tycho-surefire/pom.xml @@ -41,7 +41,7 @@ @@ -108,5 +137,5 @@ index eab06be..6622176 100644 -- -1.7.11.7 +1.8.1.4 diff --git a/tycho-fix-build.patch b/tycho-fix-build.patch index ac60d8b..2eadefe 100644 --- a/tycho-fix-build.patch +++ b/tycho-fix-build.patch @@ -1,4 +1,4 @@ -From afb7aaef05da393028d1bfddf8eb472e6ba6a893 Mon Sep 17 00:00:00 2001 +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. @@ -19,26 +19,46 @@ 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 | 5 ----- - tycho-artifactcomparator/pom.xml | 4 ++-- - .../META-INF/MANIFEST.MF | 2 +- - .../META-INF/MANIFEST.MF | 2 +- - .../eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java | 2 +- - .../src/main/java/org/eclipse/tycho/test/util/HttpServer.java | 5 +++-- - .../tycho-bundles-external/tycho-bundles-external.product | 1 - - .../tycho-standalone-p2-director/p2 Director.product | 1 - - tycho-compiler-jdt/pom.xml | 4 ---- - .../tycho/core/maven/TychoMavenLifecycleParticipant.java | 4 +++- - .../org/eclipse/tycho/test/AbstractTychoIntegrationTest.java | 11 +++++------ - .../org/eclipse/tycho/testing/EmptyLifecycleExecutor.java | 8 ++++++++ - 12 files changed, 24 insertions(+), 25 deletions(-) + 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..41e8bdf 100644 +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} @@ -174,6 +194,192 @@ index 9872fd7..8a12fde 100644 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 @@ -231,5 +437,5 @@ index a9d80d3..3ddbe9c 100644 throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, -- -1.7.11.7 +1.8.1.4 diff --git a/tycho.spec b/tycho.spec index 8ade019..871fa96 100644 --- a/tycho.spec +++ b/tycho.spec @@ -1,6 +1,6 @@ # Bootstrap build # Set this if Tycho and Eclipse are not in buildroot -%global bootstrap 0 +%global bootstrap 1 # When building version under development (non-release) %global snap -SNAPSHOT @@ -8,7 +8,7 @@ Name: tycho Version: 0.17.0 -Release: 0.3.git3351b1%{?dist} +Release: 0.4.git3351b1%{?dist} Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven Group: Development/Libraries @@ -144,6 +144,14 @@ popd # Bootstrap Build %if %{bootstrap} tar -xf %{SOURCE4} + +# gid:aid used by bootstrapped build dependencies +mkdir -p .m2/org/ow2/asm/asm-debug-all/4.0/ +pushd .m2/org/ow2/asm/asm-debug-all/4.0/ +ln -s %{_mavenpomdir}/JPP.objectweb-asm4-asm-all.pom asm-debug-all-4.0.pom +ln -s %{_javadir}/objectweb-asm4/asm-all.jar asm-debug-all-4.0.jar +popd + %patch7 -p1 # Non-Bootstrap Build @@ -259,6 +267,10 @@ install -m 644 $osgiJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.jar %{_javadocdir}/%{name} %changelog +* Fri Mar 15 2013 Roland Grunberg 0.17.0-0.4.git3351b1 +- Update bootstrapped build for 0.17.0-SNAPSHOT to work against 0.16.0. +- Update to Plexus Compiler 2.2 API. + * Thu Feb 28 2013 Roland Grunberg 0.17.0-0.3.git3351b1 - Update to using Jetty 9 API.