<?xml version="1.0"?>
<!--
  ~ ANTLR4 Parameterized Visitor
  ~ Copyright (c) 2019 Niels Basjes. All rights reserved.
  ~ Use of this file is governed by the BSD 3-clause license.
  -->

<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <groupId>nl.basjes.antlr</groupId>
  <version>0.1-4.7.2</version>
  <artifactId>antlr4-pvisitor-parent</artifactId>
  <packaging>pom</packaging>

  <name>Antlr4 PVisitor: </name>
  <description>A modified version of the Antlr4 Visitor.</description>

  <url>https://github.com/nielsbasjes/antlr4-pvisitor</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <jdkLevel>1.8</jdkLevel>
    <maven.compiler.source>${jdkLevel}</maven.compiler.source>
    <maven.compiler.target>${jdkLevel}</maven.compiler.target>

    <antlr.version>4.7.2</antlr.version>
    <slf4j.version>1.7.26</slf4j.version>

    <git-commit-id-plugin.version>3.0.0</git-commit-id-plugin.version>
  </properties>


  <profiles>
    <profile>
      <id>packageForRelease</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <!-- explicitly define maven-deploy-plugin after other to force exec order -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
            <executions>
              <execution>
                <id>deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <!-- Description: https://github.com/ktoso/maven-git-commit-id-plugin -->
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>${git-commit-id-plugin.version}</version>
            <executions>
              <execution>
                <id>Validate-Revision-Information</id>
                <phase>validate</phase>
                <goals>
                  <goal>validateRevision</goal>
                </goals>
                <configuration>
                  <validationProperties>
                    <!-- verify that the current repository is not dirty -->
                    <validationProperty>
                      <name>Don't try to release if something has not yet been committed.</name>
                      <value>${git.dirty}</value>
                      <shouldMatchTo>false</shouldMatchTo>
                    </validationProperty>
                  </validationProperties>
                  <validationShouldFailIfNoMatch>true</validationShouldFailIfNoMatch>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <!-- Description: https://github.com/ktoso/maven-git-commit-id-plugin -->
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>${git-commit-id-plugin.version}</version>
            <executions>
              <execution>
                <id>Validate-Revision-Information</id>
                <phase>validate</phase>
                <goals>
                  <goal>validateRevision</goal>
                </goals>
                <configuration>
                  <validationProperties>
                    <!-- verify that the current repository is not dirty -->
                    <validationProperty>
                      <name>Don't try to release if something has not yet been committed.</name>
                      <value>${git.dirty}</value>
                      <shouldMatchTo>false</shouldMatchTo>
                    </validationProperty>
                    <!-- verify that the current commit has a tag -->
                    <validationProperty>
                      <name>validating current commit has a tag</name>
                      <value>${git.closest.tag.commit.count}</value>
                      <shouldMatchTo>0</shouldMatchTo>
                    </validationProperty>
                  </validationProperties>
                  <validationShouldFailIfNoMatch>true</validationShouldFailIfNoMatch>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>3.0.0-M2</version>
            <executions>
              <execution>
                <id>dependency-convergence</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <dependencyConvergence/>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>EnableReportPlugins</id>
      <activation>
        <property>
          <name>EnableReportPlugins</name>
        </property>
        <jdk>1.8</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.eluder.coveralls</groupId>
            <artifactId>coveralls-maven-plugin</artifactId>
            <version>4.3.0</version>
            <configuration>
              <timestampFormat>EpochMillis</timestampFormat>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>SkipSonarBecauseItWasNotConfigured</id>
      <activation>
        <property>
          <name>!env.SONAR_TOKEN</name>
        </property>
      </activation>
      <properties>
        <sonar.skip>true</sonar.skip>
      </properties>
    </profile>

    <profile>
      <id>Build with JDK 8</id>
      <activation>
        <jdk>1.8</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <compilerVersion>${jdkLevel}</compilerVersion>
              <source>${jdkLevel}</source>
              <target>${jdkLevel}</target>
              <compilerArgs>
                <!-- Enable almost all warnings.-->
                <!-- FIXME: Why does the hive udf fail with "An unknown compilation problem occurred" when using -Xlint:classfile,processing ? -->
                <!-- Ignore the 'serial' warnings about not having a serialVersionUID -->
                <arg>-Xlint:all,-classfile,-processing,-serial</arg>
                <arg>-Werror</arg>
              </compilerArgs>
              <showWarnings>true</showWarnings>
              <showDeprecation>true</showDeprecation>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>Build with JDK 11+</id>
      <activation>
        <jdk>[1.11,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <compilerVersion>${jdkLevel}</compilerVersion>
              <source>${jdkLevel}</source>
              <target>${jdkLevel}</target>
              <compilerArgs>
                <!-- Enable almost all warnings.-->
                <!-- Ignore the 'serial' warnings about not having a serialVersionUID -->
                <arg>-Xlint:all,-serial</arg>
                <arg>-Werror</arg>
                <arg>-implicit:class</arg>
              </compilerArgs>
              <showWarnings>true</showWarnings>
              <showDeprecation>true</showDeprecation>
              <release>8</release>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>


  </profiles>



  <modules>
    <module>antlr4-pvisitor</module>
    <module>demonstration</module>
  </modules>

  <licenses>
    <license>
      <name>The BSD License</name>
      <url>https://www.antlr.org/license.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Niels Basjes</name>
      <email>niels@basjes.nl</email>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/nielsbasjes/antlr4-pvisitor</url>
    <connection>scm:git:https://github.com/nielsbasjes/antlr4-pvisitor.git</connection>
    <developerConnection>scm:git:.</developerConnection>
  </scm>

</project>
