<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>io.jstach.rainbowgum</groupId>
    <artifactId>rainbowgum-maven-parent</artifactId>
    <version>0.15.1</version>
  </parent>
  <artifactId>rainbowgum-slf4j</artifactId>
  <name>rainbowgum-slf4j</name>
  <properties>
    <doc.resources>../</doc.resources>
    <parent.root>${basedir}/..</parent.root>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rainbowgum-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.jstach.pistachio</groupId>
      <artifactId>pistachio-svc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.jstach.pistachio</groupId>
      <artifactId>pistachio-svc-apt</artifactId>
    </dependency>
    <dependency>
      <groupId>io.jstach</groupId>
      <artifactId>jstachio-annotation</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.jstach</groupId>
      <artifactId>jstachio-apt</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
  </dependencies>
  <profiles>
    <!--
      The errorprone/nullaway profiles (rainbowgum-maven-parent) each set an explicit
      annotationProcessorPaths list that replaces automatic processor discovery
      module-wide - fine for most modules, but this one's test sources use jstachio-apt
      (CodeTemplates.java's @JStache-annotated models, consumed by
      ChangeLoggerGenerateTest/LevelLoggerTest) which isn't in that shared list, so it's
      appended here. Once jstachio-apt runs, its own generated renderer sources are
      themselves noisy under errorprone/nullaway (jstachio's generated code, not ours) -
      compilerArgs is overridden (not just appended to) so -XepExcludedPaths can be added
      to the single -Xplugin:ErrorProne argument string, keeping analysis scoped to our
      own sources; only compilerArgs is touched, so release/encoding/failOnWarning etc.
      from rainbowgum-maven-parent's pluginManagement still apply normally. Keep the
      compilerArgs values below in sync with rainbowgum-maven-parent's own
      errorprone/nullaway profiles if those ever change.
    -->
    <!--
      MDCAdapter.astub (etc/eea/checker/org.slf4j) teaches checkerframework SLF4J's real
      (undocumented) nullability contract for org.slf4j.spi.MDCAdapter - see
      https://github.com/qos-ch/slf4j/issues/493. Scoped to this module's own
      checkerframework profile (rather than the shared root-pom one) because
      org.slf4j.spi.MDCAdapter isn't resolvable from modules that don't depend on
      slf4j-api - checkerframework only warns when a stub references an unresolvable
      type, but -Werror turns that into a hard failure everywhere else in the reactor.
    -->
    <profile>
      <id>checkerframework</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs combine.children="append">
                <arg>-Astubs=${checker.stubs}/org.slf4j</arg>
              </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>errorprone</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs combine.self="override">
                <arg>-XDcompilePolicy=simple</arg>
                <arg>-XDshould-stop.ifError=FLOW</arg>
                <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/generated-test-sources/.*</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
              </compilerArgs>
              <annotationProcessorPaths combine.children="append">
                <path>
                  <groupId>io.jstach</groupId>
                  <artifactId>jstachio-apt</artifactId>
                  <version>${jstachio.version}</version>
                </path>
              </annotationProcessorPaths>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>nullaway</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs combine.self="override">
                <arg>-XDcompilePolicy=simple</arg>
                <arg>-XDshould-stop.ifError=FLOW</arg>
                <arg>-XDaddTypeAnnotationsToSymbol=true</arg>
                <arg>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=io.jstach -XepOpt:NullAway:JSpecifyMode=true -XepOpt:NullAway:HandleTestAssertionLibraries=true -XepExcludedPaths:.*/generated-test-sources/.*</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
              </compilerArgs>
              <annotationProcessorPaths combine.children="append">
                <path>
                  <groupId>io.jstach</groupId>
                  <artifactId>jstachio-apt</artifactId>
                  <version>${jstachio.version}</version>
                </path>
              </annotationProcessorPaths>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
