commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r424550 - in /jakarta/commons/sandbox/jci/trunk/maven-jci-plugin: ./ src/main/java/org/apache/maven/plugin/ src/test/resources/unit/compiler-basic-test/ src/test/resources/unit/compiler-basic-test/src/main/java/
Date Sat, 22 Jul 2006 11:26:17 GMT
Author: tcurdt
Date: Sat Jul 22 04:26:16 2006
New Revision: 424550

URL: http://svn.apache.org/viewvc?rev=424550&view=rev
Log:
GSoC: using javac through jci by Peter Konstantinov

Modified:
    jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/pom.xml
    jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/main/java/org/apache/maven/plugin/AbstractJCIMojo.java
    jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/plugin-config.xml
    jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java

Modified: jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/pom.xml?rev=424550&r1=424549&r2=424550&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/pom.xml (original)
+++ jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/pom.xml Sat Jul 22 04:26:16 2006
@@ -47,8 +47,13 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-jci-eclipse</artifactId>
-			<version>3.2.0.658</version>
+			<artifactId>commons-jci-javac</artifactId>
+			<version>1.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+                        <groupId>org.apache.commons</groupId>
+                        <artifactId>commons-jci-eclipse</artifactId>
+                        <version>3.2.0.658</version>
 		</dependency>
 	</dependencies>
 </project>

Modified: jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/main/java/org/apache/maven/plugin/AbstractJCIMojo.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/main/java/org/apache/maven/plugin/AbstractJCIMojo.java?rev=424550&r1=424549&r2=424550&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/main/java/org/apache/maven/plugin/AbstractJCIMojo.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/main/java/org/apache/maven/plugin/AbstractJCIMojo.java
Sat Jul 22 04:26:16 2006
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.util.List;
+import org.apache.commons.jci.compilers.CompilationResult;
 import org.apache.commons.jci.compilers.JavaCompiler;
 import org.apache.commons.jci.compilers.JavaCompilerFactory;
 import org.apache.commons.jci.readers.FileResourceReader;
@@ -21,7 +22,7 @@
 	 * The compiler id of the compiler to use.
 	 * 
 	 * @parameter expression="${maven.compiler.compilerId}"
-	 *            default-value="eclipse"
+	 *            default-value="javac"
 	 */
 	private String compilerId;
 
@@ -51,8 +52,23 @@
 
 	public void execute() throws MojoExecutionException, MojoFailureException
 	{
+		getLog().debug(compilerId);
 		JavaCompiler compiler = JavaCompilerFactory.getInstance()
 				.createCompiler(compilerId);
+		logSettings();
+		FileResourceReader fileResourceReader = new FileResourceReader(
+				new File((String) getCompileSourceRoots().get(0)));
+		getOutputDirectory().mkdirs();
+		FileResourceStore fileResourceStore = new FileResourceStore(
+				getOutputDirectory());
+		CompilationResult result = compiler.compile(
+				new String[] { "TestCompile0.java" }, fileResourceReader,
+				fileResourceStore);
+		logResult(result);
+	}
+
+	private void logSettings()
+	{
 		if (getLog().isDebugEnabled())
 		{
 			getLog().debug(
@@ -65,11 +81,17 @@
 									'\n'));
 			getLog().debug("Output directory: " + getOutputDirectory());
 		}
-		FileResourceReader fileResourceReader = new FileResourceReader(
-				new File((String) getCompileSourceRoots().get(0)));
-		FileResourceStore fileResourceStore = new FileResourceStore(
-				getOutputDirectory());
-		compiler.compile(new String[] { "TestCompile0.java" },
-				fileResourceReader, fileResourceStore);
+	}
+
+	protected void logResult(CompilationResult result)
+	{
+		for (int i = 0; i < result.getErrors().length; i++)
+		{
+			getLog().error(result.getErrors()[i].toString());
+		}
+		for (int i = 0; i < result.getWarnings().length; i++)
+		{
+			getLog().warn(result.getWarnings()[i].toString());
+		}
 	}
 }

Modified: jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/plugin-config.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/plugin-config.xml?rev=424550&r1=424549&r2=424550&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/plugin-config.xml
(original)
+++ jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/plugin-config.xml
Sat Jul 22 04:26:16 2006
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
 	~ Copyright 2001-2006 The Apache Software Foundation.
 	~
@@ -13,7 +14,6 @@
 	~ See the License for the specific language governing permissions and
 	~ limitations under the License.
 -->
-
 <project>
 	<build>
 		<plugins>
@@ -25,47 +25,7 @@
 							${basedir}/target/test-classes/unit/compiler-basic-test/src/main/java
 						</compileSourceRoot>
 					</compileSourceRoots>
-					<compilerId>eclipse</compilerId>
-					<debug>true</debug>
-					<outputDirectory>
-						${basedir}/target/test/unit/compiler-basic-test/target/classes
-					</outputDirectory>
-					<buildDirectory>
-						${basedir}/target/test/unit/compiler-basic-test/target
-					</buildDirectory>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-</project>
-<!--
-	~ Copyright 2001-2006 The Apache Software Foundation.
-	~
-	~ Licensed under the Apache License, Version 2.0 (the "License");
-	~ you may not use this file except in compliance with the License.
-	~ You may obtain a copy of the License at
-	~
-	~      http://www.apache.org/licenses/LICENSE-2.0
-	~
-	~ Unless required by applicable law or agreed to in writing, software
-	~ distributed under the License is distributed on an "AS IS" BASIS,
-	~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	~ See the License for the specific language governing permissions and
-	~ limitations under the License.
--->
-
-<project>
-	<build>
-		<plugins>
-			<plugin>
-				<artifactId>maven-jci-plugin</artifactId>
-				<configuration>
-					<compileSourceRoots>
-						<compileSourceRoot>
-							${basedir}/target/test-classes/unit/compiler-basic-test/src/main/java
-						</compileSourceRoot>
-					</compileSourceRoots>
-					<compilerId>eclipse</compilerId>
+					<compilerId>javac</compilerId>
 					<debug>true</debug>
 					<outputDirectory>
 						${basedir}/target/test/unit/compiler-basic-test/target/classes

Modified: jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java?rev=424550&r1=424549&r2=424550&view=diff
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java
Sat Jul 22 04:26:16 2006
@@ -19,60 +19,8 @@
 
     public TestCompile0()
     {
-
-        System.out.println("Woo Hoo!");
-    }
-
-}
-/*
- * Copyright 2001-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TestCompile0
-{
-
-    public TestCompile0()
-    {
-
-        System.out.println("Woo Hoo!");
-    }
-
-}
-/*
- * Copyright 2001-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TestCompile0
-{
-
-    public TestCompile0()
-    {
-
+    	1
         System.out.println("Woo Hoo!");
     }
 
-}
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message