<?xml version="1.0" encoding="UTF-8"?>
<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>
    <groupId>net.onedaybeard.graftt</groupId>
    <artifactId>root</artifactId>
    <version>0.2.0</version>
    <packaging>pom</packaging>

    <name>graftt - root</name>
    <url>https://github.com/junkdog/graftt</url>
    <description>annotation-driven bytecode surgery</description>

    <properties>
        <kotlin.version>1.3.31</kotlin.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>

        <dokka.version>0.9.18</dokka.version>
        <dokka.skip>false</dokka.skip>
        <dokka.format>html</dokka.format>
    </properties>


    <scm>
        <url>https://github.com/junkdog/graftt/</url>
        <connection>scm:git:git@github.com:junkdog/graftt.git</connection>
        <developerConnection>scm:git:git@github.com:junkdog/graftt.git</developerConnection>
        <tag>0.2.0</tag>
    </scm>

    <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>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Adrian Papari</name>
            <email>a@onedaybeard.net</email>
            <id>junkdog</id>
            <timezone>1</timezone>
            <roles>
                <role>owner</role>
                <role>developer</role>
            </roles>
            <properties>
                <twitter>@junkdogAP</twitter>
            </properties>
        </developer>
    </developers>

    <issueManagement>
        <url>https://github.com/junkdog/graftt/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Nexus Release Repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>


    <repositories>
        <repository>
            <id>kotlinx</id>
            <url>https://kotlin.bintray.com/kotlinx</url>
        </repository>

        <repository>
            <id>result type</id>
            <url>https://dl.bintray.com/michaelbull/maven</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>bintray-kotlin-kotlinx</id>
            <name>bintray-plugins</name>
            <url>https://kotlin.bintray.com/kotlinx</url>
        </pluginRepository>
        <pluginRepository>
            <id>bintray-kotlin-kotlinx2</id>
            <name>bintray-plugins</name>
            <url>https://dl.bintray.com/kotlin/kotlinx/</url>
        </pluginRepository>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <modules>
        <module>api</module>
        <module>core</module>
        <module>agent</module>
        <module>graftt-maven-plugin</module>
    </modules>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka.version}</version>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>dokka</goal>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>${dokka.skip}</skip>

                            <!-- html, markdown -->
                            <outputFormat>${dokka.format}</outputFormat>
                            <jdkVersion>8</jdkVersion>
                            <skipEmptyPackages>true</skipEmptyPackages>

                            <sourceLinks>
                                <link>
                                    <url>https://www.javadoc.io/doc/org.ow2.asm/asm/</url>
                                    <url>https://www.javadoc.io/doc/org.ow2.asm/asm-tree/</url>
                                </link>
                                <link>
                                    <dir>${project.basedir}/src/main/kotlin</dir>
                                    <urlSuffix>#L</urlSuffix>
                                </link>
                                <link>
                                    <dir>${project.basedir}/src/main/java</dir>
                                    <urlSuffix>#L</urlSuffix>
                                </link>
                            </sourceLinks>

                            <sourceRoots>
                                <root>
                                    <path>${project.basedir}/src/main/kotlin</path>
                                </root>
                            </sourceRoots>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.3</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals /> <!-- disable plugin -->
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>ide-integration-tests</id>
            <modules>
                <module>graftt-maven-plugin/src/it/transplants-in-target-classes</module>
                <module>graftt-maven-plugin/src/it/transplants-in-directory</module>
                <module>graftt-maven-plugin/src/it/transplants-in-dependency</module>
                <module>agent/src/it/agent-no-params</module>
                <module>agent/src/it/external-transplants</module>
            </modules>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.basedir}/src/main/kotlin</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/test/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <executions>
                    <!-- disable javac compiler because of kotlin -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>enforce-maven-3</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6.0</version>
                                </requireMavenVersion>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>


</project>
