commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r564930 - in /commons/proper/jci/trunk: compilers/eclipse/ compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/ compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/ compilers/groovy/ compilers/janino/ compilers/jav...
Date Sat, 11 Aug 2007 15:23:43 GMT
Author: tcurdt
Date: Sat Aug 11 08:23:42 2007
New Revision: 564930

URL: http://svn.apache.org/viewvc?view=rev&rev=564930
Log:
fixed eclipse settings + test cases
prepare for 1.1 release


Added:
    commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
  (with props)
Modified:
    commons/proper/jci/trunk/compilers/eclipse/pom.xml
    commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
    commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
    commons/proper/jci/trunk/compilers/groovy/pom.xml
    commons/proper/jci/trunk/compilers/janino/pom.xml
    commons/proper/jci/trunk/compilers/javac/pom.xml
    commons/proper/jci/trunk/core/pom.xml
    commons/proper/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java

Modified: commons/proper/jci/trunk/compilers/eclipse/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/eclipse/pom.xml?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/eclipse/pom.xml (original)
+++ commons/proper/jci/trunk/compilers/eclipse/pom.xml Sat Aug 11 08:23:42 2007
@@ -34,12 +34,12 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

Modified: commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
(original)
+++ commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
Sat Aug 11 08:23:42 2007
@@ -132,7 +132,7 @@
             final JavaCompilerSettings pSettings
             ) {
 
-        final Map settingsMap = ((EclipseJavaCompilerSettings) defaultSettings).getMap();
+        final Map settingsMap = ((EclipseJavaCompilerSettings) defaultSettings).toNativeSettings();
         
         final Collection problems = new ArrayList();
         

Modified: commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
(original)
+++ commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
Sat Aug 11 08:23:42 2007
@@ -41,19 +41,41 @@
     public EclipseJavaCompilerSettings( final Map pMap ) {
         defaultEclipseSettings.putAll(pMap);
     }
+
+    private static Map nativeVersions = new HashMap() {
+		private static final long serialVersionUID = 1L;
+	{
+    	put("1.1", CompilerOptions.VERSION_1_1);
+    	put("1.2", CompilerOptions.VERSION_1_2);
+    	put("1.3", CompilerOptions.VERSION_1_3);
+    	put("1.4", CompilerOptions.VERSION_1_4);
+    	put("1.5", CompilerOptions.VERSION_1_5);
+    	put("1.6", CompilerOptions.VERSION_1_6);
+    }};
+    
+    private String toNativeVersion( final String pVersion ) {
+    	final String nativeVersion = (String) nativeVersions.get(pVersion);
+    	
+    	if (nativeVersion == null) {
+    		throw new RuntimeException("unknown version " + pVersion);
+    	}
+    	
+    	return nativeVersion;
+    }
     
-    Map getMap() {
+    Map toNativeSettings() {
         final Map map = new HashMap(defaultEclipseSettings);
 
-        map.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.GENERATE);
-        map.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
-        map.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
-        map.put(CompilerOptions.OPTION_Encoding, "UTF-8");
+        map.put(CompilerOptions.OPTION_SuppressWarnings, isWarnings()?CompilerOptions.GENERATE:CompilerOptions.DO_NOT_GENERATE);
+        map.put(CompilerOptions.OPTION_ReportDeprecation, isDeprecations()?CompilerOptions.GENERATE:CompilerOptions.DO_NOT_GENERATE);
+        map.put(CompilerOptions.OPTION_TargetPlatform, toNativeVersion(getTargetVersion()));
+        map.put(CompilerOptions.OPTION_Source, toNativeVersion(getSourceVersion()));
+        map.put(CompilerOptions.OPTION_Encoding, getSourceEncoding());
 
         return map;
     }
     
     public String toString() {
-        return defaultEclipseSettings.toString();
+        return toNativeSettings().toString();
     }
 }

Added: commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java?view=auto&rev=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
(added)
+++ commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
Sat Aug 11 08:23:42 2007
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.commons.jci.compilers;
+
+import java.util.Map;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import junit.framework.TestCase;
+
+public final class EclipseJavaCompilerSettingsTestCase extends TestCase {
+
+	public void testDefaultSettings() {
+		final Map m = new EclipseJavaCompilerSettings().toNativeSettings();
+		assertEquals(CompilerOptions.DO_NOT_GENERATE, m.get(CompilerOptions.OPTION_SuppressWarnings));
+		assertEquals(CompilerOptions.DO_NOT_GENERATE, m.get(CompilerOptions.OPTION_ReportDeprecation));
+		assertEquals(CompilerOptions.VERSION_1_4, m.get(CompilerOptions.OPTION_TargetPlatform));
+		assertEquals(CompilerOptions.VERSION_1_4, m.get(CompilerOptions.OPTION_Source));
+		assertEquals("UTF-8", m.get(CompilerOptions.OPTION_Encoding));
+	}
+
+	public void testSourceVersion() {
+		final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings();
+		s.setSourceVersion("1.1");
+		assertEquals(CompilerOptions.VERSION_1_1, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+		s.setSourceVersion("1.2");
+		assertEquals(CompilerOptions.VERSION_1_2, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+		s.setSourceVersion("1.3");
+		assertEquals(CompilerOptions.VERSION_1_3, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+		s.setSourceVersion("1.4");
+		assertEquals(CompilerOptions.VERSION_1_4, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+		s.setSourceVersion("1.5");
+		assertEquals(CompilerOptions.VERSION_1_5, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+		s.setSourceVersion("1.6");
+		assertEquals(CompilerOptions.VERSION_1_6, s.toNativeSettings().get(CompilerOptions.OPTION_Source));
+	}
+
+	public void testTargetVersion() {
+		final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings();
+		s.setTargetVersion("1.1");
+		assertEquals(CompilerOptions.VERSION_1_1, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+		s.setTargetVersion("1.2");
+		assertEquals(CompilerOptions.VERSION_1_2, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+		s.setTargetVersion("1.3");
+		assertEquals(CompilerOptions.VERSION_1_3, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+		s.setTargetVersion("1.4");
+		assertEquals(CompilerOptions.VERSION_1_4, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+		s.setTargetVersion("1.5");
+		assertEquals(CompilerOptions.VERSION_1_5, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+		s.setTargetVersion("1.6");
+		assertEquals(CompilerOptions.VERSION_1_6, s.toNativeSettings().get(CompilerOptions.OPTION_TargetPlatform));
+	}
+
+	public void testEncoding() {
+		final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings();
+		s.setSourceEncoding("ASCII");
+		assertEquals("ASCII", s.toNativeSettings().get(CompilerOptions.OPTION_Encoding));
+	}
+
+	public void testWarnings() {
+		final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings();
+		s.setWarnings(true);
+		assertEquals(CompilerOptions.GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_SuppressWarnings));
+		s.setWarnings(false);
+		assertEquals(CompilerOptions.DO_NOT_GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_SuppressWarnings));
+	}
+
+	public void testDeprecations() {
+		final EclipseJavaCompilerSettings s = new EclipseJavaCompilerSettings();
+		s.setDeprecations(true);
+		assertEquals(CompilerOptions.GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_ReportDeprecation));
+		s.setDeprecations(false);
+		assertEquals(CompilerOptions.DO_NOT_GENERATE, s.toNativeSettings().get(CompilerOptions.OPTION_ReportDeprecation));
+	}
+}

Propchange: commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/jci/trunk/compilers/eclipse/src/test/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettingsTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/jci/trunk/compilers/groovy/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/groovy/pom.xml?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/groovy/pom.xml (original)
+++ commons/proper/jci/trunk/compilers/groovy/pom.xml Sat Aug 11 08:23:42 2007
@@ -34,12 +34,12 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

Modified: commons/proper/jci/trunk/compilers/janino/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/janino/pom.xml?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/janino/pom.xml (original)
+++ commons/proper/jci/trunk/compilers/janino/pom.xml Sat Aug 11 08:23:42 2007
@@ -34,12 +34,12 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

Modified: commons/proper/jci/trunk/compilers/javac/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/javac/pom.xml?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/compilers/javac/pom.xml (original)
+++ commons/proper/jci/trunk/compilers/javac/pom.xml Sat Aug 11 08:23:42 2007
@@ -34,12 +34,12 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-core</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

Modified: commons/proper/jci/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/core/pom.xml?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/core/pom.xml (original)
+++ commons/proper/jci/trunk/core/pom.xml Sat Aug 11 08:23:42 2007
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-jci-fam</artifactId>
-            <version>1.0</version>
+            <version>1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>commons-io</groupId>

Modified: commons/proper/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java?view=diff&rev=564930&r1=564929&r2=564930
==============================================================================
--- commons/proper/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
(original)
+++ commons/proper/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
Sat Aug 11 08:23:42 2007
@@ -29,13 +29,14 @@
  */
 public class JavaCompilerSettings {
 
-    private String targetVersion;
-    private String sourceVersion;
-    private String sourceEncoding;
-    private boolean warnings;
-    private boolean deprecations;
-    private boolean verbose;
+    private String targetVersion = "1.4";
+    private String sourceVersion = "1.4";
+    private String sourceEncoding = "UTF-8";
+    private boolean warnings = false;
+    private boolean deprecations = false;
 
+    /** @deprecated */
+    private boolean verbose = false;
 
     public void setTargetVersion( final String pTargetVersion ) {
         targetVersion = pTargetVersion;
@@ -82,10 +83,12 @@
     }
 
 
+    /** @deprecated */
     public void setVerbose( final boolean pVerbose ) {
         verbose = pVerbose;
     }
 
+    /** @deprecated */
     public boolean isVerbose() {
         return verbose;
     }



Mime
View raw message