<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>
        <groupId>io.stoys</groupId>
        <artifactId>stoys-parent_2.12</artifactId>
        <version>0.1</version>
    </parent>
    <artifactId>stoys-spark_2.12</artifactId>

    <properties>
    </properties>

    <dependencies>
        <!-- stoys -->
        <dependency>
            <groupId>io.stoys</groupId>
            <artifactId>stoys-scala_${scala.compat.version}</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.stoys</groupId>
            <artifactId>stoys-spark-test_${scala.compat.version}</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- commons -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <!-- spark -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_${scala.compat.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.compat.version}</artifactId>
        </dependency>

        <!-- TODO: Move delta dependency back here from profiles once it is published for Scala 2.13. -->
        <!--&lt;!&ndash; spark libraries &ndash;&gt;-->
        <!--<dependency>-->
        <!--    <groupId>io.delta</groupId>-->
        <!--    <artifactId>delta-core_${scala.compat.version}</artifactId>-->
        <!--</dependency>-->

        <!-- test -->
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.compat.version}</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <artifactSet combine.children="append">
                        <includes>
                            <include>org.apache.httpcomponents:*</include>
                        </includes>
                    </artifactSet>
                    <relocations combine.children="append">
                        <relocation>
                            <pattern>org.apache.http.client</pattern>
                            <shadedPattern>io.stoys.shaded.org.apache.http.client</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>scala-2.11</id>
            <dependencies>
                <dependency>
                    <groupId>io.delta</groupId>
                    <artifactId>delta-core_${scala.compat.version}</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>scala-2.12</id>
            <dependencies>
                <dependency>
                    <groupId>io.delta</groupId>
                    <artifactId>delta-core_${scala.compat.version}</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>scala-2.13</id>
            <dependencies>
                <dependency>
                    <groupId>org.scala-lang.modules</groupId>
                    <artifactId>scala-parallel-collections_${scala.compat.version}</artifactId>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
