<?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>
    <properties>
        <maven-plugin-anno.version>1.4.1</maven-plugin-anno.version>
        <maven.version>3.0.4</maven.version>
        <daemon-client.target-src>${basedir}/target/src/main/kotlin</daemon-client.target-src>
    </properties>

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

    <artifactId>kotlin-compiler-runner</artifactId>
    <packaging>jar</packaging>

    <description>Compiler runner + daemon client</description>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-compiler-embeddable</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${daemon-client.target-src}</sourceDirectory>

        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>copy-sources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${daemon-client.target-src}</outputDirectory>
                            <resources>
                                <resource><directory>${project-root}/compiler/daemon/daemon-client/src</directory></resource>
                                <resource><directory>${project-root}/compiler/compiler-runner/src</directory></resource>
                            </resources>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>${daemon-client.target-src}/**</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>(?&lt;!\.)com\.intellij</token>
                            <value>org.jetbrains.kotlin.com.intellij</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${project.version}</version>

                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals> <goal>compile</goal> </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${daemon-client.target-src}</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
