<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012-2018 Red Hat, Inc.
    This program and the accompanying materials are made
    available under the terms of the Eclipse Public License 2.0
    which is available at https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0

    Contributors:
      Red Hat, Inc. - initial API and implementation

-->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>che-parent</artifactId>
        <groupId>org.eclipse.che</groupId>
        <version>6.18.2</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <artifactId>che-ide-gwt-app</artifactId>
    <packaging>gwt-app</packaging>
    <name>Che IDE :: GWT App</name>
    <description>Compiles Che IDE GWT application and packages it as a WAR-like archive which contains pure output of the GWT compiler</description>
    <properties>
        <generated.sources.directory>${project.build.directory}/generated-sources/gen</generated.sources.directory>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.che.core</groupId>
            <artifactId>che-ide-full</artifactId>
            <type>gwt-lib</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>net.ltgt.gwt.maven</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <moduleName>org.eclipse.che.ide.IDE</moduleName>
                    <moduleShortName>_app</moduleShortName>
                    <jvmArgs>
                        <arg>${gwt.compiler.jvmArgs.Xss}</arg>
                        <arg>${gwt.compiler.jvmArgs.Xmx}</arg>
                    </jvmArgs>
                    <compilerArgs>
                        <arg>-generateJsInteropExports</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-ExtensionManager</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.eclipse.che.util.ExtensionManagerGenerator</mainClass>
                            <arguments>
                                <argument>--rootDir=${generated.sources.directory}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-IDEInjector</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.eclipse.che.util.IDEInjectorGenerator</mainClass>
                            <arguments>
                                <argument>--rootDir=${generated.sources.directory}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-DtoRegistry</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.eclipse.che.util.DtoFactoryVisitorRegistryGenerator</mainClass>
                            <arguments>
                                <argument>--rootDir=${generated.sources.directory}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.che.core</groupId>
                <artifactId>che-core-dyna-provider-generator-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputDirectory>${generated.sources.directory}</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <timestampFormat>{0, date, yyyy-MM-dd HH:mm:ss}</timestampFormat>
                    <buildNumberPropertyName>revision</buildNumberPropertyName>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <shortRevisionLength>16</shortRevisionLength>
                </configuration>
            </plugin>
            <!-- pass the generated sources to compiler:compile -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated.sources.directory}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>analyze</id>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compilation-mappings-properties</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <length mode="each" property="compilation-mappings-properties">
                                    <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}/_app">
                                        <include name="**/*.cache.js" />
                                    </fileset>
                                </length>
                                <echo append="false" file="${project.build.directory}/${project.artifactId}-${project.version}/_app/compilation-mappings.properties">${compilation-mappings-properties}</echo>
                                <replace file="${project.build.directory}/${project.artifactId}-${project.version}/_app/compilation-mappings.properties" token="${project.build.directory}/${project.artifactId}-${project.version}/_app/" value="" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>buildnumber</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo append="false" file="${project.build.directory}/classes/org/eclipse/che/ide/ext/help/client/BuildInfo.properties">revision = ${revision}
                                    buildTime = ${timestamp}
                                    version = ${project.version}</echo>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
