<?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>ca.weblite</groupId>
        <artifactId>teavm-react-parent</artifactId>
        <version>0.1.4</version>
    </parent>

    <artifactId>teavm-react-site</artifactId>
    <packaging>jar</packaging>
    <name>teavm-react-site</name>
    <description>Documentation site for teavm-react, built with teavm-react</description>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>ca.weblite</groupId>
            <artifactId>teavm-react-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.teavm</groupId>
            <artifactId>teavm-classlib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.teavm</groupId>
            <artifactId>teavm-jso</artifactId>
        </dependency>
        <dependency>
            <groupId>org.teavm</groupId>
            <artifactId>teavm-jso-apis</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.teavm</groupId>
                <artifactId>teavm-maven-plugin</artifactId>
                <version>${teavm.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>process-classes</phase>
                        <configuration>
                            <mainClass>ca.weblite.teavmreact.docs.App</mainClass>
                            <targetType>JAVASCRIPT</targetType>
                            <minifying>false</minifying>
                            <debugInformationGenerated>true</debugInformationGenerated>
                            <sourceMapsGenerated>true</sourceMapsGenerated>
                            <stopOnErrors>true</stopOnErrors>
                            <targetDirectory>${project.build.directory}/webapp/js</targetDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>copy-webapp</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/webapp</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/webapp</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.teavm</groupId>
                        <artifactId>teavm-maven-plugin</artifactId>
                        <version>${teavm.version}</version>
                        <executions>
                            <execution>
                                <goals><goal>compile</goal></goals>
                                <phase>process-classes</phase>
                                <configuration>
                                    <mainClass>ca.weblite.teavmreact.docs.App</mainClass>
                                    <targetType>JAVASCRIPT</targetType>
                                    <minifying>false</minifying>
                                    <debugInformationGenerated>false</debugInformationGenerated>
                                    <sourceMapsGenerated>false</sourceMapsGenerated>
                                    <incremental>true</incremental>
                                    <stopOnErrors>true</stopOnErrors>
                                    <targetDirectory>${project.build.directory}/webapp/js</targetDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
