<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2021, salesforce.com, inc.
    All rights reserved.
    SPDX-License-Identifier: MIT
    For full license text, see the LICENSE file in the repo root
    or https://opensource.org/licenses/MIT
-->
<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>utam-java</artifactId>
        <groupId>com.salesforce.utam</groupId>
        <version>1.1.6</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>utam-compiler</artifactId>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>The compiler for generating Java source code for UTAM Page Objects</description>
    <url>http://github.com/salesforce/utam-java</url>

    <dependencies>
        <dependency>
            <groupId>com.salesforce.utam</groupId>
            <artifactId>utam-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.googlejavaformat</groupId>
            <artifactId>google-java-format</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.contrastsecurity</groupId>
            <artifactId>java-sarif</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>utam.compiler.CommandLineEntryPoint</mainClass>
                        </manifest>
                    </archive>
                    <descriptors>
                        <descriptor>src/assembly/standalone.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/test/java/generated</directory>
                            <includes>
                                <include>**</include>
                            </includes>
                            <excludes>
                                <exclude>**/utils/**/*.java</exclude>
                            </excludes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-generate-page-object-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>utam.compiler.EntryPoint</mainClass>
                    <arguments>
                        <argument>--config</argument>
                        <argument>${basedir}/src/test/resources/generated/compiler.config.json</argument>
                        <argument>--compilerRoot</argument>
                        <argument>${basedir}</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
