Update to Plexus Compiler 2.2 API.

Update bootstrap build for 0.17.0-SNAPSHOT to work against 0.16.0.
This commit is contained in:
Roland Grunberg 2013-03-16 21:19:47 -04:00
parent 7b807213fc
commit 5a5bb5a860
4 changed files with 284 additions and 37 deletions

View File

@ -1,2 +1,2 @@
ac8c931e958eb696da26f82eeb10ffea maven-repo.tar.xz
336c6a9cae94df32da549e8fb7ce7473 org.eclipse.tycho-3351b14f403a08c0e6765081b88b877bf31fcdab.tar.bz2
ef2ea56bb4866cef0a00f6784431aaef maven-repo.tar.xz

View File

@ -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 <rgrunber@redhat.com>
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 @@
<?pde version="3.8"?><target name="Target platform for Tycho's bundles" sequenceNumber="8">
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 @@
<?pde version="3.8"?><target name="Target platform for Tycho's bundles" sequenceNumber="13">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
-<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.0.v20120913-142258-7P7OG2BFLWUl7Unz-8OO8IEVz-8"/>
-<unit id="org.eclipse.sdk.ide" version="4.3.0.I20121002-0800"/>
-<unit id="org.eclipse.equinox.core.sdk.feature.group" version="3.8.0.v20120913-170722-84FAgGhRFnbPjaFro9s2VXtitW"/>
-<unit id="org.eclipse.equinox.p2.sdk.feature.group" version="3.8.0.v20120524-0542-9N8BHpPGMMn84SxoTtoj_mfujQDR"/>
-<repository location="http://download.eclipse.org/eclipse/updates/4.3-I-builds/I20121002-0800"/>
-<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.0.v20130124-220434-7J7IFkRFFt6ZrOZqtTHsTRYeW"/>
-<unit id="org.eclipse.sdk.ide" version="4.3.0.I20130130-2000"/>
-<unit id="org.eclipse.equinox.core.sdk.feature.group" version="3.8.0.v20121023-201113-85FAoGkcFoYTldRygAi3fkdtMT"/>
-<unit id="org.eclipse.equinox.p2.sdk.feature.group" version="3.8.0.v20130115-150500-9N8OI2RGMMn85Z2AELstv0CF0LCR"/>
+<unit id="org.eclipse.equinox.executable.feature.group"/>
+<unit id="org.eclipse.sdk.ide"/>
+<unit id="org.eclipse.equinox.core.sdk.feature.group"/>
+<unit id="org.eclipse.equinox.p2.sdk.feature.group"/>
+<repository location="http://download.eclipse.org/eclipse/updates/4.3-I-builds/I20121113-0800"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.3milestones/S-4.3M5-201301302000/"/>
</location>
</locations>
</target>
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
</repositories>
--
1.7.11.7
1.8.1.4

View File

@ -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 <rgrunber@redhat.com>
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 \
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
- <version>1.8.1</version>
+ <version>2.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-manager</artifactId>
- <version>1.8.1</version>
+ <version>2.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
@@ -226,11 +226,6 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
<version>${jdtVersion}</version>
</dependency>
@ -174,6 +194,192 @@ index 9872fd7..8a12fde 100644
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
</dependency>
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<CompilerError> 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<CompilerError> 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<CompilerError> 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<CompilerError> messages;
+ List <CompilerMessage> 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<CompilerError> compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException {
+ CompilerResult compileInProcess(String[] args, CustomCompilerConfiguration custom) throws CompilerException {
- List<CompilerError> messages;
+ List <CompilerMessage> 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<CompilerError> parseModernStream(BufferedReader input) throws IOException {
- List<CompilerError> errors = new ArrayList<CompilerError>();
+ protected static List<CompilerMessage> parseModernStream(BufferedReader input) throws IOException {
+ List<CompilerMessage> errors = new ArrayList<CompilerMessage>();
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<CompilerError> errors, String type, String file, int line, String message) {
+ private static void addErrorIfFound(List<CompilerMessage> 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

View File

@ -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 <rgrunber@redhat.com> 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 <rgrunber@redhat.com> 0.17.0-0.3.git3351b1
- Update to using Jetty 9 API.