<?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>

  <groupId>net.ksmr</groupId>
  <artifactId>sched</artifactId>
  <version>0.1.0</version>

  <name>sched</name>
  <description>A small Java library to set the CPU affinity mask of the current thread.</description>
  <url>https://github.com/ksmr/sched</url>

  <developers>
    <developer>
      <name>Kasimir Torri</name>
      <email>ksmr@ksmr.net</email>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git://github.com/ksmr/sched.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/ksmr/sched.git</developerConnection>
    <url>https://github.com/ksmr/sched/tree/master</url>
    <tag>sched-0.1.0</tag>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.0.0-M1</version>
          <configuration>
            <pushChanges>false</pushChanges>
            <useReleaseProfile>false</useReleaseProfile>
            <releaseProfiles>release</releaseProfiles>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <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-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>amd64</id>
      <activation>
        <os>
          <family>linux</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
	    <artifactId>maven-antrun-plugin</artifactId>
	    <version>1.7</version>
	    <executions>
	      <execution>
	        <phase>process-classes</phase>
	        <configuration>
	          <target name="jni" description="Compile the native code">
		    <exec executable="make">
                      <arg value="CC=gcc" />
                      <arg value="ARCH=amd64" />
                    </exec>
                  </target>
	        </configuration>
	        <goals>
	          <goal>run</goal>
	        </goals>
	      </execution>
	    </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>aarch64-cc</id>
      <build>
        <plugins>
          <plugin>
	    <artifactId>maven-antrun-plugin</artifactId>
	    <version>1.7</version>
	    <executions>
	      <execution>
                <id>amd64-make</id>
	        <phase>process-classes</phase>
	        <configuration>
	          <target name="jni" description="Compile the native code">
		    <exec executable="make">
                      <arg value="CC=gcc" />
                      <arg value="ARCH=amd64" />
                    </exec>
                  </target>
	        </configuration>
	        <goals>
	          <goal>run</goal>
	        </goals>
	      </execution>
	      <execution>
                <id>aarch64-make</id>
	        <phase>process-classes</phase>
	        <configuration>
	          <target name="jni" description="Compile the native code">
		    <exec executable="make">
                      <arg value="CC=aarch64-linux-gnu-gcc" />
                      <arg value="ARCH=aarch64" />
                    </exec>
                  </target>
	        </configuration>
	        <goals>
	          <goal>run</goal>
	        </goals>
	      </execution>
	    </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
