<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>io.github.habedi</groupId>
  <artifactId>multi-vector-hnsw</artifactId>
  <version>0.2.1</version>
  <packaging>jar</packaging>

  <name>Multi-Vector HNSW</name>
  <description>A Java implementation of HNSW with multi-vector support</description>
  <url>https://github.com/habedi/multi-vector-hnsw</url>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://github.com/habedi/multi-vector-hnsw/blob/main/LICENSE-MIT</url>
    </license>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>https://github.com/habedi/multi-vector-hnsw/blob/main/LICENSE-APACHE</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Hassan Abedi</name>
      <email>hassan.abedi@gmail.com</email>
      <organization>io.github.habedi</organization>
      <organizationUrl>https://github.com/habedi</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/habedi/multi-vector-hnsw.git</connection>
    <developerConnection>scm:git:ssh://github.com:habedi/multi-vector-hnsw.git</developerConnection>
    <url>https://github.com/habedi/multi-vector-hnsw/tree/main</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>17</java.version>
    <junit.jupiter.version>5.10.2</junit.jupiter.version>
    <log4j.version>2.23.1</log4j.version>
    <jmh.version>1.37</jmh.version>
    <picocli.version>4.7.6</picocli.version>
    <jackson.version>2.17.1</jackson.version>
    <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
    <maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
    <maven.deploy.plugin.version>3.1.2</maven.deploy.plugin.version>
    <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
    <maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version>
    <build-helper.maven.plugin.version>3.6.0</build-helper.maven.plugin.version>
    <maven.shade.plugin.version>3.5.3</maven.shade.plugin.version>
    <jacoco.maven.plugin.version>0.8.12</jacoco.maven.plugin.version>
    <spotless.maven.plugin.version>2.43.0</spotless.maven.plugin.version>
    <maven.checkstyle.plugin.version>3.3.1</maven.checkstyle.plugin.version>
    <checkstyle.version>10.17.0</checkstyle.version>
    <central.publishing.plugin.version>0.8.0</central.publishing.plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-bom</artifactId>
        <version>${log4j.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <release>${java.version}</release>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
        <configuration>
          <argLine>
            ${argLine} --add-modules jdk.incubator.vector --add-opens
            org.apache.logging.log4j.core/org.apache.logging.log4j.core.config.plugins=org.apache.logging.log4j.core
            --add-opens
            org.apache.logging.log4j.core/org.apache.logging.log4j.core.config.plugins.util=org.apache.logging.log4j.core
            --add-opens
            org.apache.logging.log4j.core/org.apache.logging.log4j.core.config.plugins.convert=org.apache.logging.log4j.core
            --add-opens
            org.apache.logging.log4j.core/org.apache.logging.log4j.core.lookup=org.apache.logging.log4j.core
          </argLine>
          <systemPropertyVariables>
            <mv.hnsw.log.level>warn</mv.hnsw.log.level>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${maven.source.plugin.version}</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.maven.plugin.version}</version>
        <configuration>
          <java>
            <googleJavaFormat>
              <version>1.19.2</version>
              <style>GOOGLE</style>
            </googleJavaFormat>
          </java>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>google_checks.xml</configLocation>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.maven.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>benchmark</id>
      <dependencies>
        <dependency>
          <groupId>info.picocli</groupId>
          <artifactId>picocli</artifactId>
          <version>${picocli.version}</version>
        </dependency>
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>${jackson.version}</version>
        </dependency>
        <dependency>
          <groupId>org.openjdk.jmh</groupId>
          <artifactId>jmh-core</artifactId>
          <version>${jmh.version}</version>
        </dependency>
        <dependency>
          <groupId>org.openjdk.jmh</groupId>
          <artifactId>jmh-generator-annprocess</artifactId>
          <version>${jmh.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>${build-helper.maven.plugin.version}</version>
            <executions>
              <execution>
                <id>add-benchmark-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/benchmark/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin.version}</version>
            <configuration>
              <release>${java.version}</release>
              <compilerArgs>
                <arg>--add-reads</arg>
                <arg>io.github.habedi.mvhnsw=ALL-UNNAMED</arg>
              </compilerArgs>
              <annotationProcessorPaths>
                <path>
                  <groupId>info.picocli</groupId>
                  <artifactId>picocli-codegen</artifactId>
                  <version>${picocli.version}</version>
                </path>
                <path>
                  <groupId>org.openjdk.jmh</groupId>
                  <artifactId>jmh-generator-annprocess</artifactId>
                  <version>${jmh.version}</version>
                </path>
              </annotationProcessorPaths>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>${maven.shade.plugin.version}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <finalName>benchmarks</finalName>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                      <mainClass>io.github.habedi.mvhnsw.bench.BenchmarkCLI</mainClass>
                    </transformer>
                  </transformers>
                  <filters>
                    <filter>
                      <artifact>*:*</artifact>
                      <excludes>
                        <exclude>module-info.class</exclude>
                      </excludes>
                    </filter>
                  </filters>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${central.publishing.plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>${maven.deploy.plugin.version}</version>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</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>3.2.4</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
