<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>activejdbc-kt</artifactId>
    <packaging>jar</packaging>
    <version>3.4-j11</version>
    <name>JavaLite - ActiveJDBC ORM Framework (for Kotlin)</name>

    <parent>
        <groupId>org.javalite</groupId>
        <artifactId>javalite</artifactId>
        <version>3.4-j11</version>
    </parent>

    <properties>
        <!-- Kotlin version -->
        <kotlin.version>1.4.32</kotlin.version>
        <kotlin.compiler.languageVersion>1.4</kotlin.compiler.languageVersion>
        <jvm.version>11</jvm.version>

        <!-- Kotlin version -->
        <kotlin.source.directory>${project.basedir}/src/main/kt</kotlin.source.directory>
        <kotlin.test.directory>${project.basedir}/src/test/kt</kotlin.test.directory>

        <!-- H2DB config for tests -->
        <jdbc.driver>org.h2.Driver</jdbc.driver>
        <jdbc.url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</jdbc.url>
        <jdbc.user>sa</jdbc.user>
        <jdbc.password />
        <db>h2</db>
    </properties>


    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <!-- Specify where kotlin sources are -->
        <sourceDirectory>${kotlin.source.directory}</sourceDirectory>
        <testSourceDirectory>${kotlin.test.directory}</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>1.4.30</version>
                <executions>
                    <execution>
                        <id>kotlin-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <impliedPlatforms>
                        <platform>JVM</platform>
                    </impliedPlatforms>

                    <jdkVersion>${jvm.version}</jdkVersion>
                    <noStdlibLink>true</noStdlibLink>
                    <noJdkLink>true</noJdkLink>

                    <outputDirectory>${project.build.directory}</outputDirectory>
                    <outputFormat>javadoc</outputFormat>

                    <skipEmptyPackages>true</skipEmptyPackages>

                    <sourceDirectories>
                        <dir>${kotlin.source.directory}</dir>
                    </sourceDirectories>

                    <sourceRoots>
                        <root>
                            <path>${kotlin.source.directory}</path>
                            <platforms>JVM</platforms>
                        </root>
                    </sourceRoots>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <configuration>
                    <nowarn>false</nowarn>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.javalite</groupId>
                <artifactId>activejdbc-instrumentation</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>instrument</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.basedir}/target/test-classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.javassist</groupId>
                        <artifactId>javassist</artifactId>
                        <version>${javassist.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

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

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

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

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

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>activejdbc</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>

        <dependency>
            <groupId>org.javalite</groupId>
            <artifactId>app-config</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
