<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright (c) 2023, David Beaumont (https://github.com/hagbard).
  ~
  ~ This program and the accompanying materials are made available under the terms of the
  ~ Eclipse Public License v. 2.0 available at https://www.eclipse.org/legal/epl-2.0, or the
  ~ Apache License, Version 2.0 available at https://www.apache.org/licenses/LICENSE-2.0.
  ~
  ~ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
  -->

<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>net.goui.flogger.testing</groupId>
        <artifactId>root</artifactId>
        <version>1.0.12</version>
    </parent>

    <artifactId>log4j</artifactId>
    <name>Flogger Log4j2 Test Integration</name>
    <version>1.0.12</version>
    <packaging>jar</packaging>
    <url>${base.url}/${project.artifactId}</url>

    <!-- Use separate profiles to test Log4J integration with and without a Flogger dependency. -->
    <!-- Core functionality is still present even when logging directly (including Metadata). -->
    <profiles>
        <profile>
            <id>withoutFlogger</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>withFlogger</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>test/main/flogger</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <!-- https://mvnrepository.com/artifact/com.google.flogger/flogger-log4j2-backend -->
                <dependency>
                    <groupId>com.google.flogger</groupId>
                    <artifactId>flogger-log4j2-backend</artifactId>
                    <version>0.8</version>
                    <scope>test</scope>
                </dependency>
                <!-- https://mvnrepository.com/artifact/com.google.flogger/flogger-grpc-context -->
                <dependency>
                    <groupId>com.google.flogger</groupId>
                    <artifactId>flogger-grpc-context</artifactId>
                    <version>0.8</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>net.goui.flogger.testing</groupId>
            <artifactId>api</artifactId>
            <version>1.0.12</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.20.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.20.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.0.0-jre</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/net.goui.flogger.testing/junit4 -->
        <dependency>
            <groupId>net.goui.flogger.testing</groupId>
            <artifactId>junit4</artifactId>
            <version>1.0.12</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.truth/truth -->
        <dependency>
            <groupId>com.google.truth</groupId>
            <artifactId>truth</artifactId>
            <version>1.4.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
