<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.umlet</groupId>
        <artifactId>umlet-parent</artifactId>
        <version>15.1</version>
    </parent>

    <artifactId>umlet-vscode</artifactId>
    <packaging>gwt-app</packaging>

    <properties>
        <!-- GWT 2.8 requires Java 8 -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <gwt.version>2.8.2</gwt.version>
        <gwt.plugin.version>1.0-rc-10</gwt.plugin.version>
        <gwt.module.name>umletvscode</gwt.module.name>
        <npm.version>v12.16.2</npm.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.umlet</groupId>
            <artifactId>umlet-gwt</artifactId>
            <version>${project.version}</version>
            <type>gwt-lib</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- assemble UMLetVSCode output as zip file -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <style>PRETTY</style>
                    <descriptor>src/assembly/dep.xml</descriptor>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <id>create-archive</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- start the GWT compiler during the build -->
            <plugin>
                <groupId>net.ltgt.gwt.maven</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <style>PRETTY</style>
                    <!-- <skipCompilation>true</skipCompilation> -->
                    <moduleName>${gwt.module.name}</moduleName>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <configuration>
                            <style>PRETTY</style>
                            <tasks>
                                <copy todir="${project.build.directory}/${project.build.finalName}">
                                    <fileset dir="${project.basedir}/src/main/web"/>
                                </copy>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.9.1</version>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>vsce package</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>install</phase>
                        <configuration>
                            <arguments>run vsce</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nodeVersion>${npm.version}</nodeVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
