<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.intel.pmem</groupId>
    <artifactId>llpl</artifactId>
    <version>1.2.0-release</version>
    <packaging>jar</packaging>
    <name>LLPL</name>
    <description>This project will provide APIs to interface with persistent memory</description>
    <url>https://github.com/pmem/llpl</url>
    <licenses>
      <license>
        <name>BSD-3-Clause</name>
        <url>https://opensource.org/licenses/BSD-3-Clause</url>
      </license>
    </licenses>
    <developers>
      <developer>
        <name>Olasoji Denloye</name>
        <email>olasoji.denloye@intel.com</email>
        <organization>Intel</organization>
        <organizationUrl></organizationUrl>
      </developer>
    </developers>

    <scm>
      <connection>scm:git:git://github.com/pmem/llpl.git</connection>
      <developerConnection>scm:git:git@github.com:pmem/llpl.git</developerConnection>
      <url>https://github.com/pmem/llpl/tree/master</url>
    </scm>

    <distributionManagement>
      <snapshotRepository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      </snapshotRepository>
      <repository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/
      </url>
      </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
	<plugins>
	    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                    <id>enforce-property</id>
                    <goals>
                        <goal>enforce</goal>
                        </goals>
                        <configuration>
                        <rules>
                            <requireProperty>
                            <property>test.heap.path</property>
                            <message>You must set a test.heap.path property to run tests!</message>
                            </requireProperty>
                        </rules>
                        <fail>false</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
		<version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>build-cpp</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <mkdir dir="${project.build.directory}/cppbuild"/>
                                <exec executable="cmake" dir="${project.build.directory}/cppbuild" failonerror="true">
                                    <arg line="${basedir}/src/main/cpp "/>
                                </exec>
                                <exec executable="make" dir="${project.build.directory}/cppbuild" failonerror="true">
                                    <arg line="VERBOSE=1"/>
                                </exec>
                                <copy file="${project.build.directory}/cppbuild/libllpl.so" tofile="${project.build.directory}/classes/com/intel/pmem/llpl/linux/amd64/libllpl.so"/>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean-native</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo>Builddir: ${project.build.directory}</echo>
                                <echo>Basedir: ${basedir}</echo>
                                <delete dir="${project.build.directory}/cppbuild"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
			<!--argLine>@{argLine} -Djava.library.path=${project.build.directory}/cppbuild</argLine-->
			<suiteXmlFiles>
				<suiteXmlFile>testng.xml</suiteXmlFile>
			</suiteXmlFiles>
                </configuration>
	    </plugin>
        <plugin>
	    	<groupId>org.apache.maven.plugins</groupId>
        	<artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
	    </plugin>
	    <plugin>
	    	<groupId>org.apache.maven.plugins</groupId>
        	<artifactId>maven-javadoc-plugin</artifactId>
            <version>3.1.1</version>
            <configuration>
                <source>8</source>
                <javadocVersion>1.0.0</javadocVersion>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
	    </plugin>
	<plugin>
  		<groupId>org.jacoco</groupId>
  		<artifactId>jacoco-maven-plugin</artifactId>
  		<version>0.8.5</version>
		<configuration>
   			<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
   			<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
		</configuration>
  		<executions>
   			<execution>
				<id>jacoco-initialize</id>
    				<goals>
     					<goal>prepare-agent</goal>
				</goals>
   			</execution>
			<execution>
    				<id>jacoco-report</id>
    				<phase>test</phase>
    				<goals>
     					<goal>report</goal>
				</goals>
			</execution>
			<!--<execution>
                        <id>jacoco-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>PACKAGE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.9</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
		    </configuration>
	    </execution>-->
		</executions>
	</plugin>
        </plugins>
    </build>
    <dependencies>
	    <dependency>
	  	<groupId>org.testng</groupId>
  	    	<artifactId>testng</artifactId>
  	    	<version>7.0.0</version>
	    	<scope>test</scope>
	    </dependency>
    </dependencies>
</project>
