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

    Copyright 2018-2020 Lukas Krejci
    and other contributors as indicated by the @author tags.

    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">
    <parent>
        <artifactId>classif-parent</artifactId>
        <groupId>org.revapi.classif</groupId>
        <version>0.1.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>classif-dsl</artifactId>
    <version>0.1.0</version>

    <name>Classif :: DSL</name>

    <properties>
        <automatic.module.name>org.revapi.classif.dsl</automatic.module.name>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.revapi.classif</groupId>
            <artifactId>classif</artifactId>
            <version>0.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
            <version>4.7.2</version>
        </dependency>

        <dependency>
            <groupId>org.revapi.classif</groupId>
            <artifactId>classif</artifactId>
            <version>0.1.0</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-maven-plugin</artifactId>
                <configuration>
                    <analysisConfiguration>
                        <revapi.ignore>
                            <item>
                                <regex>true</regex>
                                <code>java\.class\.externalClassExposedInAPI</code>
                                <newArchive>org\.revapi\.classif:classif:jar:.*</newArchive>
                                <justification>It is not a problem to re-export stuff from Classif itself</justification>
                            </item>
                        </revapi.ignore>
                    </analysisConfiguration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>org/revapi/classif/ClassifBaseListener*</exclude>
                        <exclude>org/revapi/classif/ClassifBaseVisitor*</exclude>
                        <exclude>org/revapi/classif/ClassifLexer*</exclude>
                        <exclude>org/revapi/classif/ClassifParser*</exclude>
                        <exclude>org/revapi/classif/ClassifVisitor*</exclude>
                        <exclude>org/revapi/classif/ClassifListener*</exclude>
                        <exclude>org/revapi/classif/ClassifParser$*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>4.7.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                        <configuration>
                            <visitor>true</visitor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- make everything Antlr generates package-private.. There is no option to do that using
                 antlr itself, hence this hack -->
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>target/generated-sources/antlr4/**/*.java</include>
                    </includes>
                    <variableTokenValueMap>
                        public class=class,public interface=interface
                    </variableTokenValueMap>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
