Files
allwpilib/wpilibj/wpilibJavaJNI/pom.xml
Fredric Silberberg 1e4e0bacde Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.

Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.

Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.

Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-20 16:22:17 -04:00

316 lines
10 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>wpilibJavaJNI</artifactId>
<groupId>edu.wpi.first.wpilibj</groupId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>edu.wpi.first.wpilib.cmake</groupId>
<artifactId>cpp-root</artifactId>
<version>1.0.0</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
</repositories>
<pluginRepositories>
</pluginRepositories>
<properties>
<embeddedJDKHome>${user.home}${file.separator}jdk-linux-arm-vfp-sflt${file.separator}jdk1.8.0_33</embeddedJDKHome>
<embeddedJDKIncludePath>${embeddedJDKHome}${file.separator}include</embeddedJDKIncludePath>
</properties>
<profiles>
<profile>
<id>unix-properties</id>
<properties>
<cmakeGenerator>Unix Makefiles</cmakeGenerator>
</properties>
<activation>
<os>
<family>unix</family>
</os>
</activation>
</profile>
<profile>
<id>MAC-properties</id>
<properties>
<cmakeGenerator>Unix Makefiles</cmakeGenerator>
</properties>
<activation>
<os>
<family>mac</family>
</os>
</activation>
</profile>
<profile>
<id>windows-properties</id>
<properties>
<cmakeGenerator>MSYS Makefiles</cmakeGenerator>
</properties>
<activation>
<os>
<family>windows</family>
</os>
</activation>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<files>
<file>${embeddedJDKIncludePath}</file>
</files>
<message>A copy of the 'Linux ARM v6/v7 Soft Float ABI' JDK must be extracted to '${embeddedJDKHome}' and
the folder '${embeddedJDKIncludePath}' must exist to build this module. You must use Java 7 u45. This JDK may be downloaded from
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u45-oth-JPR. To override
this default location, specify a value for the 'embeddedJDKHome' property at the command line, like 'mvn -DembeddedJDKHome=path/to/jdk'</message>
</requireFilesExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>1.0-alpha-7</version>
<extensions>true</extensions>
<configuration>
<javahOS>linux</javahOS>
<jdkIncludePath>${embeddedJDKIncludePath}</jdkIncludePath>
</configuration>
<executions>
<execution>
<id>javah</id>
<phase>generate-sources</phase>
<configuration>
<!-- trigger javah execution -->
<javahClassNames>
<javahClassName>edu.wpi.first.wpilibj.can.CANJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.HALUtil</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.JNIWrapper</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.AccelerometerJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.AnalogJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.CounterJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.DIOJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.EncoderJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.I2CJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.InterruptJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.PWMJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.RelayJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.SPIJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.SolenoidJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.CompressorJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.PDPJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.PowerJNI</javahClassName>
<javahClassName>edu.wpi.first.wpilibj.hal.SerialPortJNI</javahClassName>
</javahClassNames>
<!-- enable additional javah interface in dependencies list -->
<!-- javahSearchJNIFromDependencies>true</javahSearchJNIFromDependencies -->
<!--
| Add jdk include directories to system include path
| Override ${jkdIncludePath} If your jdk does not conform to Sun JDK layout
-->
<javahOS>linux</javahOS>
<javahOutputDirectory>${project.build.directory}/include</javahOutputDirectory>
<javahProvider>default</javahProvider>
<javahVerbose>true</javahVerbose>
</configuration>
<goals>
<goal>javah</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- TODO: currently we just call cmake which uses relative include paths. Use maven inflation? -->
<plugin>
<groupId>com.googlecode.cmake-maven-project</groupId>
<artifactId>cmake-maven-plugin</artifactId>
<version>2.8.11-b4</version>
<executions>
<execution>
<id>cmake</id>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<options>
<option>-DCMAKE_TOOLCHAIN_FILE=../../arm-toolchain.cmake</option>
<option>-DCMAKE_INSTALL_PREFIX=../../</option>
<option>-DembeddedJDKHome=${embeddedJDKHome}</option>
</options>
<environmentVariables>
<VERBOSE>1</VERBOSE>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>cmake2</id>
<phase>generate-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<target>install</target>
</configuration>
</execution>
</executions>
<configuration>
<sourcePath>.</sourcePath>
<targetPath>${project.build.directory}/cmake</targetPath>
<projectDirectory>${project.build.directory}/cmake</projectDirectory>
<generator>${cmakeGenerator}</generator>
<buildType>release</buildType>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
COMMENT ME: Fetch the dependencies needed to build the cpp.zip file.
<execution>
<id>fetch-cpp-zip-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>edu.wpi.first.wpilib.cmake</groupId>
<artifactId>cpp-root</artifactId>
<version>1.0.0</version>
<type>zip</type>
<destFileName>cpp-root.zip</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<prependGroupId>false</prependGroupId>
</configuration>
</execution>
</executions>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>extract-cpp-zip</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="maven.plugin.classpath" />
<property name="mvn.cpp-root.zip.path" value="${edu.wpi.first.wpilib.cmake:cpp-root:zip}"/>
<available file="${mvn.cpp-root.zip.path}" type="file" property="mvn.cpp-root.zip.isfile" />
<if>
<isset property="mvn.cpp-root.zip.isfile" />
<then>
<unzip src="${mvn.cpp-root.zip.path}" dest="${project.build.directory}" />
</then>
<else>
<copy todir="${project.build.directory}" >
<fileset dir="${mvn.cpp-root.zip.path}" />
</copy>
</else>
</if>
</target>
</configuration>
</execution>
<!-- Set time stamp and version properties. -->
<execution>
<id>set-version-info</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target>
<tstamp>
<format property="timestamp" pattern="yyyy/MM/dd HH:mm:ss z"/>
</tstamp>
<tstamp>
<format property="version-info" pattern="yyyy.MM"/>
</tstamp>
<property name="version" value="${version-info}.${build-number}"/>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>zip-cpp-includes</id>
<phase>compile</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/libwpilibJavaJNI.so</file>
<type>so</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>