<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 2020, NVIDIA CORPORATION.

  Licensed 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>

    <groupId>com.nvidia</groupId>
    <artifactId>rapids-4-spark-parent</artifactId>
    <name>RAPIDS Accelerator for Apache Spark Root Project</name>
    <description>The root project of the RAPIDS Accelerator for Apache Spark</description>
    <version>0.2.0</version>
    <packaging>pom</packaging>

    <url>https://github.com/NVIDIA</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/NVIDIA/spark-rapids.git</connection>
        <developerConnection>scm:git:git@github.com:NVIDIA/spark-rapids.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/NVIDIA/spark-rapids</url>
    </scm>
    <developers>
        <developer>
            <id>revans2</id>
            <name>Robert Evans</name>
            <email>roberte@nvidia.com</email>
            <roles>
                <role>Committer</role>
            </roles>
            <timezone>-6</timezone>
        </developer>
        <developer>
            <id>tgravescs</id>
            <name>Thomas Graves</name>
            <email>tgraves@nvidia.com</email>
            <roles>
                <role>Committer</role>
            </roles>
            <timezone>-6</timezone>
        </developer>
        <developer>
            <id>jlowe</id>
            <name>Jason Lowe</name>
            <email>jlowe@nvidia.com</email>
            <roles>
                <role>Committer</role>
            </roles>
            <timezone>-6</timezone>
        </developer>
    </developers>

    <modules>
        <module>dist</module>
        <module>shuffle-plugin</module>
        <module>sql-plugin</module>
        <module>tests</module>
        <module>integration_tests</module>
        <module>shims</module>
        <module>api_validation</module>
        <module>udf-compiler</module>
    </modules>

    <profiles>
        <profile>
            <id>udf-compiler</id>
            <modules>
                <module>udf-compiler</module>
            </modules>
        </profile>
        <profile>
            <id>alpha-features</id>
            <properties>
                <rapids.shuffle.manager.override>true</rapids.shuffle.manager.override>
            </properties>
        </profile>
        <profile>
            <id>source-javadoc</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>attach-source</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>databricks</id>
            <properties>
	        <rat.consoleOutput>true</rat.consoleOutput>
            </properties>
        </profile>
        <profile>
            <id>spark301tests</id>
        </profile>
        <profile>
            <id>spark310tests</id>
        </profile>
    </profiles>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <spark.version>3.0.0</spark.version>
        <cuda.version>cuda10-1</cuda.version>
        <cudf.version>0.15</cudf.version>
        <scala.binary.version>2.12</scala.binary.version>
        <scala.version>2.12.8</scala.version>
        <orc.version>1.5.8</orc.version>
        <orc.classifier></orc.classifier>
        <!--
             If the shade package changes we need to also update jenkins/spark-premerge-build.sh
             so code coverage does not include the shaded classes.
        -->
        <rapids.shade.package>com.nvidia.shaded.spark</rapids.shade.package>
        <test.exclude.tags></test.exclude.tags>
        <test.include.tags></test.include.tags>
        <rapids.shuffle.manager.override>false</rapids.shuffle.manager.override>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.sourceEncoding>UTF-8</project.reporting.sourceEncoding>
        <pytest.TEST_TAGS>not qarun and not cudf_udf</pytest.TEST_TAGS>
        <rat.consoleOutput>false</rat.consoleOutput>
        <slf4j.version>1.7.30</slf4j.version>
        <spark300.version>3.0.0</spark300.version>
        <!--
         If you update a dependendy version so it is no longer a SNAPSHOT
         please update the snapshot-shims profile as well so it is accurate -->
        <spark301.version>3.0.1</spark301.version>
        <spark302.version>3.0.2-SNAPSHOT</spark302.version>
        <spark310.version>3.1.0-SNAPSHOT</spark310.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.spark</groupId>
                <artifactId>spark-annotation_${scala.binary.version}</artifactId>
                <version>${spark.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.rapids</groupId>
                <artifactId>cudf</artifactId>
                <version>${cudf.version}</version>
                <classifier>${cuda.version}</classifier>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
                <!-- runtime scope is appropriate, but causes SBT build problems -->
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
              <groupId>org.apache.spark</groupId>
              <artifactId>spark-sql_${scala.binary.version}</artifactId>
              <version>${spark.version}</version>
              <scope>provided</scope>
            </dependency>
            <dependency>
              <groupId>org.apache.spark</groupId>
              <artifactId>spark-catalyst_${scala.binary.version}</artifactId>
              <version>${spark.version}</version>
              <type>test-jar</type>
              <scope>test</scope>
            </dependency>
            <dependency>
              <groupId>org.apache.orc</groupId>
              <artifactId>orc-core</artifactId>
              <version>${orc.version}</version>
              <classifier>${orc.classifier}</classifier>
              <exclusions>
                <exclusion>
                  <groupId>javax.xml.bind</groupId>
                  <artifactId>jaxb-api</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-common</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-hdfs</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hive</groupId>
                  <artifactId>hive-storage-api</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
            <dependency>
              <groupId>org.apache.orc</groupId>
              <artifactId>orc-mapreduce</artifactId>
              <version>${orc.version}</version>
              <classifier>${orc.classifier}</classifier>
              <exclusions>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-common</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-mapreduce-client-core</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.orc</groupId>
                  <artifactId>orc-core</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hive</groupId>
                  <artifactId>hive-storage-api</artifactId>
                </exclusion>
                <exclusion>
                  <groupId> com.esotericsoftware</groupId>
                  <artifactId>kryo-shaded</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
            <dependency>
              <groupId>org.apache.orc</groupId>
              <artifactId>orc-shims</artifactId>
              <version>${orc.version}</version>
              <exclusions>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-common</artifactId>
                </exclusion>
                <exclusion>
                  <groupId>org.apache.hadoop</groupId>
                  <artifactId>hadoop-hdfs</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
            <dependency>
              <groupId>org.apache.hive</groupId>
              <artifactId>hive-storage-api</artifactId>
              <version>2.6.0</version>
            </dependency>
            <dependency>
              <groupId>com.google.protobuf</groupId>
              <artifactId>protobuf-java</artifactId>
              <version>2.5.0</version>
            </dependency>
            <dependency>
                <groupId>com.google.flatbuffers</groupId>
                <artifactId>flatbuffers-java</artifactId>
                <version>1.11.0</version>
            </dependency>
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scala.binary.version}</artifactId>
                <version>3.0.5</version>
                <scope>test</scope>
            </dependency>
            <dependency>
              <groupId>org.junit.jupiter</groupId>
              <artifactId>junit-jupiter-api</artifactId>
              <version>5.4.2</version>
              <scope>test</scope>
            </dependency>
            <dependency>
              <groupId>org.mockito</groupId>
              <artifactId>mockito-core</artifactId>
              <version>2.28.2</version>
              <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <version>1.8</version>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-shade-plugin</artifactId>
                  <version>3.2.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.12.4</version>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.4.4</version>
                    <executions>
                        <execution>
                            <id>eclipse-add-source</id>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>scala-test-compile-first</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>attach-scaladocs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>doc-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <scalaVersion>${scala.version}</scalaVersion>
                        <checkMultipleScalaVersions>true</checkMultipleScalaVersions>
                        <failOnMultipleScalaVersions>true</failOnMultipleScalaVersions>
                        <recompileMode>incremental</recompileMode>
                        <useZincServer>true</useZincServer>
                        <args>
                            <arg>-unchecked</arg>
                            <arg>-deprecation</arg>
                            <arg>-feature</arg>
                            <arg>-explaintypes</arg>
                            <arg>-Yno-adapted-args</arg>
                        </args>
                        <jvmArgs>
                            <jvmArg>-Xms1024m</jvmArg>
                            <jvmArg>-Xmx1024m</jvmArg>
                        </jvmArgs>
                        <javacArgs>
                            <javacArg>-source</javacArg>
                            <javacArg>${maven.compiler.source}</javacArg>
                            <javacArg>-target</javacArg>
                            <javacArg>${maven.compiler.target}</javacArg>
                            <javacArg>-Xlint:all,-serial,-path,-try</javacArg>
                        </javacArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.scalatest</groupId>
                    <artifactId>scalatest-maven-plugin</artifactId>
                    <version>2.0.0</version>
                    <configuration>
                        <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                        <junitxml>.</junitxml>
                        <filereports>scala-test-output.txt</filereports>
                        <argLine>${argLine} -ea -Xmx4g -Xss4m</argLine>
                        <stderr/>
                        <systemProperties>
                            <rapids.shuffle.manager.override>${rapids.shuffle.manager.override}</rapids.shuffle.manager.override>
                            <ai.rapids.refcount.debug>true</ai.rapids.refcount.debug>
                            <java.awt.headless>true</java.awt.headless>
                            <java.io.tmpdir>${project.build.directory}/tmp</java.io.tmpdir>
                            <spark.ui.enabled>false</spark.ui.enabled>
                            <spark.ui.showConsoleProgress>false</spark.ui.showConsoleProgress>
                            <spark.unsafe.exceptionOnMemoryLeak>true</spark.unsafe.exceptionOnMemoryLeak>
                        </systemProperties>
                        <tagsToExclude>${test.exclude.tags}</tagsToExclude>
                        <tagsToInclude>${test.include.tags}</tagsToInclude>
                    </configuration>
                    <executions>
                        <execution>
                            <id>test</id>
                            <goals>
                                <goal>test</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.scalastyle</groupId>
                    <artifactId>scalastyle-maven-plugin</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <verbose>false</verbose>
                        <failOnViolation>true</failOnViolation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <failOnWarning>false</failOnWarning>
                        <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
                        <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
                        <configLocation>scalastyle-config.xml</configLocation>
                        <outputFile>${basedir}/target/scalastyle-output.xml</outputFile>
                        <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
                        <outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.rat</groupId>
                    <artifactId>apache-rat-plugin</artifactId>
                    <version>0.13</version>
                    <configuration>
                        <consoleOutput>${rat.consoleOutput}</consoleOutput>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.5</version>
                </plugin>
                <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.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>.docker/**</exclude>
                        <exclude>.download/**</exclude>
                        <exclude>.gitattributes</exclude>
                        <exclude>.gitignore</exclude>
                        <exclude>.git/**</exclude>
                        <exclude>.pytest_cache/**</exclude>
                        <exclude>.github/pull_request_template.md</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.iml</exclude>
                        <exclude>NOTICE-binary</exclude>
                        <exclude>docs/dev/idea-code-style-settings.xml</exclude>
                        <exclude>**/.m2/**</exclude>
                        <exclude>.gnupg/**</exclude>
                        <exclude>pom.xml.asc</exclude>
                        <exclude>jenkins/databricks/*.patch</exclude>
                        <exclude>*.jar</exclude>
                        <exclude>docs/demo/**/*.ipynb</exclude>
                        <exclude>docs/demo/**/*.zpln</exclude>
                        <exclude>**/src/main/resources/META-INF/services/*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <configuration>
                            <!-- Execute the shell script to generate the plugin build information. -->
                            <target>
                                <mkdir dir="${project.build.directory}/extra-resources"/>
                                <mkdir dir="${project.build.directory}/tmp"/>
                                <exec executable="bash" output="${project.build.directory}/extra-resources/rapids4spark-version-info.properties">
                                    <arg value="${project.basedir}/../build/build-info"/>
                                    <arg value="${project.version}"/>
                                </exec>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <append>true</append>
                            <excludes>
                                <exclude>${rapids.shade.package}.*</exclude>
                            </excludes>
                            <includes>
                                <include>ai.rapids.cudf.*</include>
                                <include>com.nvidia.spark.*</include>
                                <include>org.apache.spark.sql.rapids.*</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>snapshots-repo</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>apache-snapshots-repo</id>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
