<?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>org.souther-lang</groupId>
        <artifactId>souther-parent</artifactId>
        <version>0.4.0</version>
    </parent>

    <artifactId>souther-runtime</artifactId>
    <name>Souther Runtime</name>

    <description>
        Runtime library for the domain world of Souther-generated bytecode: Result, Option,
        Behavior, Violation, Lists, Maps. Raoh-free — decode/encode target Raoh
        directly from generated code, not through this module (spec §codec-generation, §non-functional).
    </description>

    <!-- No release override: this ships alongside the generated classes, which target Java 25
         (spec §target-jdk), so it inherits the parent's 25 like every other module. -->

    <dependencies>
        <!-- JSpecify's nullness annotations, `provided` because nobody needs them at run time and
             nobody needs them to read them: they are class-file annotations, and a consumer's
             compiler (javac, kotlinc) takes their meaning from the name alone. So this stays off
             every downstream classpath while the guarantee still reaches Kotlin, whose accessors
             would otherwise all be platform types. -->
        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- What generated code calls beside this. Nothing here calls Raoh: a data's derived
             decoder and encoder are emitted as bytecode built from Raoh's combinators, and
             `decoder()` is generated for every exposed data — so a project holding this artifact
             holds classes that reach for Raoh the first time a behavior builds anything.

             Declared here so that nobody has to declare it. A build plugin cannot add it — what a
             plugin adds is not in the pom the project publishes, so a consumer of that project
             would not get it — and asking every project to write it is asking them to remember a
             second version. Through this one, both the project and everything downstream of it
             resolve the Raoh the Souther that produced the code was built against. -->
        <dependency>
            <groupId>net.unit8.raoh</groupId>
            <artifactId>raoh</artifactId>
        </dependency>
        <!-- The text rules a String operation, a temporal value and a pattern are run by. Generated
             code never names it: a pattern constant is a Predicate made by this module's bootstrap,
             so what a published class links against is this artifact and the JDK. -->
        <dependency>
            <groupId>net.unit8.199x</groupId>
            <artifactId>notation-199x</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.souther-lang</groupId>
            <artifactId>souther-test-support</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- The nullness gate runs here in every build, `mvn test` included, because this is the module
         whose packages declare `@NullMarked`. What the gate asks for is `errorprone.gate` in the
         root pom, including why that is a property rather than written out here.

         Which modules carry this block is not a thing to remember. A `@NullMarked` package in a
         module that does not run the gate, and a module that runs the gate and declares no such
         package, are both refused by a check in souther-bench that reads the two sets off the
         tree. -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs combine.children="append">
                        <arg>-XDcompilePolicy=simple</arg>
                        <arg>--should-stop=ifError=FLOW</arg>
                        <arg>${errorprone.gate}</arg>
                    </compilerArgs>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>com.google.errorprone</groupId>
                            <artifactId>error_prone_core</artifactId>
                            <version>${errorprone.version}</version>
                        </path>
                        <path>
                            <groupId>com.uber.nullaway</groupId>
                            <artifactId>nullaway</artifactId>
                            <version>${nullaway.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
