<?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>1.0-4.9.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>

    <!-- In order for everything to work correctly we need at least this version of maven. -->
    <maven.minimal.version>3.6.0</maven.minimal.version>

    <antlr.version>4.9.2</antlr.version>
    <slf4j.version>1.7.31</slf4j.version>

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

  <build>
    <pluginManagement>
      <plugins>
        <plugin><artifactId>maven-assembly-plugin</artifactId><version>3.3.0</version></plugin>
        <plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin>
        <plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version></plugin>
        <plugin><artifactId>maven-deploy-plugin</artifactId><version>3.0.0-M1</version></plugin>
        <plugin><artifactId>maven-enforcer-plugin</artifactId><version>3.0.0-M3</version></plugin>
        <plugin><artifactId>maven-install-plugin</artifactId><version>3.0.0-M1</version></plugin>
        <plugin><artifactId>maven-jar-plugin</artifactId><version>3.2.0</version></plugin>
        <plugin><artifactId>maven-javadoc-plugin</artifactId><version>3.3.0</version></plugin>
        <plugin><artifactId>maven-resources-plugin</artifactId><version>3.2.0</version></plugin>
        <plugin><artifactId>maven-shade-plugin</artifactId><version>3.2.4</version></plugin>
        <plugin><artifactId>maven-site-plugin</artifactId><version>3.9.1</version></plugin>
        <plugin><artifactId>maven-source-plugin</artifactId><version>3.2.1</version></plugin>
        <plugin><artifactId>maven-surefire-plugin</artifactId><version>3.0.0-M5</version></plugin>
        <plugin><artifactId>maven-war-plugin</artifactId><version>3.3.1</version></plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>2.8.1</version>
          <configuration>
            <rulesUri>classpath:///maven-version-rules.xml</rulesUri>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>nl.basjes.antlr</groupId>
              <artifactId>devtools</artifactId>
              <version>${project.version}</version>
            </dependency>
          </dependencies>
        </plugin>

      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[${maven.minimal.version},)</version>
                  <message>You must use Maven version ${maven.minimal.version} or newer to build this project.</message>
                  <!-- Reasons for this need:                            -->
                  <!-- https://issues.apache.org/jira/browse/MDEPLOY-221 -->
                  <!-- https://issues.apache.org/jira/browse/MNG-6581    -->
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

  </build>

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

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.0.1</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.2.1</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.3.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/git-commit-id/git-commit-id-maven-plugin -->
            <groupId>io.github.git-commit-id</groupId>
            <artifactId>git-commit-id-maven-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/git-commit-id/git-commit-id-maven-plugin -->
            <groupId>io.github.git-commit-id</groupId>
            <artifactId>git-commit-id-maven-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-M3</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.-->
                <!-- Ignore the 'serial' warnings about not having a serialVersionUID -->
                <arg>-Xlint:all,-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>devtools</module>
    <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>
