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

    <groupId>com.github.shyiko.ktlint</groupId>
    <artifactId>pom</artifactId>
    <version>0.22.0</version>
    <packaging>pom</packaging>

    <name>pom</name>
    <description>An anti-bikeshedding Kotlin linter with built-in formatter</description>
    <url>https://github.com/shyiko/ktlint</url>
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <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>
    <developers>
        <developer>
            <id>shyiko</id>
            <email>stanley.shyiko@gmail.com</email>
            <name>Stanley Shyiko</name>
        </developer>
    </developers>
    <distributionManagement>
        <repository>
            <id>maven-central</id>
            <name>Sonatype Nexus Staging</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>maven-central</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.2.40</kotlin.version>
        <kotlin.compiler.languageVersion>1.1</kotlin.compiler.languageVersion>
        <kotlin.compiler.apiVersion>1.1</kotlin.compiler.apiVersion>
        <aether.version>1.1.0</aether.version>
        <aether.maven.provider.version>3.3.9</aether.maven.provider.version>
        <picocli.version>2.3.0</picocli.version>
        <kolor.version>0.0.2</kolor.version>
        <testng.version>6.8.21</testng.version>
        <assertj.version>3.9.0</assertj.version>
        <jimfs.version>1.1</jimfs.version>
        <gpg.skip>false</gpg.skip>
        <github.description>${project.version}</github.description>
    </properties>

    <modules>
        <module>ktlint-core</module>
        <module>ktlint-test</module>
        <module>ktlint-ruleset-standard</module>
        <module>ktlint-reporter-plain</module>
        <module>ktlint-reporter-json</module>
        <module>ktlint-reporter-checkstyle</module>
        <module>ktlint</module>
    </modules>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <configuration>
                    <jvmTarget>1.8</jvmTarget>
                    <args>
                        <arg>-Xskip-runtime-version-check</arg>
                    </args>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>process-test-sources</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <!-- for class.getPackage().getImplementationVersion() -->
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M1</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <dependencyConvergence/>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.shyiko.usage-maven-plugin</groupId>
                <artifactId>usage-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <usage>
                        # build "./ktlint/target/ktlint" (executable jar)
                        ./mvnw -Pcapsule clean package -Dmaven.test.skip=true

                        # test (&amp; check code style)
                        ./mvnw clean verify

                        # publish a new version
                        ./mvnw versions:set -DnewVersion=&lt;version&gt;
                        ./mvnw -Ddeploy=maven-central
                        ./mvnw -Ddeploy=github
                        ./mvnw -Ddeploy=github-release-notes -N
                        ./mvnw -Ddeploy=homebrew -N
                        ./mvnw -Ddeploy=refs -N
                    </usage>
                </configuration>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>com.github.shyiko.servers-maven-extension</groupId>
                <artifactId>servers-maven-extension</artifactId>
                <version>1.3.1</version>
            </extension>
            <extension>
                <groupId>com.github.shyiko.usage-maven-plugin</groupId>
                <artifactId>usage-maven-plugin</artifactId>
                <version>1.0.0</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>deploy-to-maven-central</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>maven-central</value>
                </property>
            </activation>
            <build>
                <defaultGoal>clean deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <serverId>maven-central</serverId>
                            <!--<skipStagingRepositoryClose>true</skipStagingRepositoryClose>-->
                            <!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-to-github</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github</value>
                </property>
            </activation>
            <build>
                <defaultGoal>clean deploy</defaultGoal>
            </build>
        </profile>
        <profile>
            <!--
                https://github.com/mattbrictson/chandler must be installed and available on PATH
            -->
            <id>update-github-release-notes</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github-release-notes</value>
                </property>
            </activation>
            <build>
                <defaultGoal>antrun:run</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <configuration>
                            <target name="update-github-release-notes">
                                <exec executable="chandler" dir="${basedir}" failonerror="true">
                                    <arg value="push"/>
                                    <arg value="${project.version}"/>
                                    <env key="CHANDLER_GITHUB_API_TOKEN" value="${settings.servers.github.privateKey}"/>
                                </exec>
                            </target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-to-homebrew</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>homebrew</value>
                </property>
            </activation>
            <build>
                <defaultGoal>antrun:run</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <configuration>
                            <target name="deploy-to-homebrew">
                                <exec executable="${project.basedir}/.deploy-to-homebrew" failonerror="true">
                                    <env key="VERSION" value="${project.version}"/>
                                    <env key="GITHUB_TOKEN" value="${settings.servers.github.privateKey}"/>
                                </exec>
                            </target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>announce</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>refs</value>
                </property>
            </activation>
            <build>
                <defaultGoal>exec:exec@announce</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <executions>
                            <execution>
                                <id>announce</id>
                                <configuration>
                                    <executable>${project.basedir}/.announce</executable>
                                    <environmentVariables>
                                        <VERSION>${project.version}</VERSION>
                                        <GITHUB_TOKEN>${settings.servers.github.privateKey}</GITHUB_TOKEN>
                                    </environmentVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
