<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2024 Craig Motlin
  ~
  ~ 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>io.liftwizard</groupId>
        <artifactId>liftwizard-profile-parent</artifactId>
        <version>2.1.32</version>
        <relativePath>../liftwizard-profile-parent</relativePath>
    </parent>

    <artifactId>liftwizard-parent-build</artifactId>

    <packaging>pom</packaging>
    <name>Liftwizard Parent Build</name>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.release>17</maven.compiler.release>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>io.liftwizard</groupId>
                <artifactId>liftwizard-dependencies</artifactId>
                <version>2.1.32</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>

        <pluginManagement>
            <plugins>

                <!--region Phase 3: generate-sources-->
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.antlr</groupId>
                    <artifactId>antlr4-maven-plugin</artifactId>
                    <version>4.9.3</version>
                    <configuration>
                        <listener>true</listener>
                        <visitor>true</visitor>
                        <treatWarningsAsErrors>true</treatWarningsAsErrors>
                    </configuration>
                    <executions>
                        <execution>
                            <id>antlr</id>
                            <goals>
                                <goal>antlr4</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!--endregion Phase 3: generate-sources-->

                <!--region Phase 3: generate-sources through Phase 17: package-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>3.15.1</version>
                    <executions>
                        <execution>
                            <id>mojo-descriptor</id>
                            <goals>
                                <goal>descriptor</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>help-goal</id>
                            <goals>
                                <goal>helpmojo</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!--endregion Phase 3: generate-sources through Phase 17: package-->

                <!--region Phase 4: process-sources-->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <!--endregion Phase 4: process-sources-->
            </plugins>
        </pluginManagement>

        <plugins>
            <!--region Phase 7: compile-->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths combine.children="append">
                        <path>
                            <groupId>com.google.auto.service</groupId>
                            <artifactId>auto-service</artifactId>
                            <version>1.0.1</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <!--endregion Phase 7: compile-->
        </plugins>
    </build>

    <profiles>

        <!--region Phase 1: validate-->
        <profile>
            <id>maven-enforcer-plugin</id>

            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <configuration>
                            <rules combine.children="append">
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>17</maxJdkVersion>
                                </enforceBytecodeVersion>
                            </rules>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
        <!--endregion Phase 1: validate-->

        <!--region Phase 16: prepare-package-->
        <profile>
            <id>znai-maven-plugin</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.testingisdocumenting.znai</groupId>
                        <artifactId>znai-maven-plugin</artifactId>
                        <version>1.73</version>
                        <configuration>
                            <docId>docs</docId>
                            <sourceRoot>${project.basedir}/src/main/znai</sourceRoot>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--endregion Phase 16: prepare-package-->

        <!--region Phase 17: package-->
        <profile>
            <id>maven-shade-plugin</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <artifactId>maven-shade-plugin</artifactId>
                            <version>3.6.0</version>
                            <configuration>
                                <createDependencyReducedPom>true</createDependencyReducedPom>
                                <transformers>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                        <resource>reference.conf</resource>
                                    </transformer>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                        <mainClass>${mainClass}</mainClass>
                                    </transformer>
                                </transformers>
                                <!-- exclude signed Manifests -->
                                <filters>
                                    <filter>
                                        <artifact>*:*</artifact>
                                        <excludes>
                                            <exclude>module-info.class</exclude>
                                            <exclude>META-INF/*.SF</exclude>
                                            <exclude>META-INF/*.DSA</exclude>
                                            <exclude>META-INF/*.RSA</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
                            </configuration>
                            <executions>
                                <execution>
                                    <goals>
                                        <goal>shade</goal>
                                    </goals>
                                    <phase>package</phase>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <!--endregion Phase 17: package-->

    </profiles>

</project>
