<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2022 Red Hat

     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

         https://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.wildfly.extras.grpc</groupId>
        <artifactId>wildfly-grpc-parent</artifactId>
        <version>0.0.6</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>wildfly-grpc-code-parent</artifactId>
    <packaging>pom</packaging>
    <name>WildFly gRPC :: Code :: Parent</name>
    <description>Parent for modules with code. Contains dependencies and plugin management</description>

    <dependencyManagement>
        <dependencies>
            <!-- BOMs first and in THIS order! -->
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-bom</artifactId>
                <version>${version.protobuf}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-bom</artifactId>
                <version>${version.grpc}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-component-matrix</artifactId>
                <!--
                    TODO Replace with ${version.wildfly} as soon as
                      org.wildfly:wildfly-component-matrix:27.0.0.Beta1
                      has been released
                 -->
                <version>27.0.0.Alpha1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Project -->
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>wildfly-grpc-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>wildfly-grpc-subsystem</artifactId>
                <version>${project.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>wildfly-grpc-feature-pack</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>wildfly-grpc-feature-pack</artifactId>
                <version>${project.version}</version>
                <type>zip</type>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- WildFly dependencies -->
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-preview-feature-pack</artifactId>
                <version>${version.wildfly}</version>
                <type>zip</type>
            </dependency>

            <!-- gRPC / protobuf dependencies -->
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-javalite</artifactId>
                <version>${version.protobuf}</version>
            </dependency>

            <!-- Misc dependencies -->
            <dependency>
                <groupId>io.perfmark</groupId>
                <artifactId>perfmark-api</artifactId>
                <version>${version.perfmark}</version>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>${version.javax.annotation}</version>
            </dependency>

            <!-- External dependencies -->
            <!-- This does not go into the modules so don't worry about exclusions -->
            <dependency>
                <groupId>org.wildfly.checkstyle</groupId>
                <artifactId>wildfly-checkstyle-config</artifactId>
                <version>${version.wildfly.checkstyle.config}</version>
            </dependency>

            <!-- Test dependencies -->
            <dependency>
                <groupId>org.jboss.arquillian.junit</groupId>
                <artifactId>arquillian-junit-core</artifactId>
                <scope>test</scope>
                <version>${version.arquillian.junit}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Ordered by artifactID -->
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <configuration>
                        <configFile>etc/eclipse-formatter-config.xml</configFile>
                        <configXmlFile>etc/xml.properties</configXmlFile>
                        <includeResources>true</includeResources>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>wildfly-grpc-build-config</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <configuration>
                        <header>etc/license.txt</header>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>wildfly-grpc-build-config</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <suppressionsLocation>etc/checkstyle-suppressions.xml</suppressionsLocation>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>wildfly-grpc-build-config</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Ordered by artifactID -->
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>formatter-format</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>format-pom</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <configuration>
                            <directories>
                                <directory>${project.basedir}</directory>
                            </directories>
                            <includeResources>false</includeResources>
                            <includes>
                                <include>pom.xml</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>formatter-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>impsort-sort</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>sort</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>impsort-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>checkstyle-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
