tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native build.xml
Date Mon, 29 Oct 2001 17:59:21 GMT
costin      01/10/29 09:59:21

  Modified:    jk/jkant/java/org/apache/jk/ant SoTask.java
               jk/native build.xml
  Log:
  Check the .h files, recompile if changes are detected. Note that this is not doing
  any dependency checks ( well, javac is not doing that either ). It is possible to
  hack 'makedepend' in ( the format is reasonably easy to parse ), but I don't think it's
  that important.
  
  Revision  Changes    Path
  1.6       +50 -1     jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SoTask.java	2001/10/26 23:28:50	1.5
  +++ SoTask.java	2001/10/29 17:59:20	1.6
  @@ -100,6 +100,7 @@
       // or FileSet ?
       FileSet src;
       Path includes;
  +    Path depends;
       Path libs;
       String module;
       String soFile;
  @@ -165,6 +166,20 @@
       }
   
       /**
  +     * General dependencies. If any of the files is modified
  +     * ( i.e. is newer than the oldest .o ) we'll recompile everything.
  +     *
  +     * This can be used for headers ( until we add support for makedepend)
  +     * or any important file that could invalidate the build.
  +     * Another example is checking httpd or apxs ( if a new version
  +     * was installed, maybe some flags or symbols changed )
  +     */
  +    public Path createDepends() {
  +	depends=new Path(project);
  +	return depends;
  +    }
  +
  +    /**
        * Libraries ( .a, .so or .dll ) files to link to.
        */
       public Path createLibs() {
  @@ -215,6 +230,15 @@
   		compileList.addElement( srcFile );
   	}
   
  +	if( checkDepend() ) {
  +	    log("Dependency expired, full build ");
  +	    compileList=new Vector();
  +	    for(int i=0; i<srcList.length; i++ ) {
  +		File srcFile = (File)project.resolveFile(srcList[i]);
  +		compileList.addElement( srcFile );
  +	    }
  +	}
  +
           String [] includeList = ( includes==null ) ?
   	    new String[] {} : includes.list(); 
   
  @@ -246,6 +270,9 @@
   	lo_mapper.setFrom("*.c");
   	lo_mapper.setTo("*.lo");
       }
  +
  +    long oldestO=System.currentTimeMillis();
  +    File oldestOFile=null;
       
       /** Verify if a .c file needs compilation.
        *	As with javac, we assume a fixed build structure, where all .o
  @@ -268,6 +295,10 @@
   	// 	   + target.exists());
   	if( ! target.exists() )
   	    return true;
  +	if( oldestO > target.lastModified() ) {
  +	    oldestO=target.lastModified();
  +	    oldestOFile=target;
  +	}
   	if( srcF.lastModified() > target.lastModified() )
   	    return true;
   
  @@ -276,6 +307,24 @@
   	return false;
   	
       }
  +
  +    public boolean checkDepend() {
  +	if( depends==null )
  +	    return false;
  +	String dependsA[]=depends.list(); 
  +	for( int i=0; i< dependsA.length; i++ ) {
  +	    File f=new File( dependsA[i] );
  +	    if( ! f.exists() ) {
  +		log("Depend not found " + f );
  +		return true;
  +	    }
  +	    if( f.lastModified() > oldestO ) {
  +		log( "Depend " + f + " newer than " + oldestOFile );
  +		return true;
  +	    }
  +	}
  +	return false;
  +    }
       
       /** Compile  using 'standard' gcc flags. This assume a 'current' gcc on
        *  a 'normal' platform - no need for libtool
  @@ -398,7 +447,7 @@
   	cmd.createArgument().setValue( soFile + ".la" );
   
   	// All .o files must be included
  -	project.log( "Linking " + soFile + ".la");
  +	project.log( "Linking " + buildDir + "/" + soFile + ".so");
   
   	for( int i=0; i<srcList.length; i++ ) {
   	    File srcF = (File)project.resolveFile(srcList[i]);
  
  
  
  1.5       +23 -2     jakarta-tomcat-connectors/jk/native/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/build.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- build.xml	2001/10/26 22:53:56	1.4
  +++ build.xml	2001/10/29 17:59:21	1.5
  @@ -1,3 +1,5 @@
  +<?xml version="1.0" ?>
  +
   <project name="jk_native" default="main" basedir=".">
   
     <!-- Experimental -->
  @@ -13,10 +15,16 @@
   
     <property name="apache2.home" location="/opt/apache2" />
     <property name="apache13.home" location="/usr" />
  +
  +  <target name="main" depends="init,apache13,apache20,jni">
  +  </target>
   
  -  <target name="main" >
  +  <target name="init" >
       <taskdef resource="META-INF/ant.tasks" 
   	     classpathref="jkant" />
  +  </target>
  +
  +  <target name="jni" >
       <so sofile="jni_connect" buildDir="jni" >
         <jniConfig />
         <src dir="${native.dir}">
  @@ -29,8 +37,13 @@
   	<pathelement location="${native.dir}/common" />
   	<pathelement location="${java.home}/../include" />
         </includes>
  +      <depends>
  +	<fileset dir="${native.dir}/common" includes="*.h" />
  +      </depends>
       </so>
  +  </target>
   
  +  <target name="apache20" >
       <so sofile="mod_jk" buildDir="apache-2.0">
         <apacheConfig apxs="${apxs20}" />
         <jniConfig />
  @@ -43,8 +56,13 @@
   	<pathelement location="${apache2.home}/include" />
   	<pathelement location="${java.home}/../include" />
         </includes>
  +      <depends>
  +	<fileset dir="${native.dir}/common" includes="*.h" />
  +      </depends>
       </so>
  -    
  +  </target>
  +
  +  <target name="apache13">
       <so sofile="mod_jk" buildDir="apache-1.3">
         <apacheConfig apxs="${apxs13}" />
         <src dir=".">
  @@ -57,6 +75,9 @@
   	<pathelement location="${apache13.home}/include/apache" />
   	<pathelement location="${apache13.home}/include" />
         </includes>
  +      <depends>
  +	<fileset dir="${native.dir}/common" includes="*.h" />
  +      </depends>
       </so>
     </target>
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message