<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012 to original author or authors
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html

-->
<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>io.takari.polyglot</groupId>
    <artifactId>polyglot</artifactId>
    <version>0.4.7</version>
  </parent>

  <artifactId>polyglot-kotlin</artifactId>
  <packaging>takari-jar</packaging>
  <name>Polyglot :: Kotlin</name>

  <dependencies>
    <dependency>
      <groupId>io.takari.polyglot</groupId>
      <artifactId>polyglot-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
      <version>${kotlin.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-script-util</artifactId>
      <version>${kotlin.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-scripting-jvm-host</artifactId>
      <version>${kotlin.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>io.takari.polyglot</groupId>
      <artifactId>polyglot-maven-plugin</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.11.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <kotlin.version>1.4.10</kotlin.version>
    <commons-lang3.version>3.8.1</commons-lang3.version>
    <skipTests>false</skipTests>
    <invoker.skip>${skipTests}</invoker.skip>
  </properties>

  <build>
    <sourceDirectory>src/main/kotlin</sourceDirectory>
    <testSourceDirectory>src/test/kotlin</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <configuration>
          <failIfNoProjects>true</failIfNoProjects>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
            <configuration>
              <settingsFile>${basedir}/src/it/settings.xml</settingsFile>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <showErrors>true</showErrors>
              <debug>false</debug>
              <streamLogs>true</streamLogs>
              <goals><goal>verify</goal></goals>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${kotlin.version}</version>
        <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>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <phase>test-compile</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <basedir>${project.build.testOutputDirectory}</basedir>
          <includes>**/pom.xml</includes>
          <delimiters>@{*}</delimiters>
          <regex>false</regex>
          <token>takari-polyglot-version</token>
          <value>${project.version}</value>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
