<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2022 Slawomir Jaranowski
  ~
  ~ 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.simplify4u</groupId>
        <artifactId>slf4j-mock-parent</artifactId>
        <version>2.4.0</version>
    </parent>

    <artifactId>slf4j2-mock</artifactId>
    <version>2.4.0</version>
    <name>SLF4J mock 2.0.x</name>

    <properties>
        <maven.site.skip>true</maven.site.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j-2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.simplify4u</groupId>
            <artifactId>slf4j-mock-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <!-- copy source of SimpleLogger -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.slf4j</groupId>
                                    <artifactId>slf4j-simple</artifactId>
                                    <classifier>sources</classifier>
                                    <version>${slf4j-2.version}</version>
                                </artifactItem>
                            </artifactItems>
                            <includes>org/slf4j/simple/*.java</includes>
                            <excludes>**/Static*,**/SimpleLoggerFactory*,**/SimpleServiceProvider*</excludes>
                            <outputDirectory>${project.build.directory}/generated-sources/slf4j</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/slf4j</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>testing</id>
            <activation>
                <property>
                    <name>maven.test.skip</name>
                    <value>!true</value>
                </property>
            </activation>

            <dependencies>
                <!-- dependencies are not available when build with -Dmaven.test.skip -->
                <dependency>
                    <groupId>org.simplify4u</groupId>
                    <artifactId>slf4j-mock-tests</artifactId>
                    <version>${project.version}</version>
                    <classifier>tests</classifier>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
