<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.github.pcodec</groupId>
  <artifactId>pco-jni</artifactId>
  <version>0.1.3</version>

  <packaging>jar</packaging>
  <name>${project.groupId}:${project.artifactId}</name>
  <description>Good compression for numerical sequences</description>
  <url>https://github.com/pcodec/pcodec</url>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>mwlon</id>
      <name>Martin Loncaric</name>
      <email>m.w.loncaric@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/pcodec/pcodec.git</connection>
    <developerConnection>scm:git:ssh://github.com:pcodec/pcodec.git</developerConnection>
    <url>https://github.com/pcodec/pcodec</url>
  </scm>

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

  <dependencies>
    <dependency>
      <groupId>org.questdb</groupId>
      <artifactId>jar-jni</artifactId>
      <version>1.2.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>generate-native-headers</id>
            <phase>compile</phase>
            <configuration>
              <target>
                <exec executable="javah">
                  <arg value="-d"/>
                  <arg value="${project.build.directory}/native/include"/>
                  <arg value="-cp"/>
                  <arg value="${project.build.outputDirectory}"/>
                  <arg value="io.github.pcodec.Standalone"/>
                </exec>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.2.7</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.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>3.11.2</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.7.0</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>rust</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.questdb</groupId>
            <artifactId>rust-maven-plugin</artifactId>
            <version>1.2.0</version>
            <executions>
              <execution>
                <id>rust-build-id</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <environmentVariables>
                    <RUSTFLAGS>-C lto=true -C embed-bitcode=true -Zdylib-lto</RUSTFLAGS>
                  </environmentVariables>
                  <path>src/main/rust</path>
                  <copyTo>${project.build.directory}/classes/io/github/pcodec</copyTo>
                  <copyWithPlatformDir>true</copyWithPlatformDir>
                  <release>true</release>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

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