db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r728693 - in /db/derby/code/trunk: ./ java/build/org/apache/derbyPreBuild/ java/client/ java/engine/ java/engine/org/apache/derby/ java/engine/org/apache/derby/iapi/jdbc/ java/engine/org/apache/derby/impl/jdbc/ java/engine/org/apache/derby/...
Date Mon, 22 Dec 2008 13:51:35 GMT
Author: rhillegas
Date: Mon Dec 22 05:51:35 2008
New Revision: 728693

URL: http://svn.apache.org/viewvc?rev=728693&view=rev
Log:
DERBY-3988: Second attempt to always build the JDBC4 support when compiling  Derby.

Modified:
    db/derby/code/trunk/build.xml
    db/derby/code/trunk/java/build/org/apache/derbyPreBuild/PropertySetter.java
    db/derby/code/trunk/java/client/build.xml
    db/derby/code/trunk/java/engine/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/modules.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml

Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Mon Dec 22 05:51:35 2008
@@ -99,6 +99,14 @@
 
   <target name="checkCompilerLevel" description="Make sure compiler level is Java 5 level
or higher.">
 
+    <!--
+       Allow compilation of JDBC4 classes at 1.6 level if compiler supports it.
+       If we can find the following class, then we assume that the compiler
+       is at least Java 6 level.
+    -->
+    <available classname="java.sql.Wrapper" property="compilerLevel16" value="1.6"/>
+    <property name="compilerLevel16" value="1.5"/>
+
     <javac source="1.5" srcdir="${basedir}" failonerror="false">
       <include name="${dummy.src}"/>
     </javac>
@@ -196,6 +204,11 @@
     <property file="${properties.dir}/extrapath.properties"/>
 
     <!-- 
+            If a Java 6 JDK isn't present, then use the Java 5 environment to build the JDBC
4 support
+    -->
+    <property name="java16compile.classpath" value="${out.jdbc4.dir}:${java15compile.classpath}"/>
+
+    <!-- 
             If a 1.4 JDK is not present, then use the Java 5 environment to build the 1.4
support
     -->
     <property name="java14compile.classpath" value="${java15compile.classpath}:${xalan}:${serializer}"/>
@@ -230,12 +243,12 @@
 
   <target name="printCompilerProperties" if="printCompilerProperties">
 
+    <echo message="${checkEvent} compilerLevel16 = ${compilerLevel16}"/>
     <echo message="${checkEvent} jsr169compile.classpath = ${jsr169compile.classpath}"/>
     <echo message="${checkEvent} j14lib = ${j14lib}"/>
     <echo message="${checkEvent} java14compile.classpath = ${java14compile.classpath}"/>
     <echo message="${checkEvent} j15lib = ${j15lib}"/>
     <echo message="${checkEvent} java15compile.classpath = ${java15compile.classpath}"/>
-    <echo message="${checkEvent} jdk16 = ${jdk16}"/>
     <echo message="${checkEvent} java16compile.classpath = ${java16compile.classpath}"/>
 
   </target>

Modified: db/derby/code/trunk/java/build/org/apache/derbyPreBuild/PropertySetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyPreBuild/PropertySetter.java?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyPreBuild/PropertySetter.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyPreBuild/PropertySetter.java Mon Dec 22
05:51:35 2008
@@ -96,6 +96,8 @@
     private static  final   String  J14CLASSPATH = "java14compile.classpath";
     private static  final   String  J15LIB = "j15lib";
     private static  final   String  J15CLASSPATH = "java15compile.classpath";
+    private static  final   String  J16LIB = "j16lib";
+    private static  final   String  J16CLASSPATH = "java16compile.classpath";
 
     private static  final   String  JDK_VENDOR = "java.vendor";
     private static  final   String  JAVA_HOME = "java.home";
@@ -108,7 +110,8 @@
     private static  final   String  JDK_SUN = "Sun Microsystems Inc.";
 
     private static  final   String  APPLE_JAVA_ROOT = "/System/Library/Frameworks/JavaVM.framework/Versions";
-    
+
+    private static  final   String  JAVA_5 = "1.5";
 
     /////////////////////////////////////////////////////////////////////////
     //
@@ -193,6 +196,11 @@
 
         try {
             //
+            // Check for settings which are known to cause problems.
+            //
+            checkForProblematicSettings();
+            
+            //
             // There's nothing to do if the classpath properties are already set.
             //
             if ( isSet( J14CLASSPATH ) && isSet( J15CLASSPATH ) ) { return; }
@@ -219,7 +227,7 @@
             if ( jdkVendor == null ) { jdkVendor = ""; }
 
             if (  jdkVendor.startsWith( JDK_APPLE ) ) { setForAppleJDKs(); }
-            else if ( JDK_IBM.equals( jdkVendor ) ) { setForIbmJDKs(); }
+            else if ( usingIBMjdk( jdkVendor ) ) { setForIbmJDKs(); }
             else if ( JDK_SUN.equals( jdkVendor ) ) { setForSunJDKs(); }
             
         } catch (Throwable t)
@@ -590,6 +598,40 @@
     
     /**
      * <p>
+     * Check for settings which are known to cause problems.
+     * </p>
+     */
+    private void  checkForProblematicSettings()
+    {
+        //
+        // The IBM Java 5 compiler raises version mismatch errors when used
+        // with the IBM Java 6 libraries.
+        //
+        String  jdkVendor = getProperty( JDK_VENDOR );
+        String  javaVersion = getProperty( JAVA_VERSION );
+        if ( usingIBMjdk( jdkVendor ) && javaVersion.startsWith( JAVA_5 ) &&
isSet( J16CLASSPATH ) )
+        {
+            throw new BuildException
+                (
+                 "\nThe build raises version mismatch errors when using the IBM Java 5 compiler
with Java 6 libraries.\n" +
+                 "Please either use a Java 6 (or later) compiler or do not set the '" + 
J16CLASSPATH + "' variable.\n"
+                 );
+        }
+
+    }
+    
+    /**
+     * <p>
+     * Return true if we are using an IBM JDK.
+     * </p>
+     */
+    private boolean usingIBMjdk( String jdkVendor )
+    {
+        return JDK_IBM.equals( jdkVendor );
+    }
+    
+    /**
+     * <p>
      * Get a property value. Returns null if the property is not set.
      * </p>
      */

Modified: db/derby/code/trunk/java/client/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/build.xml (original)
+++ db/derby/code/trunk/java/client/build.xml Mon Dec 22 05:51:35 2008
@@ -69,12 +69,10 @@
     </javac>
 </target>
 
-<target name="compile_jdbc4" if="jdk16">
+<target name="compile_jdbc4">
     <javac
-      source="1.6"
-      target="1.6"
-      fork="yes"
-      executable="${jdk16}/bin/javac"
+      source="${compilerLevel16}"
+      target="${compilerLevel16}"
       bootclasspath="${empty}"
       nowarn="on"
       debug="${debug}"

Modified: db/derby/code/trunk/java/engine/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/build.xml (original)
+++ db/derby/code/trunk/java/engine/build.xml Mon Dec 22 05:51:35 2008
@@ -50,7 +50,7 @@
 
 <!--             ============ Begin Targets ==============                -->
  
-  <target name="engine" depends="engine_j2se,engine_169,engine_169_opt,jdbc4_modules_edit"
+  <target name="engine" depends="engine_j2se,engine_169,engine_169_opt"
           description="Build Derby engine">
 	</target>
     <target name="engine_j2se" depends="engine_169"
@@ -112,13 +112,6 @@
 	  </condition>
 	</target> 
 
-	<target name="jdbc4_modules_edit" 
-                 if="jdk16">
-                <replaceregexp file="${out.dir}/${derby.dir}/modules.properties"
-                              match="^#jdbc4_optional_(.*)"
-                              replace="\1"
-                              byline="true" />
-        </target>
 
 <!--             ============= End Targets ==============                -->
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml Mon Dec 22 05:51:35
2008
@@ -140,12 +140,10 @@
     </javac>
   </target>
 
-  <target name="compile_jdbc4" if="jdk16">
+  <target name="compile_jdbc4" >
       <javac
-          source="1.6"
-          target="1.6"
-          fork="yes"
-          executable="${jdk16}/bin/javac"
+          source="${compilerLevel16}"
+          target="${compilerLevel16}"
           bootclasspath="${empty}"
           nowarn="on"
           debug="${debug}"

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml Mon Dec 22 05:51:35
2008
@@ -111,12 +111,10 @@
     </javac>
   </target>
 
-<target name="compile_jdbc4" depends="compile_jdbc3" if="jdk16">
+<target name="compile_jdbc4" depends="compile_jdbc3" >
     <javac
-      source="1.6"
-      target="1.6"
-        fork="yes"
-        executable="${jdk16}/bin/javac"
+      source="${compilerLevel16}"
+      target="${compilerLevel16}"
         bootclasspath="${empty}"
         nowarn="on"
         debug="${debug}"

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml Mon Dec 22 05:51:35 2008
@@ -133,12 +133,10 @@
    </javac>  
   </target>
   
-  <target name="compile_jdbc4" if="jdk16">
+  <target name="compile_jdbc4" >
     <javac
-      source="1.6"
-      target="1.6"
-        fork="yes"
-        executable="${jdk16}/bin/javac"
+      source="${compilerLevel16}"
+      target="${compilerLevel16}"
         bootclasspath="${empty}"
         nowarn="on"
         debug="${debug}"

Modified: db/derby/code/trunk/java/engine/org/apache/derby/modules.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/modules.properties?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/modules.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/modules.properties Mon Dec 22 05:51:35
2008
@@ -179,10 +179,10 @@
 
 # jdbc40 - requires JDK 1.6 (which is constant 7 in Derby)
 #
-#jdbc4_optional_derby.module.jdbcJ6=org.apache.derby.jdbc.Driver40
-#jdbc4_optional_derby.env.jdk.jdbcJ6=7
-#jdbc4_optional_derby.env.classes.jdbcJ6=java.sql.Driver
-#jdbc4_optional_cloudscape.config.jdbcJ6=derby
+derby.module.jdbcJ6=org.apache.derby.jdbc.Driver40
+derby.env.jdk.jdbcJ6=7
+derby.env.classes.jdbcJ6=java.sql.Driver
+cloudscape.config.jdbcJ6=derby
 
 # resourceAdapter - requires JDK 1.2, JTA classes and JDBC20X classes
 #

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml?rev=728693&r1=728692&r2=728693&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/build.xml
Mon Dec 22 05:51:35 2008
@@ -46,12 +46,10 @@
     <property file="${user.home}/properties/derbytesting.properties"/>
     <property name="this.dir" value="${derby.testing.functest.dir}/tests/jdbc4"/>
 
-    <target name="compile_jdbc4" if="jdk16" depends="copyfiles">
+    <target name="compile_jdbc4" depends="copyfiles">
         <javac
-          source="1.6"
-          target="1.6"
-            fork="yes"
-            executable="${jdk16}/bin/javac"
+          source="${compilerLevel16}"
+          target="${compilerLevel16}"
             bootclasspath="${empty}"
             nowarn="on"
             debug="true"



Mime
View raw message