<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.quarkiverse.loggingui</groupId>
        <artifactId>quarkus-logging-ui-parent</artifactId>
        <version>0.1.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>quarkus-logging-ui</artifactId>
    <name>Quarkus - Logging UI - Runtime</name>

    <properties>
        <fomantic-ui.version>2.8.7</fomantic-ui.version>
        <jquery.version>3.5.1</jquery.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-vertx-http</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-vertx-web</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-undertow-websockets</artifactId>
        </dependency>
        
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jsonb</artifactId>
        </dependency>
        
        <!-- UI (Just here for dependabot) -->
        <dependency>
            <groupId>org.webjars.bower</groupId>
            <artifactId>fomantic-ui</artifactId>
            <version>${fomantic-ui.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.webjars.bower</groupId>
            <artifactId>jquery</artifactId>
            <version>${jquery.version}</version>
            <scope>provided</scope>
        </dependency>
    
    </dependencies>

    <build>
        
        <!-- Copy all web content files META-INF folder, and push it through a filter to replace maven properties -->
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.css</include>
                    <include>**/*.html</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/*.css</exclude>
                    <exclude>**/*.html</exclude>
                </excludes>
            </resource>
        </resources>
        
        
        <plugins>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
                <version>${quarkus.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>extension-descriptor</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}
                            </deployment>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>io.quarkus</groupId>
                            <artifactId>quarkus-extension-processor</artifactId>
                            <version>${quarkus.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            
            <!-- So we don't have to keep a version of these javascript libs in our repo -->
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>install-fomantic-ui-css</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/fomantic-ui@${fomantic-ui.version}/dist/semantic.min.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/logging-ui</outputDirectory>
                            <md5>d921bdf0aa472c8895b14c1cdb96eba1</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-fomantic-ui-js</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/fomantic-ui@${fomantic-ui.version}/dist/semantic.min.js</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/logging-ui</outputDirectory>
                            <md5>557ca1f9728f4b73ba6089e0c09b548b</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-fomantic-ui-fonts1</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/fomantic-ui@${fomantic-ui.version}/dist/themes/default/assets/fonts/icons.woff2</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/logging-ui/themes/default/assets/fonts/</outputDirectory>
                            <md5>b15db15f746f29ffa02638cb455b8ec0</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-fomantic-ui-tablesort</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://semantic-ui.com/javascript/library/tablesort.js</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/logging-ui/</outputDirectory>
                            <md5>5df85b5fc2601b1c61b082533764c788</md5>
                        </configuration>
                    </execution>
                    
                    <execution>
                        <id>install-query</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/jquery@${jquery.version}/dist/jquery.min.js</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/logging-ui</outputDirectory>
                            <md5>dc5e7f18c8d36ac1d3d4753a87c98d0a</md5>
                        </configuration>
                    </execution>
                    
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
