<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.github.sparow199</groupId>
    <artifactId>apollo-client-maven-plugin-parent</artifactId>
    <version>3.2.2</version>
    <packaging>pom</packaging>

    <name>apollo-client-maven-plugin-parent</name>
    <description>Parent Pom for Apollo GraphQL Client Maven Plugin</description>
    <url>https://github.com/aoudiamoncef/apollo-client-maven-plugin</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <kotlin.version>1.3.72</kotlin.version>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <java.version>1.8</java.version>

        <!--This contends with dokka and creates two javadoc jars...-->
        <maven.javadoc.skip>true</maven.javadoc.skip>

        <formatter-maven-plugin.version>2.11.0</formatter-maven-plugin.version>
        <impsort-maven-plugin.version>1.4.1</impsort-maven-plugin.version>

        <project.scm.id>Github</project.scm.id>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <dokka-maven-plugin.version>0.9.17</dokka-maven-plugin.version>
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <ktlint-maven-plugin.version>1.5.1</ktlint-maven-plugin.version>
        <maven-site-plugin.version>3.8.2</maven-site-plugin.version>
    </properties>

    <scm>
        <connection>scm:git:https://github.com/aoudiamoncef/apollo-client-maven-plugin.git</connection>
        <developerConnection>scm:git:https://github.com/aoudiamoncef/apollo-client-maven-plugin.git
        </developerConnection>
        <url>https://github.com/aoudiamoncef/apollo-client-maven-plugin</url>
        <tag>HEAD</tag>
    </scm>

    <modules>
        <module>apollo-client-maven-plugin</module>
        <module>apollo-client-maven-plugin-tests</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven-site-plugin.version}</version>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>com.github.gantsign.maven</groupId>
                <artifactId>ktlint-maven-plugin</artifactId>
                <version>${ktlint-maven-plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>format</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>!no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.gantsign.maven</groupId>
                        <artifactId>ktlint-maven-plugin</artifactId>
                        <version>${ktlint-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>format</id>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>validate</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.gantsign.maven</groupId>
                        <artifactId>ktlint-maven-plugin</artifactId>
                        <version>${ktlint-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>check</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>bintray</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <developers>
        <developer>
            <name>Andrew Potter</name>
            <email>Andrew.Potter@coxautoinc.com</email>
            <organization>Cox Automotive</organization>
            <organizationUrl>http://www.coxautoinc.com</organizationUrl>
        </developer>
        <developer>
            <name>Moncef AOUDIA</name>
            <email>mf.aoudia@gmail.com</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>
    <distributionManagement>
        <snapshotRepository>
            <id>bintray-sparow199-maven</id>
            <name>sparow199-maven</name>
            <url>https://api.bintray.com/maven/sparow199/maven/apollo-client-maven-plugin</url>
        </snapshotRepository>

        <!-- Released with: mvn release:clean release:prepare release:perform -B -e -P bintray -->
        <repository>
            <id>bintray-sparow199-maven</id>
            <name>sparow199-maven</name>
            <url>https://api.bintray.com/maven/sparow199/maven/apollo-client-maven-plugin/;publish=1</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>jcenter</id>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>
</project>