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

    Copyright 2017-2026 Philip Helger, pgcc@helger.com

    Copyright 2011 Google Inc. All Rights Reserved.
    Author: sreeni@google.com (Sreeni Viswanadha)

    Copyright (c) 2006, Sun Microsystems, Inc.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

        * Redistributions of source code must retain the above copyright notice,
          this list of conditions and the following disclaimer.
        * Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
        * Neither the name of the Sun Microsystems, Inc. nor the names of its
          contributors may be used to endorse or promote products derived from
          this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    THE POSSIBILITY OF SUCH DAMAGE.

-->
<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>com.helger</groupId>
    <artifactId>parent-pom</artifactId>
    <version>3.1.0</version>
  </parent>
  <artifactId>parser-generator-cc</artifactId>
  <packaging>jar</packaging>
  <name>parser-generator-cc</name>
  <version>3.0.0</version>
  <description>ParserGenerator is a parser/scanner generator for java (fork of JavaCC 7.0.3)</description>
  <url>https://github.com/phax/ParserGeneratorCC</url>
  <inceptionYear>2017</inceptionYear>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/phax/ParserGeneratorCC/issues</url>
  </issueManagement>
  <organization>
    <name>Philip Helger</name>
    <url>http://www.helger.com</url>
  </organization>
  <scm>
    <connection>scm:git:https://github.com/phax/ParserGeneratorCC.git</connection>
    <developerConnection>scm:git:https://github.com/phax/ParserGeneratorCC.git</developerConnection>
    <url>http://github.com/phax/ParserGeneratorCC</url>
    <tag>parser-generator-cc-3.0.0</tag>
  </scm>
  <developers>
    <developer>
      <id>philip</id>
      <name>Philip Helger</name>
      <email>ph(at)helger.com</email>
      <url>http://www.helger.com</url>
    </developer>
  </developers>
  <contributors>
    <contributor>
      <name>Sreenivasa Viswanadha</name>
      <email>sreeni At dev.java.net</email>
      <roles>
        <role>Owner</role>
      </roles>
      <timezone>0</timezone>
      <organization>javacc.org</organization>
      <organizationUrl>https://javacc.org</organizationUrl>
    </contributor>
    <contributor>
      <name>Chris Ainsley</name>
      <email>ainsleyc At dev.java.net</email>
      <roles>
        <role>Developer</role>
      </roles>
      <timezone>0</timezone>
      <organization>java.net</organization>
      <organizationUrl>http://www.java.net/</organizationUrl>
    </contributor>
    <contributor>
      <name>Tim Pizey</name>
      <email>timp AT paneris.org</email>
      <roles>
        <role>Maven maven</role>
        <role>Developer</role>
      </roles>
      <timezone>0</timezone>
      <url>http://paneris.org/~timp</url>
      <organization>Context Computing</organization>
      <organizationUrl>http://www.context-computing.co.uk/</organizationUrl>
    </contributor>
    <contributor>
      <name>Francis ANDRE</name>
      <email>zosrothko AT orange.fr</email>
      <roles>
        <role>Developer</role>
      </roles>
      <timezone>0</timezone>
      <url>http://www.kampbell.net</url>
      <organization>Kampbell</organization>
      <organizationUrl>https://github.com/Kampbell/</organizationUrl>
    </contributor>
  </contributors>
  
  <licenses>
    <license>
      <name>Berkeley Software Distribution (BSD) License</name>
      <url>http://www.opensource.org/licenses/bsd-license.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.helger.commons</groupId>
        <artifactId>ph-commons-parent-pom</artifactId>
        <version>12.4.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  
  <dependencies>
    <dependency>
      <groupId>com.helger.commons</groupId>
      <artifactId>ph-base</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger.commons</groupId>
      <artifactId>ph-security</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger.commons</groupId>
      <artifactId>ph-xml</artifactId>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.javaparser</groupId>
      <artifactId>javaparser-core</artifactId>
      <version>3.28.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <properties>
    <!--
      The plugin that generates this project. Must be a RELEASED version by default, because that is
      what a release build has to work with. See the "selfhost" profile for building this project
      with its own generator.
    -->
    <ph-javacc-maven-plugin.version>5.0.2</ph-javacc-maven-plugin.version>
  </properties>

  <build>
    <resources>
      <!-- Don't specify the targetPath because this leads to a broken JAR file 
        in combination with the bundle plugin (absolute file paths in ZIP file) -->
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/*.properties</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>com.helger.maven</groupId>
        <artifactId>ph-javacc-maven-plugin</artifactId>
        <version>${ph-javacc-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>phase1</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>javacc</goal>
            </goals>
            <configuration>
              <sourceDirectory>src/main/javacc</sourceDirectory>
              <includes>
                <include>JavaCC.jj</include>
                <include>ConditionParser.jj</include>
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>phase2</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>jjtree-javacc</goal>
            </goals>
            <configuration>
              <sourceDirectory>src/main/jjtree</sourceDirectory>
              <includes>
                <include>JJTree.jjt</include>
              </includes>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <jdkVersion>1.8</jdkVersion>
          <javaTemplateType>modern</javaTemplateType>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*.txt</exclude>
            <exclude>**/*.template</exclude>
            <exclude>examples/*</exclude>
            <exclude>grammars/*</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <source>17</source>
          <sourcepath>
            ${project.build.sourceDirectory}:${project.build.directory}/generated-sources/javacc:${project.build.directory}/generated-sources/jjtree
          </sourcepath>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <siteDirectory>www</siteDirectory>
          <locales>en</locales>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
  <profiles>
    <profile>
      <!--
        Build this project with its own generator instead of the last released one.

        This project is generated by a released version of itself, so a change to the grammar
        handling or the code generation does not affect this build until it was released and a new
        ph-javacc-maven-plugin picked it up. This profile short circuits that, so that such a change
        can be verified before it is released:

          mvn clean install -DskipTests
          cd ../ph-javacc-maven-plugin
          mvn clean install -DskipTests -Dpgcc.version=<this projects SNAPSHOT version>
          cd -
          mvn clean verify -Pselfhost

        It is deliberately NOT the default - a release build must always work with what is on Maven
        Central.
      -->
      <id>selfhost</id>
      <properties>
        <ph-javacc-maven-plugin.version>5.0.3-SNAPSHOT</ph-javacc-maven-plugin.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>com.helger.maven</groupId>
            <artifactId>ph-javacc-maven-plugin</artifactId>
            <!--
              Naming the SNAPSHOT plugin is not enough. The plugin resolves its own generator
              through its installed POM, which carries the released pgcc.version as the property
              default, so "mvn install -Dpgcc.version=..." on the plugin does not reach a consumer.
              Overriding the plugin's dependency here is what actually makes this build use the
              generator in this checkout.
            -->
            <dependencies>
              <dependency>
                <groupId>com.helger</groupId>
                <artifactId>parser-generator-cc</artifactId>
                <version>${project.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
