You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by kn...@apache.org on 2003/04/01 14:28:12 UTC

cvs commit: maven/src/plugins-build/native plugin.jelly

knielsen    2003/04/01 04:28:12

  Modified:    src/plugins-build/native plugin.jelly
  Log:
  cleanup
  
  Revision  Changes    Path
  1.5       +95 -74    maven/src/plugins-build/native/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven/src/plugins-build/native/plugin.jelly,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- plugin.jelly	30 Mar 2003 16:17:19 -0000	1.4
  +++ plugin.jelly	1 Apr 2003 12:28:12 -0000	1.5
  @@ -1,62 +1,83 @@
   <?xml version="1.0"?>
   <project xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:ant="jelly:ant">
  -  <!--==================================================================-->
  -  <!-- Compile all source code                                      -->
  -  <!--==================================================================-->
  -  <goal name="native" description="Native compiler" prereqs="native:compile"/>
  -  <goal name="native:compile" description="Compile the native compiler" prereqs="native:jniheader">
  -    <taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask"/>
  -    <typedef name="linker" classname="net.sf.antcontrib.cpptasks.LinkerDef"/>
  -    <typedef name="compiler" classname="net.sf.antcontrib.cpptasks.CompilerDef"/>
  -    <ant:echo> Real Java Home = '${java.home}/..' 
  -    artifactId = '${pom.artifactId}' </ant:echo>
  -    <mkdir dir="${maven.build.dir}/native"/>
  -    <!-- for some reason '.' aren't allow as parameter for outfile-->
  -    <cc outfile="${maven.build.dir}/native/_" link="shared" debug="true">
  -      <compiler name="gcc"/>
  +
  +    <!--==================================================================-->
  +    <!-- Compile all source code                                      -->
  +    <!--==================================================================-->
  +    
  +    <goal name="native" description="Native compiler" prereqs="native:compile"/>
  +
  +    <!--==================================================================-->
  +    <!-- Compile all source code                                          -->
  +    <!--==================================================================-->
  +
  +    <goal name="native:compile" description="Compile the native compiler" prereqs="native:jniheader">
  +
  +       <taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask"/>
  +       <typedef name="linker" classname="net.sf.antcontrib.cpptasks.LinkerDef"/>
  +       <typedef name="compiler" classname="net.sf.antcontrib.cpptasks.CompilerDef"/>
  +
  +       <ant:echo> Real Java Home = '${java.home}/..' 
  +                  artifactId = '${pom.artifactId}' </ant:echo>
  +       
  +       <mkdir dir="${maven.build.dir}/native"/>
  +                
  +       <ant:available property="jniFilesPresent" file="${maven.build.dir}/native/jni"/>
  +        
  +       <!-- for some reason '.' aren't allow as parameter for outfile-->
  +       <cc outfile="${maven.build.dir}/native/_" link="shared" debug="true">
  +         <compiler name="gcc"/>
  +         <fileset dir="src/unix"/>
  +         <j:if test="${jniFilesPresent == 'true'}">
  +            <includepath location="${java.home}/../include"/>
  +            <includepath location="${java.home}/../include/linux"/>
  +            <includepath location="${maven.build.dir}/native/jni"/>
  +         </j:if>   
  +       </cc>
  +
  +       <!-- just copy the file don't move because we don't want the compiler to compile if for no reason -->
  +       <ant:available property="outputPresent" file="${maven.build.dir}/native/lib_.so"/>
  +       
  +       <j:if test="${outputPresent == 'true'}">
  +          <ant:copy file="${maven.build.dir}/native/lib_.so" 
  +            tofile="${maven.build.dir}/native/lib${pom.artifactId}-${pom.currentVersion}.so" overwrite="true"/>
  +       </j:if> 
  +    </goal>
  +
  +    <!-- ================================================================== -->
  +    <!-- I N S T A L L   L I B                                              -->
  +    <!-- ================================================================== -->
  +    
  +    <goal name="native:install" prereqs="native:compile" description="Install the lib in the local repository">
  +      <ant:echo>
  +                id = '${pom.artifactId}'
  +                groupId = '${pom.groupId}'
  +                artifactDirectory = '${pom.artifactDirectory}'
  +      </ant:echo>
         
  -      <fileset dir="src/unix"/>
  -      <includepath location="${java.home}/../include"/>
  -      <includepath location="${java.home}/../include/linux"/>
  -      <includepath location="${java.home}/../include/linux"/>
  -      <includepath location="${maven.build.dir}/native/jni"/>
  -    </cc>
  -    <!-- just copy the file don't move because we don't want the compiler to compile if for no reason -->
  -    <ant:copy file="${maven.build.dir}/native/lib_.so" 
  -    tofile="${maven.build.dir}/native/lib${pom.artifactId}-${pom.currentVersion}.so" overwrite="true"/>
  +      <ant:property name="libdir__" value="${maven.repo.local}/${pom.artifactDirectory}/so"/>
  +      <ant:mkdir dir="${libdir__}"/>
  +      <ant:copy file="${maven.build.dir}/native/lib${pom.artifactId}-${pom.currentVersion}.so" tofile="${libdir__}/lib${pom.artifactId}-${pom.currentVersion}.so" overwrite="true"/>
  +    </goal>
       
  +    <!-- ================================================================== -->
  +    <!-- R U N   J A V A H                                                  -->
  +    <!-- ================================================================== -->
       
  -  </goal>
  -  <!-- ================================================================== -->
  -  <!-- I N S T A L L   J A R                                              -->
  -  <!-- ================================================================== -->
  -  <goal name="native:install" prereqs="native:compile" description="Install the lib in the local repository">
  -    <ant:echo>
  -    id = '${pom.artifactId}'
  -    groupId = '${pom.groupId}'
  -    artifactDirectory = '${pom.artifactDirectory}'
  -    </ant:echo>
  -    <ant:property name="libdir__" value="${maven.repo.local}/${pom.artifactDirectory}/so"/>
  -    <ant:mkdir dir="${libdir__}"/>
  -    <ant:copy file="${maven.build.dir}/native/lib${pom.artifactId}-${pom.currentVersion}.so" tofile="${libdir__}/lib${pom.artifactId}-${pom.currentVersion}.so" overwrite="true"/>
  -  </goal>
  -  <goal name="native:test" description="Install the lib in the local repository">
  -    <ant:echo>
  -    id = '${pom.artifactId}'
  -    groupId = '${pom.groupId}'
  -    artifactDirectory = '${pom.artifactDirectory}'
  -    </ant:echo>
  -  </goal>
  -  <goal name="native:jniheader" description="make jniheaders for classes" prereqs="java:compile">
  -    <fileScanner var="classFiles">
  -      <fileset dir="${maven.build.dest}">
  -        <patternset>
  -          <include name="**/*.class"/>
  -        </patternset>
  -      </fileset>
  -    </fileScanner>
  +    <goal name="native:jniheader" description="make jniheaders for classes" prereqs="java:compile">
  +       
  +      <fileScanner var="classFiles">
  +         <fileset dir="${maven.build.dest}">
  +           <patternset>
  +              <include name="**/*.class"/>
  +           </patternset>
  +         </fileset>
  +       </fileScanner>
  +
  +      <!--do we need to run javah -->
  +      <j:set var="compileJNI" value="false"/>
  +      <j:useBean var="javaSourceTool" class="org.apache.maven.natives.util.JavaSourceTool"/>
   
  -          <j:set var="compileJNI" value="false"/>
         <j:forEach var="file" items="${classFiles.iterator()}">
           <j:set var="clazz" value="${javaSourceTool.getBcelClass(file.toString())}"/>
           <j:forEach var="method" items="${clazz.getMethods()}">
  @@ -66,26 +87,26 @@
           </j:forEach>
         </j:forEach>
   
  -  <j:if test="${compileJNI == 'true'}">
  -    <mkdir dir="${maven.build.dir}/native/jni"/>
  -    <javah destdir="${maven.build.dir}/native/jni">
  -      <classpath>
  -        <pathelement location="${maven.build.dest}"/>
  -      </classpath>
  -      <j:useBean var="javaSourceTool" class="org.apache.maven.natives.util.JavaSourceTool"/>
  -      <j:forEach var="file" items="${classFiles.iterator()}">
  -        <j:set var="isNative" value="false"/>
  -        <j:set var="clazz" value="${javaSourceTool.getBcelClass(file.toString())}"/>
  -        <j:forEach var="method" items="${clazz.getMethods()}">
  -          <j:if test="${method.isNative() == 'true'}">
  -            <j:set var="isNative" value="true"/>
  -          </j:if>
  -        </j:forEach>
  -        <j:if test="${isNative == 'true'}">
  -          <class name="${clazz.className}"/>
  -        </j:if>
  -      </j:forEach>
  -    </javah>
  +      <j:if test="${compileJNI == 'true'}">
  +        <ant:echo>Running Javah on java classes</ant:echo>
  +        <mkdir dir="${maven.build.dir}/native/jni"/>
  +        <javah destdir="${maven.build.dir}/native/jni">
  +          <classpath>
  +            <pathelement location="${maven.build.dest}"/>
  +          </classpath>
  +          <j:forEach var="file" items="${classFiles.iterator()}">
  +            <j:set var="isNative" value="false"/>
  +            <j:set var="clazz" value="${javaSourceTool.getBcelClass(file.toString())}"/>
  +            <j:forEach var="method" items="${clazz.getMethods()}">
  +              <j:if test="${method.isNative() == 'true'}">
  +                <j:set var="isNative" value="true"/>
  +              </j:if>
  +            </j:forEach>
  +            <j:if test="${isNative == 'true'}">
  +              <class name="${clazz.className}"/>
  +            </j:if>
  +          </j:forEach>
  +        </javah>
         </j:if>
  -  </goal>
  +    </goal>
   </project>
  
  
  

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