<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright © 2025 PANTHEON.tech, s.r.o. and others.

 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0 which accompanies this distribution,
 and is available at http://www.eclipse.org/legal/epl-v10.html
 -->
<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.opendaylight.mdsal</groupId>
        <artifactId>binding-parent</artifactId>
        <version>16.0.3</version>
        <relativePath/>
    </parent>

    <groupId>org.opendaylight.gnmi</groupId>
    <artifactId>gnmi-parent</artifactId>
    <version>3.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <protobuf.version>3.25.8</protobuf.version>
        <grpc.version>1.75.0</grpc.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.opendaylight.gnmi</groupId>
                <artifactId>bnd-parent</artifactId>
                <version>3.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- gRPC: we are not using BOM to deal with all the funky exclusions we need -->
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-api</artifactId>
                <version>${grpc.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf</artifactId>
                <version>${grpc.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf-lite</artifactId>
                <version>${grpc.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-netty</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-stub</artifactId>
                <version>${grpc.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>source-quality</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <configuration>
                            <configLocation>odl_checks.xml</configLocation>
                            <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                            <!-- <sourceDirectories> are needed so that checkstyle ignores the
                                 generated sources directory -->
                            <sourceDirectories>
                                <directory>${project.build.sourceDirectory}</directory>
                            </sourceDirectories>
                            <includeResources>true</includeResources>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <includeTestResources>true</includeTestResources>
                            <includes>**\/*.java, **\/*.xtend</includes>
                            <excludes>
                                org/opendaylight/yang/gen/**,
                                **/protobuff/messages/**,
                                **/thrift/gen/*.java
                            </excludes>
                            <failsOnError>true</failsOnError>
                            <consoleOutput>true</consoleOutput>
                            <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <phase>process-sources</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>test-integration</id>
            <!-- run integration tests and skip unit tests -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>integration-test-execution</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>
                                    ${project.build.testOutputDirectory}/suites/all/suiteOfSuites.xml
                                </suiteXmlFile>
                            </suiteXmlFiles>
                            <includes>
                                <include>**/*TestIT.java</include>
                            </includes>
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>analyze-compile</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
