<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>tech.picnic.error-prone-support</groupId>
        <artifactId>error-prone-support</artifactId>
        <version>0.22.1-SNAPSHOT</version>
    </parent>

    <artifactId>error-prone-contrib</artifactId>

    <name>Picnic :: Error Prone Support :: Contrib</name>
    <description>Extra Error Prone plugins by Picnic.</description>
    <url>https://error-prone.picnic.tech</url>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>documentation-support</artifactId>
            <!-- This dependency is declared only as a hint to Maven that
            compilation depends on it; see the `maven-compiler-plugin`'s
            `annotationProcessorPaths` configuration below. -->
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>error-prone-utils</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>refaster-support</artifactId>
            <!-- XXX: One would expect this to be a `provided` dependency (as
            Refaster rules are interpreted by the `refaster-runner` module),
            but the `OptionalOrElseGet` bug checker defined by this module
            depends on the `RequiresComputation` matcher that
            `refaster-support` primarily exposes for use by Refaster rules.
            Review this setup. (Should the matchers be moved elsewhere?) -->
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>refaster-test-support</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.auto.service</groupId>
            <artifactId>auto-service-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.auto.value</groupId>
            <artifactId>auto-value-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- XXX: JSR-305 (meta-)annotation usage by some dependencies triggers
        NullAway to attempt to load said annotations. As such some modules
        require these annotations to be on the classpath. Periodically review
        whether we can drop this dependeny declaration. See
        https://github.com/uber/NullAway/issues/1171. -->
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_check_api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_test_helpers</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor.addons</groupId>
            <artifactId>reactor-adapter</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor.addons</groupId>
            <artifactId>reactor-extra</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.reactivex.rxjava2</groupId>
            <artifactId>rxjava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.immutables</groupId>
            <artifactId>value-annotations</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- XXX: Explicitly declared as a workaround for
        https://github.com/pitest/pitest-junit5-plugin/issues/105. -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openrewrite</groupId>
            <artifactId>rewrite-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openrewrite</groupId>
            <artifactId>rewrite-java</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openrewrite</groupId>
            <artifactId>rewrite-java-17</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openrewrite</groupId>
            <artifactId>rewrite-templating</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openrewrite</groupId>
            <artifactId>rewrite-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.reactivestreams</groupId>
            <artifactId>reactive-streams</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webflux</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <annotationProcessorPaths combine.children="append">
                            <!-- XXX: Drop the version declarations once
                            properly supported. See
                            https://youtrack.jetbrains.com/issue/IDEA-342187. -->
                            <path>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>documentation-support</artifactId>
                                <version>${project.version}</version>
                            </path>
                            <path>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>refaster-compiler</artifactId>
                                <version>${project.version}</version>
                            </path>
                            <path>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>refaster-support</artifactId>
                                <version>${project.version}</version>
                            </path>
                        </annotationProcessorPaths>
                        <compilerArgs combine.children="append">
                            <arg>-Xplugin:DocumentationGenerator -XoutputDirectory=${project.build.directory}/docs</arg>
                        </compilerArgs>
                    </configuration>
                    <executions>
                        <!-- The Refaster input/output test classes used by
                        `RefasterRuleCollection` are modelled as classpath
                        resources, and thus not subject to the default test
                        compilation step. These two custom compilation steps
                        serve two purposes:
                        - To provide early feedback in case of syntax errors.
                        - To enable the `DocumentationGenerator` compiler
                        plugin to extract documentation metadata from them.
                        Note that the input and output files must be compiled
                        separately and to distinct output directories, as they
                        define the same set of class names. -->
                        <!-- XXX: Drop these executions if/when the Refaster
                        test framework is reimplemented such that tests can be
                        located alongside rules, rather than in two additional
                        resource files. -->
                        <execution>
                            <id>compile-refaster-test-input</id>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                            <phase>process-test-resources</phase>
                            <configuration>
                                <compileSourceRoots>
                                    <compileSourceRoot>${project.basedir}/src/test/resources</compileSourceRoot>
                                </compileSourceRoots>
                                <testIncludes>
                                    <testInclude>**/*Input.java</testInclude>
                                </testIncludes>
                                <outputDirectory>${project.build.directory}/refaster-test-input</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>compile-refaster-test-output</id>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                            <phase>process-test-resources</phase>
                            <configuration>
                                <compileSourceRoots>
                                    <compileSourceRoot>${project.basedir}/src/test/resources</compileSourceRoot>
                                </compileSourceRoots>
                                <testIncludes>
                                    <testInclude>**/*Output.java</testInclude>
                                </testIncludes>
                                <outputDirectory>${project.build.directory}/refaster-test-output</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
