<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2016-2017 JetBrains s.r.o.
  ~
  ~ 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
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-coroutines</artifactId>
    <version>0.19-alpha-4</version>
    <packaging>pom</packaging>

    <name>kotlinx-coroutines</name>
    <description>Coroutines support libraries for Kotlin 1.1</description>
    <url>https://github.com/Kotlin/kotlinx.coroutines/</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.1.4</kotlin.version>
        <dokka.version>0.9.15</dokka.version>
        <junit.version>4.12</junit.version>
        <atomicfu.version>0.6</atomicfu.version>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
        <core.docs.url>https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/</core.docs.url>
        <core.docs.file>${highest-basedir}/core/kotlinx-coroutines-core/target/dokka/kotlinx-coroutines-core/package-list</core.docs.file>
    </properties>

    <prerequisites>
        <maven>3.0.2</maven>
    </prerequisites>

    <developers>
        <developer>
            <id>JetBrains</id>
            <name>JetBrains Team</name>
            <organization>JetBrains</organization>
            <organizationUrl>http://www.jetbrains.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/Kotlin/kotlinx.coroutines</url>
        <connection>scm:git:https://github.com/Kotlin/kotlinx.coroutines.git</connection>
        <developerConnection>scm:git:https://github.com/Kotlin/kotlinx.coroutines.git</developerConnection>
    </scm>

    <repositories>
        <repository>
            <id>central</id>
            <url>http://jcenter.bintray.com</url>
        </repository>
        <repository>
            <id>bintray-kotlin-kotlinx</id>
            <name>bintray</name>
            <url>http://kotlin.bintray.com/kotlinx</url>
        </repository>
        <repository>
            <id>bintray-kotlin-eap</id>
            <name>bintray-kotlin-eap</name>
            <url>http://dl.bintray.com/kotlin/kotlin-eap</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>http://jcenter.bintray.com</url>
        </pluginRepository>
        <pluginRepository>
            <id>bintray-kotlin-kotlinx</id>
            <name>bintray</name>
            <url>http://kotlin.bintray.com/kotlinx</url>
        </pluginRepository>
        <pluginRepository>
            <id>bintray-kotlin-eap</id>
            <name>bintray-kotlin-eap</name>
            <url>http://dl.bintray.com/kotlin/kotlin-eap</url>
        </pluginRepository>
        <pluginRepository>
            <id>bintray-kotlin-dokka</id>
            <name>bintray-kotlin-dokka</name>
            <url>http://dl.bintray.com/kotlin/dokka</url>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <repository>
            <id>bintray</id>
            <url>https://api.bintray.com/maven/kotlin/kotlinx/kotlinx.coroutines</url>
        </repository>
    </distributionManagement>

    <modules>
        <module>benchmarks</module>
        <module>site</module>
        <module>knit</module>
        <module>core/kotlinx-coroutines-core</module>
        <module>core/kotlinx-coroutines-io</module>
        <module>reactive/kotlinx-coroutines-reactive</module>
        <module>reactive/kotlinx-coroutines-reactor</module>
        <module>reactive/kotlinx-coroutines-rx1</module>
        <module>reactive/kotlinx-coroutines-rx2</module>
        <module>reactive/kotlinx-coroutines-rx-example</module>
        <module>ui/kotlinx-coroutines-swing</module>
        <module>ui/kotlinx-coroutines-javafx</module>
        <module>ui/kotlinx-coroutines-android</module>
        <module>integration/kotlinx-coroutines-jdk8</module>
        <module>integration/kotlinx-coroutines-nio</module>
        <module>integration/kotlinx-coroutines-guava</module>
        <module>integration/kotlinx-coroutines-quasar</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>atomicfu</artifactId>
            <version>${atomicfu.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- compile Kotlin files to staging directory -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <output>${project.build.directory}/classes-atomicfu</output>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <args>
                        <arg>-Xcoroutines=enable</arg>
                    </args>
                </configuration>
            </plugin>
            <!-- transform classes with AtomicFU plugin -->
            <plugin>
                <groupId>org.jetbrains.kotlinx</groupId>
                <artifactId>atomicfu-maven-plugin</artifactId>
                <version>${atomicfu.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <verbose>true</verbose>
                            <input>${project.build.directory}/classes-atomicfu</input>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- documentation -->
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>pre-site</phase>
                        <goals>
                            <goal>dokka</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceLinks>
                        <link>
                            <dir>${project.basedir}/src/main/kotlin</dir>
                            <url>http://github.com/kotlin/kotlinx.coroutines/tree/master/${project.artifactId}/src/main/kotlin</url>
                            <urlSuffix>#L</urlSuffix>
                        </link>
                    </sourceLinks>
                    <includes>
                        <include>${project.basedir}/README.md</include>
                    </includes>
                    <outputFormat>kotlin-website</outputFormat>
                    <jdkVersion>8</jdkVersion>
                    <skip>true</skip> <!-- children override -->
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <!-- enforcer -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>1.8.0</version>
                                </requireJavaVersion>
                                <requirePluginVersions>
                                    <message>Always define plugin versions!</message>
                                    <banLatest>true</banLatest>
                                    <banRelease>true</banRelease>
                                    <banSnapshots>false</banSnapshots>
                                </requirePluginVersions>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- determine highest-basedir -->
            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>highest-basedir</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <property>highest-basedir</property>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!-- Kotlin -->
                <plugin>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <version>${kotlin.version}</version>
                </plugin>
                <!-- Dokka -->
                <plugin>
                    <groupId>org.jetbrains.dokka</groupId>
                    <artifactId>dokka-maven-plugin</artifactId>
                    <version>${dokka.version}</version>
                </plugin>
                <!-- Maven -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.5</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.commonjava.maven.plugins</groupId>
                    <artifactId>directory-maven-plugin</artifactId>
                    <version>0.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <!-- Profile to build against snapshot version of Kotlin compiler -->
        <profile>
            <id>kotlin-snapshot</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <properties>
                <kotlin.version>1.1-SNAPSHOT</kotlin.version>
            </properties>

            <pluginRepositories>
                <pluginRepository>
                    <id>oss-p</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </pluginRepository>
            </pluginRepositories>
            <repositories>
                <repository>
                    <id>oss</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </repository>
            </repositories>
        </profile>
        <!-- Profile to attach javadocs with dokka -->
        <profile>
            <id>javadoc</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <!-- documentation -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <executions>
                            <!-- build dokka htmls and package list (for refs) -->
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>dokka</goal>
                                </goals>
                            </execution>
                            <!-- attach javadoc with dokka -->
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
