-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from bhamail/maven-phase1-native-dan-squash
Mavenize the build process - Phase 1: building the native code via Maven Fixes # #582
- Loading branch information
Showing
7 changed files
with
998 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Super POM included by all other sub-POM(s)--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>native</artifactId> | ||
<packaging>pom</packaging> | ||
<name>net.java.dev.jna:native</name> | ||
|
||
<parent> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>4.3.0-SNAPHSOT</version> | ||
<relativePath>../parent</relativePath> | ||
</parent> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>compile-native-library</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<target> | ||
<ant dir="${project.basedir}" target="install" inheritRefs="true" useNativeBasedir="true"> | ||
<!-- see http://stackoverflow.com/questions/2022622/java-home-gets-mangled-by-maven --> | ||
<!-- property name="build.compiler" value="extJavac"/ --> | ||
</ant> | ||
</target> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> <!-- do not install the POM or artifacts since they are embedded inside the JAR --> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<configuration> <!-- TODO consider installing the DLL(s) and using their settings.localRepository location --> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> <!-- do not deploy the POM or artifacts since they are embedded inside the JAR --> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="workspace-base" default="workspace-base"> | ||
<description> | ||
Holds common imported definitions for ANT build.xml file(s) | ||
</description> | ||
|
||
<dirname property="module.root.folder" file="${ant.file}" /> | ||
<basename property="module.artifact.name" file="${module.root.folder}" /> | ||
<property name="jna.parent.folder" value="${module.root.folder}" /> | ||
<dirname property="jna.root.folder" file="${jna.parent.folder}" /> | ||
<property name="workspace.root.folder" value="${jna.root.folder}" /> | ||
|
||
<!-- user-specific overrides - not part of version control system --> | ||
<property name="build.local.properties.filename" value="build.local.properties" /> | ||
<property file="${jna.parent.folder}${file.separator}${build.local.properties.filename}" /> | ||
|
||
<!-- version control system settings for the specific version --> | ||
<property name="build.version.properties.filename" value="build.version.properties" /> | ||
<property file="${jna.parent.folder}${file.separator}${build.version.properties.filename}" /> | ||
|
||
<!-- import the environment --> | ||
<property environment="env"/> | ||
<!-- NOTE: must match the parent super-POM version --> | ||
<property name="project.version" value="4.3.0-SNAPHSOT" /> | ||
|
||
<!-- detect type of O/S --> | ||
<condition property="win32.local.shell" value="true" else="false"> | ||
<contains string="${os.name}" substring="windows" casesensitive="false" /> | ||
</condition> | ||
<condition property="linux.local.shell" value="true" else="false"> | ||
<isfalse value="${win32.local.shell}" /> | ||
</condition> | ||
<condition property="shell.script.suffix" value="sh" else="bat"> | ||
<isfalse value="${win32.local.shell}" /> | ||
</condition> | ||
|
||
<!-- some useful general sub-folders names --> | ||
<property name="lib.sub.folder.name" value="lib"/> | ||
<property name="bin.sub.folder.name" value="bin"/> | ||
<property name="metainf.sub.folder.name" value="META-INF"/> | ||
<property name="webinf.sub.folder.name" value="WEB-INF"/> | ||
|
||
<!-- default name of manifest file --> | ||
<property name="manifest.file.name" value="MANIFEST.MF"/> | ||
|
||
<!-- useful file(s) suffixes --> | ||
<property name="jar.file.suffix" value="jar"/> | ||
<property name="zip.file.suffix" value="zip"/> | ||
<property name="war.file.suffix" value="war"/> | ||
|
||
<property name="module.artifact.version" value="${project.version}" /> | ||
<property name="module.artifact.jar.name" value="${module.artifact.name}-${module.artifact.version}.${jar.file.suffix}" /> | ||
<property name="module.artifact.zip.name" value="${module.artifact.name}-${module.artifact.version}.${zip.file.suffix}" /> | ||
|
||
<!-- some useful module(s) sub-folders names --> | ||
<property name="target.sub.folder.name" value="target" /> | ||
<property name="src.sub.folder.name" value="src" /> | ||
<property name="main.sub.folder.name" value="main" /> | ||
<property name="resources.sub.folder.name" value="resources" /> | ||
<property name="classes.sub.folder.name" value="classes" /> | ||
<property name="java.sub.folder.name" value="java" /> | ||
<property name="webapp.sub.folder.name" value="webapp" /> | ||
<property name="test.sub.folder.name" value="test"/> | ||
<property name="test.classes.sub.folder.name" value="${test.sub.folder.name}-${classes.sub.folder.name}" /> | ||
<property name="lib.sub.folder.name" value="lib" /> | ||
|
||
<!-- specific module/project relative locations to the build.xml file --> | ||
<property name="module.main.sub.folder.path" value="${src.sub.folder.name}${file.separator}${main.sub.folder.name}" /> | ||
<property name="module.java.sub.folder.path" value="${module.main.sub.folder.path}${file.separator}${java.sub.folder.name}" /> | ||
<property name="module.resources.sub.folder.path" value="${module.main.sub.folder.path}${file.separator}${resources.sub.folder.name}" /> | ||
<property name="module.webapp.sub.folder.path" value="${module.main.sub.folder.path}${file.separator}${webapp.sub.folder.name}" /> | ||
<property name="module.webinf.sub.folder.path" value="${module.webapp.sub.folder.path}${file.separator}${webinf.sub.folder.name}" /> | ||
<property name="module.test.sub.folder.path" value="${src.sub.folder.name}${file.separator}${test.sub.folder.name}" /> | ||
<property name="module.test.java.sub.folder" value="${module.test.sub.folder.path}${file.separator}${java.sub.folder.name}" /> | ||
<property name="module.test.resources.sub.folder" value="${module.test.sub.folder.path}${file.separator}${resources.sub.folder.name}" /> | ||
<property name="module.test.webapp.sub.folder" value="${module.test.sub.folder.path}${file.separator}${webapp.sub.folder.name}" /> | ||
<property name="module.test.webinf.sub.folder" value="${module.test.webapp.sub.folder}${file.separator}${webinf.sub.folder.name}" /> | ||
|
||
<!-- specific module/project absolute locations --> | ||
<property name="module.src.folder" value="${module.root.folder}${file.separator}${src.sub.folder.name}" /> | ||
<property name="module.main.folder" value="${module.root.folder}${file.separator}${module.main.sub.folder.path}" /> | ||
<property name="module.java.folder" value="${module.root.folder}${file.separator}${module.java.sub.folder.path}" /> | ||
<property name="module.resources.folder" value="${module.root.folder}${file.separator}${module.resources.sub.folder.path}" /> | ||
<property name="module.webapp.folder" value="${module.root.folder}${file.separator}${module.webapp.sub.folder.path}" /> | ||
<property name="module.webinf.folder" value="${module.webapp.folder}${file.separator}${webinf.sub.folder.name}" /> | ||
|
||
<property name="module.test.folder" value="${module.root.folder}${file.separator}${module.test.sub.folder.path}" /> | ||
<property name="module.test.java" value="${module.root.folder}${file.separator}${module.test.java.sub.folder}" /> | ||
<property name="module.test.resources" value="${module.root.folder}${file.separator}${module.test.resources.sub.folder}" /> | ||
|
||
<!-- useful sub-folder - under which the module's classes and META-INF sub-folder(s) reside --> | ||
<property name="module.target.folder" value="${module.root.folder}${file.separator}${target.sub.folder.name}" /> | ||
<property name="module.target.classes" value="${module.target.folder}${file.separator}${classes.sub.folder.name}" /> | ||
|
||
<property name="module.artifact.jar.path" value="${module.target.folder}${file.separator}${module.artifact.jar.name}" /> | ||
<property name="module.artifact.zip.path" value="${module.target.folder}${file.separator}${module.artifact.zip.name}" /> | ||
|
||
<target name="workspace-base" /> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="compile-base" default="compile-base"> | ||
<description> | ||
Holds common imported definitions for ANT build.xml file(s) | ||
that build/generate artifacts | ||
</description> | ||
|
||
<dirname property="module.root.folder" file="${ant.file}"/> | ||
<property name="jna.parent.folder" value="${module.root.folder}"/> | ||
<import file="${jna.parent.folder}${file.separator}build-base.xml"/> | ||
|
||
<tstamp> | ||
<format property="year" pattern="yyyy" locale="en,US"/> | ||
</tstamp> | ||
<property name="copyright" value="Copyright &copy; 2007-${year} Timothy Wall. All Rights Reserved."/> | ||
<buildnumber/> | ||
|
||
<!-- JNA library release version - NOTE: this MUST match Maven --> | ||
<property name="jna.major" value="4"/> | ||
<property name="jna.minor" value="3"/> | ||
<property name="jna.revision" value="0"/> | ||
<property name="jna.build" value="0"/> <!--${build.number}--> | ||
<condition property="version.suffix" value="" else="-SNAPSHOT"> | ||
<or> | ||
<isset property="release"/> | ||
<isset property="maven-release"/> | ||
</or> | ||
</condition> | ||
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}${version.suffix}"/> | ||
|
||
<property name="spec.title" value="Java Native Access (JNA)"/> | ||
<property name="spec.vendor" value="JNA Development Team"/> | ||
<property name="spec.version" value="${jna.major}"/> | ||
<property name="impl.title" value="com.sun.jna"/> | ||
<property name="impl.vendor" value="${spec.vendor}"/> | ||
<property name="impl.version" value="${jna.version} (b${jna.build})"/> | ||
|
||
<!-- +++++++++++++++ Supported platforms - Add other supported platforms here ++++++++++++++++ --> | ||
<condition property="jre.arch" value="x86"> | ||
<matches pattern="(i[3456]86|pentium)" string="${os.arch}"/> | ||
</condition> | ||
<condition property="jre.arch" value="x86-64"> | ||
<matches pattern="(x86_64|amd64|em64t)" string="${os.arch}"/> | ||
</condition> | ||
<condition property="jre.arch" value="ppc"> | ||
<matches pattern="(powerpc|power)" string="${os.arch}"/> | ||
</condition> | ||
<condition property="jre.arch" value="ppc64le"> | ||
<or> | ||
<matches pattern="(powerpc64le|power64le|ppc64le)" string="${os.arch}"/> | ||
<and> | ||
<matches pattern="(powerpc64|power64|ppc64)" string="${os.arch}"/> | ||
<matches pattern="little" string="${sun.cpu.endian}"/> | ||
</and> | ||
</or> | ||
</condition> | ||
<condition property="jre.arch" value="ppc64"> | ||
<matches pattern="(powerpc64|power64)" string="${os.arch}"/> | ||
</condition> | ||
<property name="jre.arch" value="${os.arch}"/> | ||
|
||
<!-- ++++++++++++ Maven related properties definitions +++++++++++++ --> | ||
<property name="maven.base.name" value="maven"/> | ||
<property name="maven.archiver.sub.folder.name" value="${maven.base.name}-archiver"/> | ||
<property name="maven.repository.root.folder.name" value=".m2"/> | ||
<property name="maven.repository.sub.folder.name" value="repository"/> | ||
<property name="maven.settings.file.name" value="settings.xml"/> | ||
<property name="maven.pom.file.name" value="pom.xml"/> | ||
<property name="maven.sources.classifier" value="sources"/> | ||
<property name="maven.install.location" value="${env.M2_HOME}"/> | ||
<condition property="mvn.exe.script.name" value="mvn.cmd" else="mvn"> | ||
<istrue value="${win32.local.shell}"/> | ||
</condition> | ||
|
||
<property name="mvn.executable" | ||
value="${maven.install.location}${file.separator}bin${file.separator}${mvn.exe.script.name}"/> | ||
<property name="maven.settings.file.path" value="${jna.parent.folder}${file.separator}${maven.settings.file.name}"/> | ||
<property name="maven.opts" value="-Xmx512m"/> | ||
<condition property="maven.local.repository.folder" | ||
value="${env.M2_REPO}" | ||
else="${user.home}${file.separator}${maven.repository.root.folder.name}${file.separator}${maven.repository.sub.folder.name}"> | ||
<isset property="env.M2_REPO"/> | ||
</condition> | ||
|
||
<!-- Procedure to execute the Maven script - SYNPOSIS: | ||
<antcall target='run-mvn'> | ||
<param name='mvn.run.dir' value='wwww' /> | ||
<param name='mvn.run.opts' value='xxxxxx'/> | ||
<param name='mvn.arg.line' value='yyyyy'/> | ||
</antcall> | ||
Where: | ||
mvn.run.dir - folder to be used as CWD when running the script | ||
mvn.run.opts - options to be set to MAVEN_OPTS (e.g., -Xmx128) | ||
mvn.arg.line - line to be passed as argument to the invocation | ||
--> | ||
<target name="run-mvn"> | ||
<fail message="Cannot find ${mvn.executable} - check that M2_HOME environment variable set"> | ||
<condition> | ||
<not> | ||
<available file="${mvn.executable}" type="file"/> | ||
</not> | ||
</condition> | ||
</fail> | ||
|
||
<echo message="mvn ${mvn.arg.line}" level="info"/> | ||
<exec executable="${mvn.executable}" failonerror="true" dir="${mvn.run.dir}"> | ||
<env key="MAVEN_OPTS" value="${mvn.run.opts}"/> | ||
<!-- arg line="-s ${maven.settings.file.path}" / --> | ||
<arg line="${mvn.arg.line}"/> | ||
</exec> | ||
</target> | ||
|
||
<property name="maven.module.options" value="-Xmx728m"/> | ||
<property name="maven.full.test.options" | ||
value="-Dmaven.test.haltafterfailure=true -Dmaven.test.failure.ignore=false -Dmaven.test.error.ignore=false"/> | ||
|
||
<property name="maven.install.options" value="${maven.full.test.options} install"/> | ||
<target name="run-module-mvn"> | ||
<antcall target='run-mvn'> | ||
<param name='mvn.run.dir' value='${module.root.folder}'/> | ||
<param name='mvn.run.opts' value='${maven.module.options}'/> | ||
<param name='mvn.arg.line' value='${maven.install.options}'/> | ||
</antcall> | ||
</target> | ||
|
||
<property name="maven.clean.options" value="build-helper:remove-project-artifact -DremoveAll=true clean"/> | ||
<target name="clean-module-mvn"> | ||
<antcall target='run-mvn'> | ||
<param name='mvn.run.dir' value='${module.root.folder}'/> | ||
<param name='mvn.run.opts' value='${maven.module.options}'/> | ||
<param name='mvn.arg.line' value='${maven.clean.options}'/> | ||
</antcall> | ||
</target> | ||
|
||
<target name="compile-base" depends="workspace-base"/> | ||
<target name="compile" depends="run-module-mvn" | ||
description="Runs the mvn install command - including all the tests"/> | ||
<target name="uncompile" depends="clean-module-mvn" | ||
description="Runs the mvn clean command - including un-install the artifact from Maven local repository"/> | ||
<target name="recompile" depends="uncompile,compile" description="Re-compiles the module"/> | ||
</project> |
Oops, something went wrong.