<?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"
    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>com.github.shyiko.ktlint</groupId>
        <artifactId>pom</artifactId>
        <version>0.22.0</version>
    </parent>

    <!-- keeping original (pre 0.2.0) qualifier (com.github.shyiko:ktlint) so that no one would notice a thing -->
    <groupId>com.github.shyiko</groupId>
    <artifactId>ktlint</artifactId>

    <scm>
        <connection>scm:git:git@github.com:shyiko/ktlint.git</connection>
        <developerConnection>scm:git:git@github.com:shyiko/ktlint.git</developerConnection>
        <url>git@github.com:shyiko/ktlint.git</url>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
            <!-- no longer included in kotlin-compiler-embeddable (>=1.1.60) -->
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>13.0</version>
            <scope>provided</scope>
            <!-- included (at least org.jetbrains.annotations.*) in kotlin-compiler-embeddable -->
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-core</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-ruleset-standard</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-reporter-plain</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-reporter-json</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-reporter-checkstyle</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.ktlint</groupId>
            <artifactId>ktlint-test</artifactId>
            <version>0.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.shyiko.klob</groupId>
            <artifactId>klob</artifactId>
            <version>0.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-aether-provider</artifactId>
            <version>${aether.maven.provider.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.aether</groupId>
                    <artifactId>aether-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.aether</groupId>
                    <artifactId>aether-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.aether</groupId>
                    <artifactId>aether-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.aether</groupId>
                    <artifactId>aether-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- maven-aether-provider's transitive dependency -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <version>${aether.maven.provider.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model-builder</artifactId>
            <version>${aether.maven.provider.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-repository-metadata</artifactId>
            <version>${aether.maven.provider.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-spi</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-util</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-impl</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-connector-basic</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-file</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-http</artifactId>
            <version>${aether.version}</version>
        </dependency>
        <!-- used to silence aether-transport-http -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>${picocli.version}</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.jimfs</groupId>
            <artifactId>jimfs</artifactId>
            <version>${jimfs.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>ktlint</id>
                        <phase>verify</phase>
                        <configuration>
                            <target name="ktlint">
                                <java dir="${basedir}${file.separator}.."
                                      classname="com.github.shyiko.ktlint.Main"
                                      classpathref="maven.runtime.classpath"
                                      fork="true"
                                      failonerror="true"
                                      taskname="lint"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>ktlint-format</id>
                        <configuration>
                            <target name="ktlint">
                                <java dir="${basedir}${file.separator}.."
                                      classname="com.github.shyiko.ktlint.Main"
                                      classpathref="maven.runtime.classpath"
                                      fork="true"
                                      failonerror="true"
                                      taskname="format">
                                    <arg value="-F"/>
                                </java>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>maven-central</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.0.2</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>javadoc</classifier>
                                    <classesDirectory>${basedir}/javadoc</classesDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>capsule</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github</value>
                </property>
            </activation>
            <build>
                <defaultGoal>clean deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <transformers>
                                        <transformer implementation=
                                                         "org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                        <transformer implementation=
                                                         "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>com.github.shyiko.ktlint.Main</mainClass>
                                        </transformer>
                                    </transformers>
                                    <shadedArtifactAttached>true</shadedArtifactAttached>
                                    <createDependencyReducedPom>false</createDependencyReducedPom>
                                    <!--<minimizeJar>true</minimizeJar>-->
                                    <filters>
                                        <filter>
                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                            </excludes>
                                        </filter>
                                        <filter>
                                            <artifact>org.jetbrains.kotlin:kotlin-compiler-embeddable</artifact>
                                            <includes>
                                                <include>**</include>
                                            </includes>
                                        </filter>
                                    </filters>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.skife.maven</groupId>
                        <artifactId>really-executable-jar-maven-plugin</artifactId>
                        <version>1.4.1</version>
                        <configuration>
                            <!--
                            -XX:+TieredCompilation can be used to speed things up but it was reported to cause
                            OOMs and all sort of problems depending on which version of jre6 is used
                            -->
                            <flags>-Xmx512m</flags>
                            <programFile>ktlint</programFile>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>really-executable-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-to-github</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <id>ktlint</id>
                                <phase>verify</phase>
                                <configuration>
                                    <skip>${gpg.skip}</skip>
                                    <target name="gpg-sign">
                                        <exec executable="gpg" dir="${basedir}" failonerror="true">
                                            <arg value="-ab"/>
                                            <arg value="${project.build.directory}/${project.artifactId}"/>
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>de.jutzig</groupId>
                        <artifactId>github-release-plugin</artifactId>
                        <version>1.2.0</version>
                        <configuration>
                            <description>${github.description}</description>
                            <releaseName>${project.version}</releaseName>
                            <tag>${project.version}</tag>
                            <artifact>${project.build.directory}/${project.artifactId}</artifact>
                            <overwriteArtifact>true</overwriteArtifact>
                            <fileSets>
                                <fileSet>
                                    <directory>${project.build.directory}</directory>
                                    <includes>
                                        <include>${project.artifactId}.asc</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>release</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
