<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>com.julien-dubois.bootui</groupId>
        <artifactId>bootui-parent</artifactId>
        <version>1.18.0</version>
    </parent>

    <artifactId>bootui-engine</artifactId>
    <name>BootUI :: Engine</name>
    <description>Framework-neutral services and advisor engines that implement BootUI behavior for every adapter.</description>

    <dependencies>
        <dependency>
            <groupId>com.julien-dubois.bootui</groupId>
            <artifactId>bootui-core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
        </dependency>

        <!--
          ArchUnit powers the framework-neutral architecture/readiness advisor engines. It is static
          bytecode analysis (not a host framework or transport API), so it is allowed by the engine
          boundary tripwire, analogous to the sanctioned Micrometer dependency.
          ThreadFactory analysis reuses ArchUnit's embedded ASM; do not bundle a second reader.
        -->
        <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit</artifactId>
        </dependency>

        <!--
          jakarta.persistence is a neutral JCP standard (same API on Spring Boot and Quarkus). Optional so it
          is not forced on the engine's downstream consumers; JpaMetamodelReader is the sole importer and is
          only invoked from the Spring/Quarkus adapter behind a @ConditionalOnClass / CDI presence gate.
        -->
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <optional>true</optional>
        </dependency>

        <!--
          OpenTelemetry SDK powers the in-process span capture (BootUiSpanExporter) feeding TelemetryStore.
          Optional so it is not forced on the engine's downstream consumers; BootUiSpanExporter is the sole
          importer (pinned by an ArchUnit concentration rule) and is only constructed by the adapter behind a
          @ConditionalOnClass / CDI presence gate. Versions are BOM-managed (spring-boot-dependencies).
        -->
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk-trace</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.9.16</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5</artifactId>
            <scope>test</scope>
        </dependency>

        <!--
          Test-scope only: the architecture rule-detection tests need real framework-annotated bytecode
          (e.g. @Service, @Transactional, @RestController, BeanPostProcessor, and plain jakarta.inject /
          jakarta.transaction annotations for the CDI/Quarkus-neutrality fixtures) to verify the curated
          rules fire correctly. These never reach the production classpath, and the engine boundary
          tripwire excludes test classes (DoNotIncludeTests), so the engine stays framework-neutral in
          production.
        -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>test</scope>
        </dependency>
        <!--
          Test-scope only: lets CRaC readiness fixtures implement org.crac.Resource to verify the
          managed-lifecycle call-site exemption (see ManagedLifecycleCallSites in CracChecks.java).
          Version is managed by the Spring Boot BOM imported at the root pom.
        -->
        <dependency>
            <groupId>org.crac</groupId>
            <artifactId>crac</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webflux</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>javax.transaction-api</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.transaction</groupId>
            <artifactId>jakarta.transaction-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <!--
          Test-scope only: JAX-RS fixtures prove the shared RestApiHandlerModelBuilder recognizes the
          idiomatic Quarkus reactive/typed-response and OpenAPI annotation styles exactly as it does the
          Spring Reactor/springdoc equivalents (RAPI-DTO/-PAGE/-NAME/-DOC rules must not blind-spot Quarkus).
          Versions are pinned directly (bootui-engine intentionally never imports the quarkus-bom) but are
          otherwise inert: these fixtures are only statically bytecode-scanned by ArchUnit, never executed.
        -->
        <dependency>
            <groupId>io.smallrye.reactive</groupId>
            <artifactId>mutiny</artifactId>
            <version>3.3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus.resteasy.reactive</groupId>
            <artifactId>resteasy-reactive</artifactId>
            <version>${quarkus.platform.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.microprofile.openapi</groupId>
            <artifactId>microprofile-openapi-api</artifactId>
            <version>4.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations-jakarta</artifactId>
            <version>2.2.55</version>
            <scope>test</scope>
        </dependency>

        <!--
          Test-scope only: the Kotlin advisor fixtures (src/test/kotlin) are compiled so the Kotlin-awareness
          in KotlinBytecode is verified against bytecode a real Kotlin compiler produced — compiler-generated
          file facades/companions/$default bridges and the Continuation-based shape of a suspending function —
          rather than against a hand-written Java imitation of it. Production code never references Kotlin: it
          matches kotlin.Metadata, kotlin.coroutines.Continuation and kotlin.Unit by name only, so BootUI adds
          no Kotlin dependency to a host application and behaves identically when Kotlin is absent.
        -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>

        <!--
          Test-scope only: ARCH-SPRING-019 must stay silent for Spring Modulith's @ApplicationModuleListener,
          which composes @Async + @Transactional(REQUIRES_NEW) + @TransactionalEventListener. The fixture uses
          the real annotation so the exemption is pinned against Modulith's own composition rather than a
          hand-written imitation of it. The version is pinned directly (spring-boot-dependencies does not manage
          Spring Modulith) but is otherwise inert: the fixture is only statically bytecode-scanned by ArchUnit,
          never executed, and production code matches the annotation by name, so BootUI adds no Spring Modulith
          dependency to a host application.
        -->
        <dependency>
            <groupId>org.springframework.modulith</groupId>
            <artifactId>spring-modulith-events-api</artifactId>
            <version>2.1.1</version>
            <scope>test</scope>
        </dependency>

        <!--
          Test-scope only: JdbcActivityStoreTests exercises the plain-JDBC Live Activity persistence
          store against a real, disposable database rather than mocking java.sql.*. H2's version is
          managed by the imported spring-boot-dependencies BOM.
        -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!--
              Compiles the Kotlin advisor fixtures under src/test/kotlin before the Java test sources that
              reference them. Test scope only: no Kotlin source, and no Kotlin dependency, reaches any
              published BootUI artifact.
            -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-compile</id>
                        <phase>process-test-sources</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>${java.version}</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
