<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<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>
        <artifactId>paimon-parent</artifactId>
        <groupId>org.apache.paimon</groupId>
        <version>1.3.2</version>
    </parent>

    <artifactId>paimon-common</artifactId>
    <name>Paimon : Common</name>

    <dependencies>
        <dependency>
            <groupId>org.apache.paimon</groupId>
            <artifactId>paimon-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.paimon</groupId>
            <artifactId>paimon-shade-jackson-2</artifactId>
            <version>${paimon.shade.jackson.version}-${paimon.shade.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.paimon</groupId>
            <artifactId>paimon-shade-guava-30</artifactId>
            <version>${paimon.shade.guava.version}-${paimon.shade.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.paimon</groupId>
            <artifactId>paimon-shade-caffeine-2</artifactId>
            <version>${paimon.shade.caffeine.version}-${paimon.shade.version}</version>
        </dependency>

        <!-- From paimon-format -->
        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>aircompressor</artifactId>
            <version>${airlift.version}</version>
        </dependency>

        <!-- From paimon-bundle -->
        <dependency>
            <groupId>org.lz4</groupId>
            <artifactId>lz4-java</artifactId>
            <version>${lz4.version}</version>
        </dependency>

        <dependency>
            <groupId>com.github.luben</groupId>
            <artifactId>zstd-jni</artifactId>
            <version>${zstd-jni.version}</version>
        </dependency>

        <!-- Java compiler -->
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
            <version>${janino.version}</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>commons-compiler</artifactId>
            <version>${janino.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.avro</groupId>
                    <artifactId>avro</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jdk.tools</groupId>
                    <artifactId>jdk.tools</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>jdk.tools</groupId>
                    <artifactId>jdk.tools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

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

        <dependency>
            <groupId>it.unimi.dsi</groupId>
            <artifactId>fastutil</artifactId>
            <version>8.5.12</version>
        </dependency>

        <dependency>
            <groupId>org.roaringbitmap</groupId>
            <artifactId>RoaringBitmap</artifactId>
            <version>${roaringbitmap.version}</version>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>zero-allocation-hashing</artifactId>
            <version>0.16</version>
        </dependency>

        <dependency>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>hilbert-curve</artifactId>
            <version>0.2.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.datasketches</groupId>
            <artifactId>datasketches-java</artifactId>
            <version>4.2.0</version>
        </dependency>

        <!-- Test -->

        <dependency>
            <groupId>org.apache.paimon</groupId>
            <artifactId>paimon-test-utils</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <version>${mockito.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>

        <!-- for the HDFS mini cluster test suite -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <version>${hadoop.version}</version>
            <scope>test</scope>
            <type>test-jar</type>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.reload4j</groupId>
                    <artifactId>reload4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-reload4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <scope>test</scope>
            <type>test-jar</type>
            <version>${hadoop.version}</version><!--$NO-MVN-MAN-VER$-->
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <!-- This dependency is no longer shipped with the JDK since Java 9.-->
                    <groupId>jdk.tools</groupId>
                    <artifactId>jdk.tools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.reload4j</groupId>
                    <artifactId>reload4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-reload4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>${antlr4.version}</version>
                <executions>
                    <execution>
                        <id>antlr</id>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-sources/antlr4/org/apache/paimon/codegen/codesplit</outputDirectory>
                            <visitor>true</visitor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <id>shade-paimon</id>
                        <configuration>
                            <artifactSet>
                                <includes combine.children="append">
                                    <include>org.antlr:antlr4-runtime</include>
                                    <include>org.codehaus.janino:*</include>
                                    <include>it.unimi.dsi:fastutil</include>
                                    <include>org.roaringbitmap:RoaringBitmap</include>
                                    <include>net.openhft:zero-allocation-hashing</include>
                                    <include>com.github.davidmoten:hilbert-curve</include>
                                    <include>com.github.davidmoten:guava-mini</include>
                                    <include>org.apache.datasketches:*</include>
                                </includes>
                            </artifactSet>
                            <filters>
                                <filter>
                                    <!-- Do not copy the signatures in the META-INF folder and factories in janino.
                                    Otherwise, this might cause SecurityExceptions or be incompatible with spark/hive when using the JAR. -->
                                    <artifact>org.codehaus.janino:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/**</exclude>
                                        <exclude>org.codehaus.commons.compiler.properties</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <relocations>
                                <relocation>
                                    <pattern>org.antlr.v4.runtime</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.antlr.v4.runtime</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.codehaus.janino</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.codehaus.janino</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.codehaus.commons</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.codehaus.commons</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>it.unimi.dsi.fastutil</pattern>
                                    <shadedPattern>org.apache.paimon.shade.it.unimi.dsi.fastutil</shadedPattern>
                                </relocation>
                                <!-- Same to paimon-format. -->
                                <relocation>
                                    <pattern>io.airlift</pattern>
                                    <shadedPattern>org.apache.paimon.shade.io.airlift</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.roaringbitmap</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.roaringbitmap</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.openhft.hashing</pattern>
                                    <shadedPattern>org.apache.paimon.shade.net.openhft.hashing</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.davidmoten.hilbert</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.davidmoten.hilbert</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.github.davidmoten.guavamini</pattern>
                                    <shadedPattern>org.apache.paimon.shade.com.github.davidmoten.guavamini</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.apache.datasketches</pattern>
                                    <shadedPattern>org.apache.paimon.shade.org.apache.datasketches</shadedPattern>
                                </relocation>
                            </relocations>
                            <minimizeJar>true</minimizeJar>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
