<?xml version="1.0" encoding="UTF-8"?>
<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.kotlin</groupId>
    <artifactId>kotlin-project</artifactId>
    <version>1.0.5</version>
    <packaging>pom</packaging>

    <name>Kotlin</name>
    <description>Kotlin is a statically typed programming language that compiles to JVM byte codes and JavaScript</description>
    <url>http://kotlinlang.org/</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>

    <scm>
        <url>https://github.com/JetBrains/kotlin</url>
        <connection>scm:git:https://github.com/JetBrains/kotlin.git</connection>
        <developerConnection>scm:git:https://github.com/JetBrains/kotlin.git</developerConnection>
    </scm>

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project-root>../../..</project-root>

        <junit-version>4.11</junit-version>
        <pegdown.version>1.1.0</pegdown.version>
        <surefire-version>2.16</surefire-version>
        <exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
        <selenium.version>2.37.1</selenium.version>

        <kotlin-dist>${project-root}/dist</kotlin-dist>
        <kotlin-sdk>${kotlin-dist}/kotlinc</kotlin-sdk>

        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
    </properties>

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

    <distributionManagement>
        <repository>
            <id>${deploy-repo}</id>
            <url>${deploy-url}</url>
        </repository>
        <snapshotRepository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>tools/kotlin-compiler</module>
        <module>tools/kotlin-compiler-embeddable</module>
        <module>tools/kotlin-build-common</module>
        <module>tools/kotlin-build-common-test</module>
        <module>tools/kotlin-maven-plugin</module>

        <module>tools/runtime</module>
        <module>kotlin.test</module>
        <module>stdlib</module>
        <module>tools/kotlin-reflect</module>
        <module>tools/kotlin-osgi-bundle</module>

        <module>tools/maven-archetypes</module>

        <module>tools/binary-compatibility-validator</module>

        <!--NB! kotlin-js-library should be built before kotlin-gradle-plugin-integration-tests-->
        <!--because it is used in tests but cannot be added as test-dependency-->
        <!--(kotlin-gradle-plugin module will be recognized as kotlin-js module)-->
        <module>tools/idl2k</module>
        <module>tools/kotlin-js-library</module>
        <module>tools/kotlin-js-tests</module>
        <module>tools/kotlin-js-tests-junit</module>
        <module>tools/kotlin-annotation-processing</module>

        <module>tools/kotlin-gradle-plugin</module>
        <module>tools/kotlin-gradle-plugin-api</module>
        <module>tools/kotlin-android-extensions</module>
        <module>tools/kotlin-maven-plugin-test</module>

        <module>examples/annotation-processor-example</module>
        <module>examples/kotlin-java-example</module>
        <module>examples/js-example</module>
        <module>examples/kotlin-js-library-example</module>
        <module>examples/kotlin-gradle-subplugin-example</module>
        <module>examples/browser-example</module>
        <module>examples/browser-example-with-library</module>

        <module>tools/kotlin-gradle-plugin-integration-tests</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit-version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.7</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-version}</version>
                <configuration>
                    <forkMode>once</forkMode>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                    <failIfNoTests>false</failIfNoTests>
                    <includes>
                        <include>**/*Test.*</include>
                    </includes>
                    <excludes>
                    </excludes>
                    <systemProperties>
                        <project.version>${project.version}</project.version>
                    </systemProperties>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <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>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-empty-javadoc</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${highest-basedir}/lib/empty-javadoc.jar</file>
                                    <type>jar</type>
                                    <classifier>javadoc</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <version>0.1</version>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>highest-basedir</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <property>highest-basedir</property>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>sign-artifacts</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <configuration>
                            <passphrase>${kotlin.key.passphrase}</passphrase>
                            <keyname>${kotlin.key.name}</keyname>
                            <homedir>${highest-basedir}/.gnupg</homedir>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>