<?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>
    <groupId>io.dazzleduck.sql</groupId>
    <artifactId>dazzleduck-parent</artifactId>
    <version>0.0.4</version>
    <packaging>pom</packaging>
    <name>DazzleDuck Project Parent POM</name>
    <url>https://github.com/dazzleduck-web/dazzleduck-sql-server</url>
    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git@github.com:dazzleduck-web/dazzleduck-sql-server.git</connection>
        <url>scm:git:git@github.com:dazzleduck-web/dazzleduck-sql-server.git</url>
        <tag>HEAD</tag>
    </scm>
    <developers>
        <developer>
            <name>Gagan Taneja</name>
            <email>tanejagaga@gmail.com</email>
        </developer>
    </developers>
    <description>Arror flight and Http Server backend using DuckDB</description>
    <modules>
        <module>dazzleduck-sql-common</module>
        <module>dazzleduck-sql-http</module>
        <module>dazzleduck-sql-flight</module>
        <module>dazzleduck-sql-commons</module>
        <module>dazzleduck-sql-search</module>
        <module>dazzleduck-sql-runtime</module>
    </modules>
    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <arrow.version>18.3.0</arrow.version>
        <duckdb.version>1.3.2.0</duckdb.version>
        <typesafe-config.version>1.4.3</typesafe-config.version>
        <calcite.version>1.25.0</calcite.version>
	<slf4j.version>2.0.16</slf4j.version>
	<gpg.keyname>BC7688F69A9CF5D5</gpg.keyname>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jcommander</groupId>
            <artifactId>jcommander</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.typesafe</groupId>
            <artifactId>config</artifactId>
            <version>${typesafe-config.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.12.6</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <version>0.3.1</version>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>directory-of</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <property>maven-parent.basedir</property>
                            <project>
                                <groupId>io.dazzleduck.sql</groupId>
                                <artifactId>dazzleduck-parent</artifactId>
                            </project>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
                <configuration>
                    <argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.4.4</version>
                <configuration>
                    <from>
                        <image>eclipse-temurin:21-jre-jammy</image>
                    </from>
                    <to>
                        <image>docker.io/dazzleduck/dazzleduck</image>
                        <tags>
                            <tag>${project.version}</tag> <!-- Tags the image with your project version -->
                            <tag>latest</tag> <!-- Adds a 'latest' tag -->
                        </tags>
                    </to>
                    <container>
                        <mainClass>io.dazzleduck.sql.runtime.Main</mainClass>
                        <jvmFlags>
                            <jvmFlag>-Xms512m</jvmFlag>
                            <jvmFlag>-XX:+UseContainerSupport</jvmFlag>
                            <jvmFlag>-XX:+UseG1GC</jvmFlag>
                            <jvmFlag>-XX:+UseStringDeduplication</jvmFlag>
                            <jvmFlag>-XX:+ExitOnOutOfMemoryError</jvmFlag>
                            <jvmFlag>--add-opens=java.base/sun.nio.ch=ALL-UNNAMED</jvmFlag>
                            <jvmFlag>--add-opens=java.base/java.nio=ALL-UNNAMED</jvmFlag>
                            <jvmFlag>--add-opens=java.base/sun.util.calendar=ALL-UNNAMED</jvmFlag>
                        </jvmFlags>
                    </container>
                    <extraDirectories>
                        <paths>
                            <path>
                                <from>${maven-parent.basedir}/example</from>
                                <into>/data</into>
                            </path>
                        </paths>
                    </extraDirectories>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>bundle-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.7.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <executions>
                    <execution>
                        <id>bundle-javadoc</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>bundle-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
