PR: MPNATIVE-3

more configurable


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett committed 2004-04-25 02:34:08 +00:00
1 parent 1bb6adb656
commit 453a3f0448
9 files changed
+111 -33

No files matched your search

+29 -24
View File
@@ -43,12 +43,17 @@
<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"/>
<cc outfile="${maven.build.dir}/native/_" link="${maven.native.link}" debug="${maven.native.debug}">
<compiler name="${maven.native.compiler.name}">
<compilerparam name="target" value="${maven.native.compiler.target}"/>
</compiler>
<linker name="${maven.native.linker.name}">
<linkerparam name="target" value="${maven.native.linker.target}"/>
</linker>
<fileset dir="${maven.native.src}" />
<j:if test="${jniFilesPresent == 'true'}">
<includepath location="${java.home}/../include"/>
<includepath location="${java.home}/../include/linux"/>
<includepath location="${java.home}/../include/${maven.native.include.os}"/>
<includepath location="${maven.build.dir}/native/jni"/>
</j:if>
</cc>
@@ -109,7 +114,7 @@
<ant:echo>Running Javah on java classes</ant:echo>
<mkdir dir="${maven.build.dir}/native/jni"/>
<!-- need ANT 1.6
<!-- need ANT 1.6
<javah destdir="${maven.build.dir}/native/jni">
<classpath>
@@ -129,25 +134,25 @@
</j:forEach>
</javah> -->
<!-- workaround -->
<property environment="env"/>
<exec executable="${env.JAVA_HOME}/bin/javah">
<arg line="-d ${maven.build.dir}/native/jni"/>
<arg line="-classpath ${maven.build.dest}"/>
<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'}">
<arg value="${clazz.className}"/>
</j:if>
</j:forEach>
</exec>
<!-- workaround -->
<property environment="env"/>
<exec executable="${env.JAVA_HOME}/bin/javah">
<arg line="-d ${maven.build.dir}/native/jni"/>
<arg line="-classpath ${maven.build.dest}"/>
<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'}">
<arg value="${clazz.className}"/>
</j:if>
</j:forEach>
</exec>
</j:if>
</goal>
+10
View File
@@ -0,0 +1,10 @@
maven.native.link=shared
maven.native.include.os=linux
maven.native.debug=true
maven.native.src=src/unix
maven.native.compiler.name=gcc
maven.native.linker.name=${maven.native.compiler.name}
maven.native.compiler.target=
maven.native.linker.target=${maven.native.compiler.target}
+5 -1
View File
@@ -52,7 +52,11 @@
</roles>
</developer>
</developers>
<contributors/>
<contributors>
<contributor>
<name>Joachim Bader</name>
</contributor>
</contributors>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
-5
View File
@@ -20,11 +20,6 @@
xmlns:ant="jelly:ant">
<goal name="runsample" description="run sample" prereqs="native:compile">
<mkdir dir="${maven.build.dir}/samples"/>
<javac srcdir="${basedir}/src/sample/java"
destdir="${maven.build.dir}/samples"
fork="true"
/>
<java classname="org.apache.maven.natives.sample.helloworld.HelloWorld" fork="yes">
<sysproperty key="java.library.path" value="${maven.build.dir}/native"/>
<classpath>
+1
View File
@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.1-SNAPSHOT" date="in CVS">
<action dev="brett" type="fix" issue="MPNATIVE-3" due-to="Joachim Bader">Use properties more</action>
<action dev="brett" type="fix" issue="MPNATIVE-1" due-to="Joachim Bader">Help javah work on all JDK features</action>
</release>
</body>
+8
View File
@@ -25,10 +25,18 @@
</properties>
<body>
<goals>
<goal>
<name>native:compile</name>
<description>Compile the native sources</description>
</goal>
<goal>
<name>native:jniheader</name>
<description>Generates JNI header files</description>
</goal>
<goal>
<name>native:install</name>
<description>Install the lib in the local repository</description>
</goal>
</goals>
</body>
</document>
-3
View File
@@ -31,9 +31,6 @@
different compilers such as gcc, msvc, bcc, ...
</p>
<p>
Currently, this plugin only supports generation of jni header files.
</p>
</section>
<section name="News">
<table>
+1
View File
@@ -24,6 +24,7 @@
<body>
<links>
<item name="Maven" href="http://maven.apache.org/"/>
<item name="ant-contrib" href="http://ant-contrib.sourceforge.net/"/>
</links>
<menu name="Overview">
<item href="/index.html" name="Overview"/>
+57
View File
@@ -39,6 +39,63 @@
<code>${maven.build.dir}/jni</code>.</p>
</td>
</tr>
<tr>
<td>maven.native.src</td>
<td>Yes</td>
<td>
<p>Directory for native source files.
Default value is <code>src/unix</code>.
</p>
</td>
</tr>
<tr>
<td>maven.native.link</td>
<td>Yes</td>
<td>
<p>Sets the output file type. Supported values "executable",
"shared", and "static".
Default value is <code>shared</code>.
</p>
</td>
</tr>
<tr>
<td>maven.native.compiler.name</td>
<td>Yes</td>
<td>
<p>Sets compiler type.
Default value is <code>gcc</code>.
</p>
</td>
</tr>
<tr>
<td>maven.native.linker.name</td>
<td>Yes</td>
<td>
<p>Sets linker type.
Default value is <code>${maven.native.compiler.name}</code>.
</p>
</td>
</tr>
<tr>
<td>maven.native.debug</td>
<td>Yes</td>
<td>
<p>If set true, all targets will be built for debugging.
Default value is <code>true</code>.
</p>
</td>
</tr>
<tr>
<td>maven.native.include.os</td>
<td>Yes</td>
<td>
<p>JDK directory for plattform depended include files.
Default value is <code>linux</code>.
</p>
</td>
</tr>
</table>
</section>
</body>