<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>
    <groupId>com.innoq.webjars</groupId>
    <artifactId>innoq-bootstrap-theme</artifactId>
    <version>1.0.0</version>
    <name>INNOQ branded Bootstrap 4 theme for internal use. </name>
    <packaging>jar</packaging>
    <description>WebJar for innoQ Bootstrap Theme</description>
    <url>https://github.com/innoq/innoq-bootstrap-theme</url>
    <licenses/>
    <scm>
        <url>https://gitlab.innoq.com/innoq/webjar-innoq-bootstrap</url>
        <connection>scm:git:https://gitlab.innoq.com/innoq/webjar-innoq-bootstrap.git</connection>
        <developerConnection>scm:git:https://gitlab.innoq.com/innoq/webjar-innoq-bootstrap.git</developerConnection>
        <tag>HEAD</tag>
    </scm>
    <developers>
        <developer>
            <id>phl</id>
            <name>Philipp Haußleiter</name>
            <email>philipp.haussleiter@innoq.com</email>
        </developer>
    </developers>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jquery-version>3.5.1</jquery-version>
        <jquery-url>https://github.com/jquery/jquery/archive/</jquery-url>
        <bootstrap-version>4.6.0</bootstrap-version>
        <bootstrap-url>https://github.com/twbs/bootstrap/releases/download/</bootstrap-url>
        <innoq-styleguide-version>v5.3.10</innoq-styleguide-version>
        <innoq-styleguide-url>https://github.com/innoq/innoq-styleguide/releases/download/</innoq-styleguide-url>
        <innoq-bootstrap-version>1.0.0</innoq-bootstrap-version>
        <innoq-bootstrap-url>https://github.com/innoq/innoq-bootstrap-theme/releases/download/</innoq-bootstrap-url>
        <destDir>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</destDir>
    </properties>
    <distributionManagement>
        <repository>
            <id>nexus.innoq.io</id>
            <name>innoq.nexus Releases</name>
            <url>https://nexus.innoq.io/repository/innoQ-public/</url>
        </repository>
        <snapshotRepository>
            <id>nexus.innoq.io</id>
            <name>innoq.nexus Snapshots</name>
            <url>https://nexus.innoq.io/repository/innoQ-public/</url>
        </snapshotRepository>
    </distributionManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>download-jquery</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <serverId>github.com</serverId>
                            <url>${jquery-url}</url>
                            <fromFile>${jquery-version}.zip</fromFile>
                            <toFile>${project.build.directory}/jquery.zip</toFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>download-bootstrap</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <serverId>github.com</serverId>
                            <url>${bootstrap-url}</url>
                            <fromFile>v${bootstrap-version}/bootstrap-${bootstrap-version}-dist.zip</fromFile>
                            <toFile>${project.build.directory}/bootstrap.zip</toFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>download-innoq-styleguide</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <serverId>github.com</serverId>
                            <url>${innoq-styleguide-url}</url>
                            <fromFile>${innoq-styleguide-version}/innoq-styleguide-${innoq-styleguide-version}.zip</fromFile>
                            <toFile>${project.build.directory}/innoq-styleguide.zip</toFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>download-innoq-bootstrap-theme</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <serverId>github.com</serverId>
                            <url>${innoq-bootstrap-url}</url>
                            <fromFile>${innoq-bootstrap-version}/innoq-bootstrap-theme-${innoq-bootstrap-version}.zip</fromFile>
                            <toFile>${project.build.directory}/innoq-bootstrap-theme.zip</toFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo message="extracting jquery"/>
                                <unzip src="${project.build.directory}/jquery.zip" dest="${project.build.directory}/jquery"/>
                                <echo message="extracting bootstrap"/>
                                <unzip src="${project.build.directory}/bootstrap.zip" dest="${project.build.directory}/bootstrap"/>
                                <echo message="extracting innoq-styleguide"/>
                                <unzip src="${project.build.directory}/innoq-styleguide.zip" dest="${project.build.directory}/innoq-styleguide"/>
                                <echo message="extracting innoq-bootstrap-theme"/>
                                <unzip src="${project.build.directory}/innoq-bootstrap-theme.zip" dest="${project.build.directory}/innoq-bootstrap-theme"/>
                                <mkdir dir="${destDir}/assets"/>
                                <move todir="${destDir}/assets">
                                    <fileset dir="${project.build.directory}/innoq-styleguide/assets/" includes="**/*.svg, **/*.png, **/*.jpg"/>
                                </move>
                                <mkdir dir="${destDir}/js"/>
                                <move todir="${destDir}/js">
                                    <fileset dir="${project.build.directory}/jquery/jquery-${jquery-version}/dist/" includes="*.map, *.js, "/>
                                </move>
                                <move todir="${destDir}/js">
                                    <fileset dir="${project.build.directory}/bootstrap/bootstrap-${bootstrap-version}-dist/js/" includes="bootstrap.bundle.*.map, bootstrap.bundle.*.js, "/>
                                </move>
                                <move todir="${destDir}">
                                    <fileset dir="${project.build.directory}/innoq-bootstrap-theme/" includes="src/, LICENSE, README.md"/>
                                </move>
                                <move todir="${destDir}/css">
                                    <fileset dir="${project.build.directory}/innoq-bootstrap-theme/dist/css/${innoq-bootstrap-version}/" includes="*.css"/>
                                </move>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <targetPath>${destDir}</targetPath>
            </resource>
        </resources>
    </build>
</project>
