<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>
<!--
    This module invokes the Windup TypeScript Models Generator Maven Plugin
    and creates an artifact with those models in tsModels/ .
-->
    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>22</version>
        <relativePath />
    </parent>

    <groupId>org.jboss.windup.web.ui</groupId>
    <artifactId>windup-web-ui-tsmodels</artifactId>
    <version>4.2.0.Final</version>

    <name>Windup Web - Generate TS Models</name>

    <licenses>
        <license>
            <name>Eclipse Public License version 1.0</name>
            <url>http://www.eclipse.org/legal/epl-v10.html</url>
        </license>
    </licenses>

    <prerequisites>
        <maven>3.2</maven>
    </prerequisites>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>

        <version.windup.core>4.2.0.Final</version.windup.core>
        <!-- For now, we need to pass this to the Mojo explicitly (through META-INF/versions.properties),
             but it should be possible to figure that out from the Windup POM. -->
        <version.forge>3.7.2.Final</version.forge>
        <version.furnace>2.26.2.Final</version.furnace>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.windup</groupId>
                <artifactId>windup-bom</artifactId>
                <version>${version.windup.core}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.windup.rules</groupId>
                <artifactId>windup-rulesets</artifactId>
                <version>${version.windup.core}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>runPlugin</id>
            <activation> <activeByDefault>true</activeByDefault> </activation>
            <build>
                <plugins>
                    <!-- Run the Windup TS Models Generator plugin -->
                    <plugin>
                        <groupId>org.jboss.windup.web.plugin</groupId>
                        <artifactId>windup-tsmodelsgen-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <configuration>
                            <outputDir>${project.build.directory}/tsModels</outputDir>
                            <!-- MATERIALIZED, DECORATED -->
                            <adjacencyMode>DECORATED</adjacencyMode>
                            <!-- "../../" if it goes to app/tsModels/ -->
                            <!-- "" if it goes to target/tsModels and compiled
                                 using tsconfig-tsModels.json: `tsc -p target/tsModels/` -->
                            <!-- Or a Maven token to be replaced using maven-resources-plugin. -->
                            <importPathToWebapp>$MAVEN_TOKEN{windup.tsmodelgen.importPathToWebapp}</importPathToWebapp>
                            <overwrite>true</overwrite>
                            <fileNamingStyle>CAMELCASE</fileNamingStyle>
                        </configuration>
                        <executions>
                            <execution>
                                <id>generateTSmodels</id>
                                <phase>generate-sources</phase>
                                <goals> <goal>tsmodelgen</goal> </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.0.2</version>
                        <configuration>
                            <classesDirectory>${project.build.directory}</classesDirectory>
                            <archive>
                                <addMavenDescriptor>false</addMavenDescriptor>
                            </archive>
                            <includes>
                                <include>tsModels/**</include>
                            </includes>
                        </configuration>
                        <!-- In case we would like an extra artifact...
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals> <goal>jar</goal> </goals>
                                <configuration>
                                    <classesDirectory>${project.build.directory}</classesDirectory>
                                    <classifier>models</classifier>
                                    <archive>
                                        <addMavenDescriptor>false</addMavenDescriptor>
                                    </archive>
                                    <includes>
                                        <include>tsModels/**</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                        -->
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

  <scm>
    <tag>4.2.0.Final</tag>
  </scm>
</project>
