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

  <parent>
    <groupId>com.dylibso.chicory</groupId>
    <artifactId>chicory</artifactId>
    <version>1.7.3</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>simd</artifactId>
  <packaging>jar</packaging>
  <name>Chicory - SIMD</name>
  <description>SIMD instructions support for Chicory</description>

  <properties>
    <maven.compiler.release>25</maven.compiler.release>

    <!-- TODO: fixme working around "[WARNING] using incubating module(s): jdk.incubator.vector" -->
    <maven.compiler.failOnWarning>false</maven.compiler.failOnWarning>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>wasm</artifactId>
    </dependency>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>wasm-corpus</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <arg>--add-modules</arg>
            <arg>jdk.incubator.vector</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <!-- TODO: find a better way to do this -->
          <!-- Workaround: "MavenReportException: Error while generating Javadoc:" -->
          <failOnError>false</failOnError>
          <failOnWarnings>false</failOnWarnings>
          <additionalJOption>-Xdoclint:none</additionalJOption>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>--add-modules=jdk.incubator.vector</argLine>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>templating-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>filter-src</id>
            <goals>
              <goal>filter-sources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>java21</id>
      <activation>
        <jdk>21</jdk>
      </activation>
      <properties>
        <maven.compiler.release>21</maven.compiler.release>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>templating-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>filter-src</id>
                <goals>
                  <goal>filter-sources</goal>
                </goals>
                <configuration>
                  <sourceDirectory>${basedir}/src/main/java-templates-21</sourceDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
