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

  <parent>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-project</artifactId>
    <version>0.0.1-test-deploy</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>kotlin-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>

  <name>Kotlin Maven Plugin</name>
  <description>Kotlin Maven Plugin</description>
  <url>https://github.com/JetBrains/kotlin/tree/master/libraries</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>
    <connection>scm:git:git@github.com:JetBrains/kotlin.git</connection>
    <developerConnection>scm:git:git@github.com:JetBrains/kotlin.git</developerConnection>
    <url>git@github.com:JetBrains/kotlin.git</url>
  </scm>
  <developers>
    <developer>
      <id>JetBrains</id>
      <name>Jet Brains - Dev</name>
    </developer>
  </developers>

  <properties>
    <maven-plugin-anno.version>1.4.1</maven-plugin-anno.version>
    <maven.version>3.0.4</maven.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-compiler</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-jdk-annotations</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>2.9</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
    moved the integration test into a profile so we can disable this
    for example this integration test doesn't work if offline
    -->
    <profile>
      <id>integrationTest</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.5</version>
            <configuration>
              <projectsDirectory>src/it</projectsDirectory>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <pomIncludes>
                <pomInclude>*/pom.xml</pomInclude>
              </pomIncludes>
              <!--This could speed up test by providing local repo as remote repo for test but might be tricky on different OS-->
              <!--<settingsFile>src/it/settings.xml</settingsFile>-->
              <localRepositoryPath>local-repo</localRepositoryPath>
              <postBuildHookScript>verify.bsh</postBuildHookScript>
              <streamLogs>true</streamLogs>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <!--<phase>package</phase>-->
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          </plugins>
      </build>
    </profile>

    <!-- allows the integration test to be disabled (for example if you are offline) -->
    <profile>
      <id>noTest</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
    </profile>
  </profiles>
</project>
