<?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" child.project.url.inherit.append.path="false" 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>io.airlift</groupId>
        <artifactId>airbase</artifactId>
        <version>264</version>
    </parent>

    <groupId>org.lance</groupId>
    <artifactId>lance-trino-root</artifactId>
    <version>0.3.2</version>
    <packaging>pom</packaging>

    <name>${project.artifactId}</name>
    <description>Lance Trino Connector</description>
    <url>https://lance.org/integrations/trino</url>

    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Lance DB Dev Group</name>
            <email>dev@lance.org</email>
        </developer>
    </developers>

    <modules>
        <module>plugin/trino-lance</module>
    </modules>

    <scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
        <connection>scm:git:git@github.com:lance-format/lance-trino.git</connection>
        <developerConnection>scm:git:git@github.com:lance-format/lance-trino.git</developerConnection>
        <tag>HEAD</tag>
        <url>git@github.com:lance-format/lance-trino.git</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <trino.version>476</trino.version>

        <project.build.targetJdk>23</project.build.targetJdk>
        <air.check.skip-spotbugs>true</air.check.skip-spotbugs>
        <air.check.skip-pmd>true</air.check.skip-pmd>
        <air.check.skip-jacoco>true</air.check.skip-jacoco>
        <air.java.version>23.0.0</air.java.version>
        <air.modernizer.java-version>8</air.modernizer.java-version>
        <air.test.jvmsize>3g</air.test.jvmsize>
        <air.test.jvm.additional-arguments.default>-XX:G1HeapRegionSize=32M
            -XX:+UnlockDiagnosticVMOptions
            -XX:+EnableDynamicAgentLoading
            ${extraJavaVectorArgs}
            -Djava.security.manager=allow</air.test.jvm.additional-arguments.default>
        <air.test.jvm.additional-arguments>${air.test.jvm.additional-arguments.default}</air.test.jvm.additional-arguments>

        <dep.airlift.version>336</dep.airlift.version>
        <dep.antlr.version>4.13.2</dep.antlr.version>
        <dep.kafka-clients.version>3.9.0</dep.kafka-clients.version>
        <dep.protobuf.version>3.25.5</dep.protobuf.version>

        <extraJavaVectorArgs>--add-modules=jdk.incubator.vector</extraJavaVectorArgs>
        <provisio.fallbackTargetFileNameMode>GA</provisio.fallbackTargetFileNameMode>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.airlift</groupId>
                <artifactId>bom</artifactId>
                <version>${dep.airlift.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-bom</artifactId>
                <version>4.1.119.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.arrow</groupId>
                <artifactId>arrow-bom</artifactId>
                <version>18.3.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>1.20.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.29.29</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>${dep.protobuf.version}</version>
            </dependency>

            <dependency>
                <groupId>io.airlift</groupId>
                <artifactId>junit-extensions</artifactId>
                <version>2</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-cache</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-main</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-main</artifactId>
                <version>${trino.version}</version>
                <type>test-jar</type>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-plugin-toolkit</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-plugin-toolkit</artifactId>
                <version>${trino.version}</version>
                <type>test-jar</type>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-spi</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-spi</artifactId>
                <version>${trino.version}</version>
                <type>test-jar</type>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-testing</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-testing-kafka</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino</groupId>
                <artifactId>trino-tpch</artifactId>
                <version>${trino.version}</version>
            </dependency>

            <dependency>
                <groupId>io.trino.tpch</groupId>
                <artifactId>tpch</artifactId>
                <version>1.4</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>${dep.antlr.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.avro</groupId>
                <artifactId>avro</artifactId>
                <version>1.12.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.17.0</version>
            </dependency>

            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>${dep.kafka-clients.version}</version>
            </dependency>

            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>26.0.1</version>
            </dependency>

            <dependency>
                <groupId>org.openjdk.jol</groupId>
                <artifactId>jol-core</artifactId>
                <version>0.17</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.basepom.maven</groupId>
                    <artifactId>duplicate-finder-maven-plugin</artifactId>
                    <configuration>
                        <exceptions combine.children="append">
                            <exception>
                                <conflictingDependencies>
                                    <dependency>
                                        <groupId>org.apache.httpcomponents</groupId>
                                        <artifactId>httpclient</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>org.apache.httpcomponents.client5</groupId>
                                        <artifactId>httpclient5</artifactId>
                                    </dependency>
                                </conflictingDependencies>
                                <resources>
                                    <resource>mozilla/public-suffix-list.txt</resource>
                                </resources>
                            </exception>
                        </exceptions>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.gaul</groupId>
                    <artifactId>modernizer-maven-plugin</artifactId>
                    <configuration>
                        <violationsFiles>
                            <violationsFile>${air.main.basedir}/.mvn/modernizer/violations.xml</violationsFile>
                        </violationsFiles>
                        <exclusionPatterns>
                            <exclusionPattern>org/joda/time/.*</exclusionPattern>
                        </exclusionPatterns>
                        <exclusions>
                            <exclusion>com/google/common/collect/Iterables.getOnlyElement:(Ljava/lang/Iterable;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.getOnlyElement:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.getLast:(Ljava/lang/Iterable;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.getLast:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.transform:(Ljava/lang/Iterable;Lcom/google/common/base/Function;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Lists.transform:(Ljava/util/List;Lcom/google/common/base/Function;)Ljava/util/List;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.isEmpty:(Ljava/lang/Iterable;)Z</exclusion>
                            <exclusion>com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.all:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Z</exclusion>
                            <exclusion>com/google/common/collect/Iterables.any:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Z</exclusion>
                            <exclusion>com/google/common/collect/Iterables.skip:(Ljava/lang/Iterable;I)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.limit:(Ljava/lang/Iterable;I)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.get:(Ljava/lang/Iterable;I)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.getFirst:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.getLast:(Ljava/lang/Iterable;)Ljava/lang/Object;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.cycle:(Ljava/lang/Iterable;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/collect/Iterables.cycle:([Ljava/lang/Object;)Ljava/lang/Iterable;</exclusion>
                            <exclusion>com/google/common/io/BaseEncoding.base64:()Lcom/google/common/io/BaseEncoding;</exclusion>
                            <exclusion>com/google/inject/Provider</exclusion>
                        </exclusions>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>io.trino</groupId>
                <artifactId>trino-maven-plugin</artifactId>
                <version>15</version>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <groupId>ca.vanzyl.provisio.maven.plugins</groupId>
                <artifactId>provisio-maven-plugin</artifactId>
                <version>1.1.1</version>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <groupId>org.gaul</groupId>
                <artifactId>modernizer-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>modernizer-production-code</id>
                        <goals>
                            <goal>modernizer</goal>
                        </goals>
                        <configuration>
                            <violationsFiles>
                                <violationsFile>${air.main.basedir}/.mvn/modernizer/violations-production-code-only.xml</violationsFile>
                            </violationsFiles>
                            <includeTestClasses>false</includeTestClasses>
                            <ignorePackages>
                                <ignorePackage>io.trino.testing</ignorePackage>
                                <ignorePackage>io.trino.tests.product</ignorePackage>
                                <ignorePackage>io.trino.tests.product.hive</ignorePackage>
                                <ignorePackage>io.trino.tests.product.iceberg</ignorePackage>
                                <ignorePackage>io.trino.verifier</ignorePackage>
                            </ignorePackages>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <junit.jupiter.execution.timeout.thread.mode.default>SEPARATE_THREAD</junit.jupiter.execution.timeout.thread.mode.default>
                        <junit.jupiter.extensions.autodetection.enabled>true</junit.jupiter.extensions.autodetection.enabled>
                        <junit.jupiter.execution.parallel.enabled>true</junit.jupiter.execution.parallel.enabled>
                        <junit.jupiter.execution.parallel.mode.default>concurrent</junit.jupiter.execution.parallel.mode.default>
                        <junit.jupiter.execution.parallel.mode.classes.default>concurrent</junit.jupiter.execution.parallel.mode.classes.default>
                    </systemPropertyVariables>
                    <includes>
                        <include>**/Test*.java</include>
                        <include>**/*Test.java</include>
                        <include>**/Benchmark*.java</include>
                    </includes>
                    <excludes>
                        <exclude>**/*jmhTest*.java</exclude>
                        <exclude>**/*jmhType*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <doclint>html,syntax</doclint>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>errorprone-compiler</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <!--suppress MavenModelInspection -->
                        <configuration combine.children="merge">
                            <!-- forking not required due to JVM flags in .mvn/jvm.config -->
                            <!-- see https://errorprone.info/docs/installation#maven -->
                            <failOnWarning>false</failOnWarning>
                            <compilerArgs>
                                <arg>-XDcompilePolicy=simple</arg>
                                <arg>--should-stop=ifError=FLOW</arg>
                                <arg>-Xplugin:ErrorProne \
                                    -Xep:AlmostJavadoc:ERROR \
                                    -Xep:AmbiguousMethodReference:ERROR \
                                    -Xep:AnnotateFormatMethod:ERROR \
                                    -Xep:ArgumentSelectionDefectChecker:ERROR \
                                    -Xep:ArrayAsKeyOfSetOrMap:ERROR \
                                    -Xep:AssertEqualsArgumentOrderChecker:ERROR \
                                    -Xep:AssertThrowsMultipleStatements:ERROR \
                                    -Xep:AssertionFailureIgnored:ERROR \
                                    -Xep:AttemptedNegativeZero:ERROR \
                                    -Xep:BadComparable:ERROR \
                                    -Xep:BadInstanceof:ERROR \
                                    -Xep:BigDecimalEquals:ERROR \
                                    -Xep:BoxedPrimitiveConstructor:ERROR \
                                    -Xep:ByteBufferBackingArray:ERROR \
                                    -Xep:CacheLoaderNull:ERROR \
                                    -Xep:CanonicalDuration:ERROR \
                                    -Xep:CatchAndPrintStackTrace:ERROR \
                                    -Xep:CatchFail:ERROR \
                                    -Xep:ClassCanBeStatic:ERROR \
                                    -Xep:ClassName:ERROR \
                                    -Xep:ClassNewInstance:ERROR \
                                    -Xep:CollectionUndefinedEquality:ERROR \
                                    -Xep:CollectorShouldNotUseState:ERROR \
                                    -Xep:CompareToZero:ERROR \
                                    -Xep:DateChecker:ERROR \
                                    -Xep:DateFormatConstant:ERROR \
                                    -Xep:DefaultCharset:ERROR \
                                    -Xep:DepAnn:ERROR \
                                    -Xep:DeprecatedVariable:ERROR \
                                    -Xep:DistinctVarargsChecker:ERROR \
                                    -Xep:DoNotCallSuggester:OFF \
                                    -Xep:DoubleCheckedLocking:ERROR \
                                    -Xep:EmptyBlockTag:ERROR \
                                    -Xep:EmptySetMultibindingContributions:ERROR \
                                    -Xep:EqualsGetClass:OFF \
                                    -Xep:EqualsIncompatibleType:ERROR \
                                    -Xep:EqualsUnsafeCast:ERROR \
                                    -Xep:EqualsUsingHashCode:ERROR \
                                    -Xep:ErroneousBitwiseExpression:ERROR \
                                    -Xep:ErroneousThreadPoolConstructorChecker:ERROR \
                                    -Xep:EscapedEntity:ERROR \
                                    -Xep:ExtendingJUnitAssert:ERROR \
                                    -Xep:ExtendsObject:ERROR \
                                    -Xep:FallThrough:ERROR \
                                    -Xep:Finalize:ERROR \
                                    -Xep:GetClassOnEnum:ERROR \
                                    -Xep:GuardedBy:${trino.error-prone.guarded-by} \
                                    -Xep:HidingField:ERROR \
                                    -Xep:JavaTimeDefaultTimeZone:OFF \
                                    -Xep:JdkObsolete:OFF \
                                    -Xep:Immutable:OFF \
                                    -Xep:ImmutableEnumChecker:OFF \
                                    -Xep:ImmutableSetForContains:ERROR \
                                    -Xep:InconsistentCapitalization:ERROR \
                                    -Xep:InconsistentHashCode:ERROR \
                                    -Xep:InjectOnConstructorOfAbstractClass:ERROR \
                                    -Xep:InvalidInlineTag:ERROR \
                                    -Xep:MisleadingEscapedSpace:OFF \
                                    -Xep:MissingCasesInEnumSwitch:ERROR \
                                    -Xep:MissingOverride:ERROR \
                                    -Xep:MissingSummary:OFF \
                                    -Xep:ModifiedButNotUsed:ERROR \
                                    -Xep:MutablePublicArray:ERROR \
                                    -Xep:NarrowCalculation:ERROR \
                                    -Xep:NarrowingCompoundAssignment:ERROR \
                                    -Xep:NullOptional:ERROR \
                                    -Xep:NullableOptional:ERROR \
                                    -Xep:NullablePrimitive:ERROR \
                                    -Xep:ObjectEqualsForPrimitives:ERROR \
                                    -Xep:ObjectToString:ERROR \
                                    -Xep:OptionalNotPresent:ERROR \
                                    -Xep:OrphanedFormatString:ERROR \
                                    -Xep:Overrides:ERROR \
                                    -Xep:PatternMatchingInstanceof:ERROR \
                                    -Xep:PreferredInterfaceType:OFF \
                                    -Xep:PrimitiveArrayPassedToVarargsMethod:ERROR \
                                    -Xep:RethrowReflectiveOperationExceptionAsLinkageError:OFF \
                                    -Xep:StaticAssignmentOfThrowable:ERROR \
                                    -Xep:StaticGuardedByInstance:ERROR \
                                    -Xep:StreamResourceLeak:ERROR \
                                    -Xep:StringCaseLocaleUsage:ERROR \
                                    -Xep:SuppressWarningsDeprecated:ERROR \
                                    -Xep:ThreeLetterTimeZoneID:ERROR \
                                    -Xep:TraditionalSwitchExpression:ERROR \
                                    -Xep:UnicodeEscape:ERROR \
                                    -Xep:UnnecessaryLongToIntConversion:ERROR \
                                    -Xep:UnnecessaryMethodReference:ERROR \
                                    -Xep:UnnecessaryOptionalGet:ERROR \
                                    -Xep:UnnecessaryParentheses:ERROR \
                                    -Xep:UnnecessaryStringBuilder:ERROR \
                                    -Xep:UnusedMethod:OFF \
                                    -Xep:UnusedVariable:ERROR \
                                    -Xep:UseEnumSwitch:ERROR \
                                    -XepExcludedPaths:.*/target/generated-(|test-)sources/.*</arg>
                            </compilerArgs>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.errorprone</groupId>
                                    <artifactId>error_prone_core</artifactId>
                                    <version>${dep.errorprone.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Allow to run goals with an empty local Maven repository -->
            <id>disable-check-spi-dependencies</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.trino</groupId>
                        <artifactId>trino-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-check-spi-dependencies</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-to-ossrh</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>ossrh</publishingServerId>
                            <tokenAuth>true</tokenAuth>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
