<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.souther-lang</groupId>
        <artifactId>souther-parent</artifactId>
        <version>0.4.0</version>
    </parent>

    <artifactId>souther-syntax</artifactId>
    <name>Souther Syntax</name>

    <description>
        The Souther front-end: the lossless concrete syntax tree (lexer, recovering parser, red/green
        nodes) and the structured diagnostics. This layer carries no type checker or code generator,
        so the formatter and the language server can depend on it without the whole compiler.
    </description>

    <dependencies>
        <!-- Jackson 3: the JSON diagnostic renderer serialises a Diagnostic for tools and agents. -->
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <!-- The White_Space set a rule of the grammar reads string literals by, which is the one
             the runtime's trim and words read. -->
        <dependency>
            <groupId>net.unit8.199x</groupId>
            <artifactId>notation-199x</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.souther-lang</groupId>
            <artifactId>souther-test-support</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- The syntax contract the repository publishes at its root rides in this artifact, so a
                 tool that depends on the syntax layer has the grammar, the vocabulary and the corpus
                 its parser is held to. The repository's copy is the one written; this is the one
                 distributed. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundle-syntax-contract</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/META-INF/souther/syntax</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/../syntax</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
