<?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>
    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>35</version>
    </parent>

    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-parent</artifactId>
    <name>Quarkus - Parent pom</name>
    <version>0.19.1</version>
    <packaging>pom</packaging>

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

    <scm>
        <url>https://github.com/quarkusio/quarkus</url>
        <connection>scm:git:git@github.com:quarkusio/quarkus.git</connection>
        <developerConnection>scm:git:git@github.com:quarkusio/quarkus.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <graalvmHome>${env.GRAALVM_HOME}</graalvmHome>
        <postgres.url>jdbc:postgresql:hibernate_orm_test</postgres.url>

        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
        <jacoco.version>0.8.3</jacoco.version>
    </properties>

    <modules>
        <module>bom</module>
        <module>build-parent</module>

        <!-- Core components -->
        <module>core</module>
        <module>test-framework</module>

        <!-- Extensions -->
        <module>extensions</module>

        <!-- Integration Tests -->
        <module>integration-tests</module>

        <!-- External projects -->
        <module>independent-projects/arc</module>
        <module>independent-projects/bootstrap</module>

        <!-- Devtools (Maven, cli, gradle) -->
        <module>devtools</module>

        <!-- Misc. -->
        <module>docs</module>

        <!-- Do not add modules after war-launcher. JVM state will fail CI -->
        <module>war-launcher</module>
    </modules>

    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
   </repositories>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-release</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <serverId>ossrh</serverId>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                            <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</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>
                    <plugin>
                        <!--
                        ## IMPORTANT ##
                        In your ~/.m2/settings.xml you need to add and edit the following profile:
                        <profile>
                            <id>release</id>
                            <properties>
                                <gpg.useagent>false</gpg.useagent>
                                <gpg.executable>/usr/local/Cellar/gnupg@1.4/1.4.23_1/bin/gpg1</gpg.executable> <- use gpg1 on Mac OS X
                                <gpg.homedir>~/.gnupg</gpg.homedir>  <- Update to your own directory
                                <gpg.passphrase>******</gpg.passphrase> <- Add your passphrase
                            </properties>
                        </profile>
                         -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--
            JaCoCo based code coverage analysis

            mvn -Pjacoco clean verify
            mvn antrun:run@jacoco-all-in-one-report -Pjacoco-report
            open target/jacoco-report/index.html
        -->
        <profile>
            <id>jacoco</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <executions>
                            <execution>
                                <id>jacoco-prepare</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>${project.build.directory}/jacoco.exec</destFile>
                                    <includes>
                                        <include>*</include>
                                    </includes>
                                    <excludes>
                                        <exclude>io.quarkus.it.*</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jacoco-report-per-module</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/jacoco.exec</dataFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jacoco-report</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <phase>process-test-resources</phase>
                                <inherited>false</inherited>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jacoco</groupId>
                                            <artifactId>org.jacoco.ant</artifactId>
                                            <version>${jacoco.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                    <stripVersion>true</stripVersion>
                                    <outputDirectory>${project.build.directory}/jacoco-jars</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.jacoco</groupId>
                                <artifactId>org.jacoco.ant</artifactId>
                                <version>${jacoco.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>jacoco-all-in-one-report</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <inherited>false</inherited>
                                <configuration>
                                    <target>
                                        <taskdef name="report" classname="org.jacoco.ant.ReportTask">
                                            <classpath path="${project.build.directory}/jacoco-jars/org.jacoco.ant.jar"/>
                                        </taskdef>
                                        <echo>Creating JaCoCo for Quarkus code coverage reports</echo>
                                        <report>
                                            <executiondata>
                                                <fileset dir="${basedir}">
                                                    <include name="**/target/jacoco.exec"/>
                                                </fileset>
                                            </executiondata>
                                            <structure name="JaCoCo for Quarkus">
                                                <classfiles>
                                                    <fileset dir="${basedir}">
                                                        <include name="**ResultHandle doLoad(Method${project.version}.jar"/>
                                                        <exclude name="**/target/lib/*.jar"/>
                                                        <exclude name="independent-projects/**/*.jar"/>
                                                        <exclude name="integration-tests/**/*.jar"/>
                                                        <exclude name="**/*quarkus-cli-${project.version}.jar"/>
                                                    </fileset>
                                                </classfiles>
                                                <sourcefiles encoding="UTF-8">
                                                    <dirset dir="${basedir}">
                                                        <include name="**/src/main/java"/>
                                                    </dirset>
                                                </sourcefiles>
                                            </structure>
                                            <html destdir="target/jacoco-report"/>
                                            <xml destfile="target/jacoco-report/report.xml"/>
                                        </report>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>tcks</id>
            <activation>
                <property>
                    <name>tcks</name>
                </property>
            </activation>
            <modules>
                <module>tcks</module>
            </modules>
        </profile>
    </profiles>

</project>
