<?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>com.atlassian.servicedesk</groupId>
        <artifactId>sd-soy-compilers</artifactId>
        <version>4.8.2-REL-0057</version>
    </parent>

    <artifactId>production-soy-compiler</artifactId>

    <name>Service Desk Production Soy Compiler</name>

    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>compile</scope>
        </dependency>
        <!--
                atlassian-soy-cli-support is hardwired to slf4j-simple
            -->
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>atlassian-soy-cli-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-resources</id>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <!--
                        Maven was packaging the Jar not in the way it should. we required a resource file, listing all the custom Soy functions
                        (like isFeatureFlagEnabled) and it appeared in the final bundle up until (presumably) AMPS / whatever update.
                        Suddenly the file was overwritten by the one present in atlassian-soy-plugin, which basically removed the definitions of
                        our custom Soy functions and thus made the whole front-end to not compile. Trying to configure maven-assembly-plugin
                        gave little to no effect, so we've came up with a custom assembly descriptor (essentially maven-assembly-plugin configuration)
                        which will ignore the file provided by atlassian-soy-plugin and use ours instead so that our front-end compiles successfully.
                        -->
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.atlassian.soy.cli.Main</mainClass>
                        </manifest>
                    </archive>
                    <finalName>atlassian-soy-cli</finalName>
                    <descriptors>
                        <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>build-jar-with-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
