MPNATIVE-7

Submitted By: Joachim Bader
Add support for native dependencies and Add support for optional include path (includepath/sysincludepath)


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2004-10-15 10:10:17 +00:00
parent c3933eb9ff
commit 1fedf1acfc
6 changed files with 149 additions and 1 deletions

View File

@ -90,6 +90,45 @@
<includepath location="${java.home}/../include/${maven.native.include.os}"/> <includepath location="${java.home}/../include/${maven.native.include.os}"/>
<includepath location="${maven.build.dir}/native/jni"/> <includepath location="${maven.build.dir}/native/jni"/>
</j:if> </j:if>
<util:tokenize var="includePathList" delim=" " trim="true">${maven.native.compile.includepath}</util:tokenize>
<j:forEach var="includePath" items="${includePathList}">
<includepath location="${includePath}"/>
</j:forEach>
<util:tokenize var="sysincludePathList" delim=" " trim="true">${maven.native.compile.sysincludepath}</util:tokenize>
<j:forEach var="sysincludePath" items="${sysincludePathList}">
<sysincludepath location="${sysincludePath}"/>
</j:forEach>
<!-- add depended libraries -->
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="dep" value="${lib.dependency}"/>
<!-- include sos-->
<j:if test="${dep.type=='so'}">
<j:set var="delim" value="lib"/>
<!-- replace ${delim} in the name -->
<util:tokenize var="libnameTokenizer" delim="${delim}" trim="true">${dep.artifactId}</util:tokenize>
<j:forEach var="libnamePart" items="${libnameTokenizer}" varStatus="index">
<j:if test="${index == 0}">
<j:set var="libname" value="${libnamePart}"/>
</j:if>
<j:if test="${index > 0}">
<j:set var="libname" value="${libname}${delim}${libnamePart}"/>
</j:if>
</j:forEach>
<!-- use syslibst or libset -->
<j:if test="${dep.getProperty('native.syslib') != 'true'}">
<libset dir="${lib.file.parent}" libs="${libname}-${dep.version}"/>
</j:if>
<j:if test="${dep.getProperty('native.syslib') == 'true'}">
<syslibset dir="${lib.file.parent}" libs="${libname}-${dep.version}"/>
</j:if>
</j:if>
</j:forEach>
</cc> </cc>
<!-- just copy the file don't move because we don't want the compiler to compile if for no reason --> <!-- just copy the file don't move because we don't want the compiler to compile if for no reason -->
@ -112,7 +151,7 @@
artifactDirectory = '${pom.artifactDirectory}' artifactDirectory = '${pom.artifactDirectory}'
</ant:echo> </ant:echo>
<ant:property name="libdir__" value="${maven.repo.local}/${pom.artifactDirectory}/so"/> <ant:property name="libdir__" value="${maven.repo.local}/${pom.artifactDirectory}/sos"/>
<ant:mkdir dir="${libdir__}"/> <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"/> <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>

View File

@ -10,3 +10,6 @@ maven.native.linker.target=${maven.native.compiler.target}
maven.native.src.includes=**/*.h **/*.c **/*.cpp maven.native.src.includes=**/*.h **/*.c **/*.cpp
maven.native.src.excludes= maven.native.src.excludes=
maven.native.compile.includepath=
maven.native.compile.sysincludepath=

View File

@ -24,6 +24,13 @@
<author email="brett@apache.org">Brett Porter</author> <author email="brett@apache.org">Brett Porter</author>
</properties> </properties>
<body> <body>
<release version="1.2-SNAPSHOT" date="in CVS">
<action dev="brett" type="fix" issue="MPNATIVE-7" due-to="Joachim Bader">Changed repository location of libraries from <code>so</code> to <code>sos</code> so Maven can handle them as dependencies</action>
<action dev="brett" type="add" issue="MPNATIVE-7" due-to="Joachim Bader">Add support for native dependencies (libset/syslibset)</action>
<action dev="brett" type="add" issue="MPNATIVE-7" due-to="Joachim Bader">Add support for optional include path (includepath/sysincludepath)</action>
<action dev="brett" type="add" issue="MPNATIVE-8" due-to="Joachim Bader">update bcel (consistency) and cpptasks (cross compile) dependencies</action>
</release>
<release version="1.1" date="2004-05-15"> <release version="1.1" date="2004-05-15">
<action dev="brett" type="add" issue="MPNATIVE-5" due-to="Joachim Bader">add src includes/excludes.</action> <action dev="brett" type="add" issue="MPNATIVE-5" due-to="Joachim Bader">add src includes/excludes.</action>
<action dev="brett" type="add" issue="MPNATIVE-4" due-to="Joachim Bader">Linker and compiler argument passing.</action> <action dev="brett" type="add" issue="MPNATIVE-4" due-to="Joachim Bader">Linker and compiler argument passing.</action>

View File

@ -22,6 +22,7 @@
<properties> <properties>
<title>Maven Native Plug-in</title> <title>Maven Native Plug-in</title>
<author email="apache@kav.dk">Kasper Nielsen</author> <author email="apache@kav.dk">Kasper Nielsen</author>
<author email="info@joachim-bader.de">Joachim Bader</author>
</properties> </properties>
<body> <body>
@ -38,6 +39,14 @@
<th>Date</th> <th>Date</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr>
<td>31 July 2004</td>
<td>
support for native dependencies added
</td>
</tr>
<tr> <tr>
<td>26 Mar 2003</td> <td>26 Mar 2003</td>
<td> <td>

View File

@ -22,6 +22,7 @@
<properties> <properties>
<title>Maven Native Plugin Properties</title> <title>Maven Native Plugin Properties</title>
<author email="apache@kav.dk">Kasper Nielsen</author> <author email="apache@kav.dk">Kasper Nielsen</author>
<author email="info@joachim-bader.de">Joachim Bader</author>
</properties> </properties>
<body> <body>
<section name="Native Plugin Properties"> <section name="Native Plugin Properties">
@ -112,7 +113,88 @@
</td> </td>
</tr> </tr>
<tr>
<td>maven.native.compiler.target</td>
<td>Yes</td>
<td>
Optional compiler target. Used for cross compile.
<code>arm-linux</code> means that <code>arm-linux-gcc</code> is
used.
</td>
</tr>
<tr>
<td>maven.native.linker.target</td>
<td>Yes</td>
<td>
Optional linker target. Used for cross compile.
Default value <code>${maven.native.compiler.target}</code>
</td>
</tr>
<tr>
<td>maven.native.compiler.arg.start|mid|end</td>
<td>Yes</td>
<td>
Space delimted list of optional compiler arguments.
<code>start|mid|end</code> spcifies the position in the compiler
argument list.
</td>
</tr>
<tr>
<td>maven.native.linke.arg.start|mid|end</td>
<td>Yes</td>
<td>
Space delimted list of optional linke arguments.
<code>start|mid|end</code> spcifies the position in the linker
argument list.
</td>
</tr>
<tr>
<td>maven.native.compile.includepath</td>
<td>Yes</td>
<td>
Space delimted list of optional include pathes.
</td>
</tr>
<tr>
<td>maven.native.compile.sysincludepath</td>
<td>Yes</td>
<td>
Space delimted list of optional system include pathes.
</td>
</tr>
</table> </table>
</section> </section>
<section name="Dependencies on native libraries">
<p>
Dependencies on native libraries can be handled by the maven
dependency mechanism.
The property <code>native.syslib</code> is optional. If set the
<code>syslibset</code> tag is used insted of the normal
<code>libset</code> tag.
Only <code>so</code>s are supported a the moment.
</p>
<source><![CDATA[
<dependency>
<groupId>group</groupId>
<artifactId>libmyDependendLib</artifactId
<version>1.0</version>
<type>so</type>
<properties>
<native.syslib>true</native.syslib>
</properties>
</dependency>
]]></source>
</section>
</body> </body>
</document> </document>

View File

@ -32,6 +32,14 @@
<subsection name="Unassigned"> <subsection name="Unassigned">
<p> <p>
<ul>
<li>
Add support for other native dependencies. Currently only
<code>so</code> is supported. <code>dll</code> and
<code>a</code> are not supported. Maybe introduce a property
like <code>maven.native.libType</code>.
</li>
</ul>
</p> </p>
</subsection> </subsection>