<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>edu.wpi.first.wpilibj</groupId>
  <artifactId>wpilibJavaFinal</artifactId>
  <packaging>jar</packaging>
  <version>0.1.0-SNAPSHOT</version>
  
  <parent>
    <groupId>edu.wpi.first.wpilib.templates.athena</groupId>
    <artifactId>library-jar</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <relativePath>../../maven-utilities/athena/library-jar/pom.xml</relativePath>
  </parent>
  
  <profiles>
    <profile>
      <id>docline-java8-disable</id>
      <activation>
	    <jdk>[1.8,</jdk>
      </activation>

      <build>
	    <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
          </plugin>
	    </plugins>
      </build>
    </profile>
  </profiles>
  
  <dependencies>
	<dependency>
	  <groupId>edu.wpi.first.wpilibj</groupId>
	  <artifactId>wpilibJava</artifactId>
	  <version>0.1.0-SNAPSHOT</version>
	</dependency>
	<dependency>
	  <groupId>edu.wpi.first.wpilibj</groupId>
	  <artifactId>wpilibJavaDevices</artifactId>
	  <version>0.1.0-SNAPSHOT</version>
	</dependency>
	<dependency>
	  <groupId>edu.wpi.first.wpilibj</groupId>
	  <artifactId>wpilibJavaJNI</artifactId>
	  <version>0.1.0-SNAPSHOT</version>
	  <type>so</type>
	</dependency>
    
	<dependency>
	  <groupId>edu.wpi.first.wpilibj</groupId>
	  <artifactId>wpilibJava</artifactId>
	  <version>0.1.0-SNAPSHOT</version>
	  <classifier>sources</classifier>
	</dependency>
	<dependency>
	  <groupId>edu.wpi.first.wpilibj</groupId>
	  <artifactId>wpilibJavaDevices</artifactId>
	  <version>0.1.0-SNAPSHOT</version>
	  <classifier>sources</classifier>
	</dependency>
  </dependencies>

  <build>
	<plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>extract-java-jar</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                         classpathref="maven.plugin.classpath" />

                <property name="mvn.wpilibJava.jar.path" value="${edu.wpi.first.wpilibj:wpilibJava:jar}"/>

                <available file="${mvn.wpilibJava.jar.path}" type="file" property="mvn.wpilibJava.jar.isfile" />

                <if>
                  <isset property="mvn.wpilibJava.jar.isfile" />
                  <then>
                    <unzip src="${mvn.wpilibJava.jar.path}" dest="${project.build.directory}/classes" />
                  </then>
                  <else>
                    <copy todir="${project.build.directory}/classes" >
                      <fileset dir="${mvn.wpilibJava.jar.path}" />  
                    </copy>
                  </else>
                </if>

                <property name="mvn.wpilibJavaDevices.jar.path" value="${edu.wpi.first.wpilibj:wpilibJavaDevices:jar}"/>

                <available file="${mvn.wpilibJavaDevices.jar.path}" type="file" property="mvn.wpilibJavaDevices.jar.isfile" />

                <if>
                  <isset property="mvn.wpilibJavaDevices.jar.isfile" />
                  <then>
                    <unzip src="${mvn.wpilibJavaDevices.jar.path}" dest="${project.build.directory}/classes" />
                  </then>
                  <else>
                    <copy todir="${project.build.directory}/classes" >
                      <fileset dir="${mvn.wpilibJavaDevices.jar.path}" />  
                    </copy>
                  </else>
                </if>
              </target>
            </configuration>
          </execution>

          <execution>
            <id>copy-jni-so</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/classes/linux-arm" 
                      file="${edu.wpi.first.wpilibj:wpilibJavaJNI:so}" />  
              </target>
            </configuration>
          </execution>
          
          <execution>
            <id>generate-sources</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                         classpathref="maven.plugin.classpath" />
                <mkdir dir="${project.build.directory}/sources" />

                <property name="mvn.wpilibJava.sources.path" value="${edu.wpi.first.wpilibj:wpilibJava:jar:sources}"/>
                <unzip src="${mvn.wpilibJava.sources.path}" dest="${project.build.directory}/sources" />

                <property name="mvn.wpilibJavaDevices.sources.path" value="${edu.wpi.first.wpilibj:wpilibJavaDevices:jar:sources}"/>
                <unzip src="${mvn.wpilibJavaDevices.sources.path}" dest="${project.build.directory}/sources" />

                <zip basedir="${project.build.directory}/sources" destfile="${project.build.directory}/sources.jar"/>
                <attachartifact file="${project.build.directory}/sources.jar" classifier="sources" type="jar" />
              </target>
            </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.apache.maven.plugins</groupId>
      	<artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
      	  <sourceFileExcludes>
      	    <exclude>edu/wpi/first/wpilibj/image/</exclude>
      	    <exclude>edu/wpi/first/wpilibj/camera/</exclude>
      	    <exclude>edu/wpi/first/wpilibj/visa/</exclude>
      	    <exclude>edu/wpi/first/wpilibj/SerialPort.java</exclude>
      	  </sourceFileExcludes>
		   <includeDependencySources>true</includeDependencySources>
        </configuration>
      </plugin>


      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.1</version>
        <executions>
          <execution>
            <id>install-jar</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
	</plugins>
	<pluginManagement>
	  <plugins>
		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
		<plugin>
		  <groupId>org.eclipse.m2e</groupId>
		  <artifactId>lifecycle-mapping</artifactId>
		  <version>1.0.0</version>
		  <configuration>
			<lifecycleMappingMetadata>
			  <pluginExecutions>
				<pluginExecution>
				  <pluginExecutionFilter>
					<groupId>
					  org.apache.maven.plugins
					</groupId>
					<artifactId>
					  maven-dependency-plugin
					</artifactId>
					<versionRange>[2.8,)</versionRange>
					<goals>
					  <goal>copy</goal>
					</goals>
				  </pluginExecutionFilter>
				  <action>
					<execute />
				  </action>
				</pluginExecution>
				<pluginExecution>
				  <pluginExecutionFilter>
					<groupId>org.apache.maven.plugins</groupId>
        			<artifactId>maven-dependency-plugin</artifactId>
					<versionRange>[2.8,)</versionRange>
					<goals>
					  <goal>unpack</goal>
					</goals>
				  </pluginExecutionFilter>
				  <action>
					<ignore />
				  </action>
				</pluginExecution>
			  </pluginExecutions>
			</lifecycleMappingMetadata>
		  </configuration>
		</plugin>
	  </plugins>
	</pluginManagement>
  </build>
</project>
