<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>ai.timefold.solver</groupId>
    <artifactId>timefold-solver-quarkus-benchmark-parent</artifactId>
    <version>1.1.0</version>
  </parent>

  <artifactId>timefold-solver-quarkus-benchmark-integration-test</artifactId>
  <name>Timefold Solver Quarkus Benchmark - Integration tests</name>
  <description>Quarkus integration tests for Timefold</description>

  <properties>
    <java.module.name>ai.timefold.solver.quarkus.benchmark</java.module.name>
    <!-- Code of integration tests should not be a part of test coverage reports. -->
    <sonar.coverage.exclusions>**/*</sonar.coverage.exclusions>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-arc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>ai.timefold.solver</groupId>
      <artifactId>timefold-solver-quarkus</artifactId>
    </dependency>
    <dependency>
      <groupId>ai.timefold.solver</groupId>
      <artifactId>timefold-solver-quarkus-benchmark</artifactId>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <!-- Transitive dependencies through quarkus are expected in this module. -->
            <id>analyze-only</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!--
        Benchmarker is not supported in native.
        However, Quarkus 3.2.4+ seems to have an issue where the native profile,
        if present on another unrelated module, is magically and wrongly inherited in this module.
        This means the native compilation can not be avoided and needs to be made to pass.
        Tests at runtime are then disabled.
      -->
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-1.2-api</artifactId>
        </dependency>
      </dependencies>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>${version.org.apache.logging.log4j}</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
        <quarkus.native.additional-build-args>--initialize-at-run-time=freemarker.ext.jython.JythonWrapper</quarkus.native.additional-build-args>
        <quarkus.native.report-errors-at-runtime>true</quarkus.native.report-errors-at-runtime>
      </properties>
    </profile>
  </profiles>
</project>
