<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>net.hasor</groupId>
        <artifactId>hasor-parent</artifactId>
        <version>4.2.2</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <!-- Maven Info -->
    <artifactId>hasor-dataql</artifactId>
    <packaging>jar</packaging>

    <!-- Project Info -->
    <name>Hasor-DataQL/Runtime</name>
    <description>the hasor DataQL project.</description>

    <developers>
        <developer>
            <name>赵永春(Mr.Zhao)</name>
            <email>zyc@hasor.net</email>
        </developer>
    </developers>

    <properties>
        <antlr4.visitor>true</antlr4.visitor>
    </properties>

    <build>
        <plugins>
            <!-- 把 antlr4 目录的 g4 文件生源代码到 target/generated-sources/antlr4 目录下 -->
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>4.9.1</version>
                <executions>
                    <execution>
                        <configuration>
                            <visitor>true</visitor>
                        </configuration>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- 把 target/generated-sources/antlr4 目录加入到源码 -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/antlr4</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- 把 target/generated-sources/antlr4 目录下生成的两个 DataQL tokens 文件放回到 g4 目录（为了 IDE 插件） -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <configuration>
                            <target>
                                <copy file="${basedir}/target/generated-sources/antlr4/DataQLLexer.tokens" tofile="${basedir}/src/main/antlr4/net/hasor/dataql/compiler/parser/DataQLLexer.tokens" />
                                <copy file="${basedir}/target/generated-sources/antlr4/DataQLParser.tokens" tofile="${basedir}/src/main/antlr4/net/hasor/dataql/compiler/parser/DataQLParser.tokens" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- 引用依赖 -->
    <dependencies>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
        </dependency>
        <!-- Hasor-Core -->
        <dependency>
            <groupId>net.hasor</groupId>
            <artifactId>hasor-core</artifactId>
        </dependency>
    </dependencies>
</project>
