<!--
  ~ JBoss, Home of Professional Open Source.
  ~
  ~ Copyright 2014 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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.logging</groupId>
        <artifactId>logging-parent</artifactId>
        <version>1.0.3.Final</version>
    </parent>

    <name>JBoss Log Manager</name>
    <description>An implementation of java.util.logging.LogManager</description>
    <groupId>org.jboss.logmanager</groupId>
    <artifactId>jboss-logmanager</artifactId>
    <version>3.1.2.Final</version>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>


    <scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false"
         child.scm.url.inherit.append.path="false">
        <connection>scm:git:git://github.com/jboss-logging/jboss-logmanager.git</connection>
        <developerConnection>scm:git:git@github.com:jboss-logging/jboss-logmanager.git</developerConnection>
        <url>https://github.com/jboss-logging/jboss-logmanager/tree/main/</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <!-- Dependency versions -->
        <version.io.smallrye.common.smallrye-common>2.2.0</version.io.smallrye.common.smallrye-common>
        <version.jakarta.json.jakarta-json-api>2.1.3</version.jakarta.json.jakarta-json-api>
        <version.org.byteman>4.0.24</version.org.byteman>
        <version.org.eclipse.parsson.jakarta.json>1.1.6</version.org.eclipse.parsson.jakarta.json>
        <version.org.jboss.logging.jboss-logging>3.5.3.Final</version.org.jboss.logging.jboss-logging>
        <version.org.jboss.modules.jboss-modules>2.1.6.Final</version.org.jboss.modules.jboss-modules>
        <version.org.junit>5.11.4</version.org.junit>

        <!-- Plugin versions -->
        <version.module-info>2.1</version.module-info>

        <!-- Test properties -->
        <org.jboss.test.address>127.0.0.1</org.jboss.test.address>
        <org.jboss.test.port>4560</org.jboss.test.port>
        <org.jboss.test.alt.port>14560</org.jboss.test.alt.port>

        <skipTests>false</skipTests>
        <skipITs>${skipTests}</skipITs>
        <skipUTs>${skipTests}</skipUTs>

        <client.jvm.jpms.args></client.jvm.jpms.args>

        <!-- JDK configuration: require Java 17 to build -->
        <jdk.min.version>17</jdk.min.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.smallrye.common</groupId>
                <artifactId>smallrye-common-bom</artifactId>
                <version>${version.io.smallrye.common.smallrye-common}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.org.junit}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <!-- An odd dependency, but required for org.wildfly.common:wildfly-common -->
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>${version.org.jboss.logging.jboss-logging}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.modules</groupId>
            <artifactId>jboss-modules</artifactId>
            <version>${version.org.jboss.modules.jboss-modules}</version>
        </dependency>

        <!-- SmallRye -->
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-constraint</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-cpu</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-expression</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-net</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-os</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-ref</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>${version.jakarta.json.jakarta-json-api}</version>
        </dependency>
        <!-- JSON implementation -->
        <dependency>
            <groupId>org.eclipse.parsson</groupId>
            <artifactId>parsson</artifactId>
            <version>${version.org.eclipse.parsson.jakarta.json}</version>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman-bmunit5</artifactId>
            <version>${version.org.byteman}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <doclint>none</doclint>
                    <sourcepath>${project.build.sourceDirectory}</sourcepath>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <!-- TODO: remove if we stop using logging-parent -->
                            <release>11</release>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <configuration>
                    <excludes>module-info.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
                <configuration>
                    <excludes>module-info.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                    <skipITs>${skipITs}</skipITs>
                    <!-- For now we will not use the module path -->
                    <useModulePath>false</useModulePath>
                    <systemPropertyVariables>
                        <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-test</id>
                    </execution>
                </executions>
                <configuration>
                    <!-- TODO: module path mode currently won't load optional modules -->
                    <useModulePath>false</useModulePath>
                    <skipTests>${skipUTs}</skipTests>
                    <includes>
                        <include>**/*Tests.java</include>
                    </includes>
                    <argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djdk.attach.allowAttachSelf=true ${client.jvm.jpms.args}</argLine>
                    <reuseForks>false</reuseForks>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>

                        <!-- Configured for SocketHandler SSL test -->
                        <javax.net.ssl.keyStore>${project.basedir}/src/test/resources/server-keystore.jks</javax.net.ssl.keyStore>
                        <javax.net.ssl.keyStorePassword>testpassword</javax.net.ssl.keyStorePassword>
                        <javax.net.ssl.trustStore>${project.basedir}/src/test/resources/client-keystore.jks</javax.net.ssl.trustStore>
                        <javax.net.ssl.trustStorePassword>testpassword</javax.net.ssl.trustStorePassword>

                        <log.dir>${project.build.directory}${file.separator}logs</log.dir>
                        <org.jboss.test.address>${org.jboss.test.address}</org.jboss.test.address>
                        <org.jboss.test.port>${org.jboss.test.port}</org.jboss.test.port>
                        <org.jboss.test.alt.port>${org.jboss.test.alt.port}</org.jboss.test.alt.port>

                        <config.dir>${project.build.testOutputDirectory}${file.separator}configs</config.dir>
                    </systemPropertyVariables>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
            <!-- Adding OSGI metadata to the JAR without changing the packaging type. -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <dependencies>
                    <dependency>
                        <groupId>biz.aQute.bnd</groupId>
                        <artifactId>biz.aQute.bndlib</artifactId>
                        <version>6.4.1</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <instructions>
                        <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
                        <Export-Package>
                            ${project.groupId}.*;version=${project.version};-split-package:=error
                        </Export-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Do not compress JAR, for faster startup times -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <configuration>
                            <archive>
                                <compress>false</compress>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.dmlloyd.maven</groupId>
                <artifactId>module-services-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>generate-services</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <excludeServices>
                                <!-- Modular impl is different from non-modular impl -->
                                <excludeService>java.util.logging.LogManager</excludeService>
                            </excludeServices>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>format-check</id>
            <build>
                <plugins>
                    <!-- Validate formatting -->
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>validate-format</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>check-import-sort</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
