<!--
  ~ Copyright 2016-present Open Networking Foundation
  ~
  ~ 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.onosproject</groupId>
        <artifactId>onos-base</artifactId>
        <version>1</version>
    </parent>

    <artifactId>onos-yang-tools</artifactId>
    <version>2.4.7</version>
    <packaging>pom</packaging>

    <prerequisites>
        <maven>3.0.5</maven>
    </prerequisites>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <onos-build-conf.version>1.13.1</onos-build-conf.version>
        <guava.version>22.0</guava.version>
        <errorprone.version>2.2.0</errorprone.version>
        <betachecker.version>1.0</betachecker.version>
    </properties>

    <modules>
        <module>compiler</module>
        <module>model</module>
        <module>runtime</module>
        <module>serializers</module>
    </modules>

    <!-- FIXME this can be removed if/when buck-api is released -->
    <repositories>
        <repository>
            <id>snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>fail</checksumPolicy>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.eclipse.jdt/org.eclipse.jdt.core -->
        <!-- FIXME signature files generated by pkg need to be removed-->
        <!--dependency>
            <groupId>org.eclipse.jdt</groupId>
            <artifactId>org.eclipse.jdt.core</artifactId>
            <version>3.10.0</version>
        </dependency-->

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.21</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M1</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0.5</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerId>javac-with-errorprone</compilerId>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    <annotationProcessorPaths>
                      <path>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava-beta-checker</artifactId>
                        <version>${betachecker.version}</version>
                      </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                      <compilerArg>-Xpkginfo:always</compilerArg>
                      <arg>-Xep:BetaApi:WARN</arg>
                      <!-- FIXME remove below once generated code is fixed -->
                      <arg>-XepExcludedPaths:${project.build.directory}/generated-sources/.*</arg>
                    </compilerArgs>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <compilerArgs>
                              <arg>-Xep:BetaApi:OFF</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                      <groupId>org.codehaus.plexus</groupId>
                      <artifactId>plexus-compiler-javac-errorprone</artifactId>
                      <version>2.8.2</version>
                    </dependency>
                    <dependency>
                      <groupId>com.google.errorprone</groupId>
                      <artifactId>error_prone_core</artifactId>
                      <!-- override plexus-compiler-javac-errorprone's dependency with the
                           latest Error Prone version -->
                      <version>${errorprone.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.2.0</version>
                <extensions>true</extensions>
                <configuration>
                    <niceManifest>true</niceManifest>
                    <instructions>
                      <!-- Accept any version of Guava, released later than the one we use -->
                      <Import-Package>
                          com.google.*;version=${guava.version},
                          *
                      </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.onosproject</groupId>
                        <artifactId>onos-build-conf</artifactId>
                        <version>${onos-build-conf.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDirectories>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                    </sourceDirectories>
                    <testSourceDirectories>
                        <testSourceDirectory>${project.build.testSourceDirectory}</testSourceDirectory>
                    </testSourceDirectories>
                    <configLocation>onos/checkstyle-mvn.xml</configLocation>
                    <suppressionsLocation>onos/suppressions.xml
                    </suppressionsLocation>
                    <failsOnError>false</failsOnError>
                    <logViolationsToConsole>true</logViolationsToConsole>
                    <includeTestSourceDirectory>true
                    </includeTestSourceDirectory>
                    <headerLocation>onos/apache2-java.header</headerLocation>
                </configuration>
                <executions>
                    <execution>
                        <id>validate-checkstyle</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>1.3</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.compendium</artifactId>
                <version>5.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.21</version>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>5.0.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
