<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2022 - 2023, the original author or authors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>io.github.ascopes.jct</groupId>
    <artifactId>java-compiler-testing-parent</artifactId>
    <version>0.0.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>java-compiler-testing</artifactId>

  <name>Java Compiler Testing framework</name>

  <description>
    Microframework geared towards writing declarative integration tests against Java compiler
    plugins and annotation processors, with a focus on forwards-compatibility, fluency,
    and good testing practises.
  </description>

  <dependencies>
    <dependency>
      <groupId>com.google.jimfs</groupId>
      <artifactId>jimfs</artifactId>
    </dependency>

    <dependency>
      <groupId>me.xdrop</groupId>
      <artifactId>fuzzywuzzy</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apiguardian</groupId>
      <artifactId>apiguardian-api</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jspecify</groupId>
      <artifactId>jspecify</artifactId>
      <optional>true</optional>
    </dependency>

    <dependency>
      <!-- Used to provide convenience annotations -->
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <!-- v5.0.0 uses the inline mock maker by default -->
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <!--
              Disable warnings about modules. We cannot do much about some of these due to how Maven
              works with modules with Surefire.
            -->
            <arg>-Xlint:-module</arg>
          </compilerArgs>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>

        <configuration>
          <excludePackageNames>
            io.github.ascopes.jct.compilers.javac;
            io.github.ascopes.jct.**.impl;
            io.github.ascopes.jct.utils;
          </excludePackageNames>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>coverage</id>
      <activation>
        <!-- JDK-20 EA does not support JaCoCo yet due to the use of ASM -->
        <jdk>[,20)</jdk>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>mutation</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>

            <configuration>
              <!-- Don't run normal tests alongside pitest -->
              <skip>true</skip>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>

            <configuration>
              <!-- Don't run normal tests alongside pitest -->
              <skip>true</skip>
            </configuration>
          </plugin>


          <plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>

            <configuration>
              <excludedGroups>
                <excludedGroup>no-mutation</excludedGroup>
              </excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
