<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2012 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>org.jboss.wildscribe</groupId>
        <artifactId>wildscribe-parent</artifactId>
        <version>2.0.0.Beta2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>wildscribe-site-generator</artifactId>

    <name>Wildscribe Site Generator</name>

    <properties>
        <versions.txt.dir>${project.parent.basedir}/models/standalone</versions.txt.dir>
        <output.dir>${project.basedir}/target/wildscribe-generated</output.dir>
        <server.version/>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
        </dependency>

        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jboss-dmr</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
        </dependency>

        <dependency>
            <groupId>com.googlecode.htmlcompressor</groupId>
            <artifactId>htmlcompressor</artifactId>
        </dependency>
        <!-- Test dependencies -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <enableAssertions>true</enableAssertions>
                    <runOrder>reversealphabetical</runOrder>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.jboss.wildscribe.site.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <mainClass>org.jboss.wildscribe.site.Main</mainClass>
                    <arguments>
                        <argument>${versions.txt.dir}</argument>
                        <argument>${output.dir}</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>single-version</id>
            <activation>
                <property>
                    <name>server.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>${version.invoker.plugin}</version>
                        <executions>
                            <execution>
                                <id>generate-single-version</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <projectsDirectory>src/it</projectsDirectory>
                                    <localRepositoryPath>target/local-repo</localRepositoryPath>
                                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                                    <mergeUserSettings>true</mergeUserSettings>
                                    <filterProperties>
                                        <server.version>${server.version}</server.version>
                                        <versions.txt.dir>
                                            ${project.parent.basedir}/models/standalone/${server.version}.dmr
                                        </versions.txt.dir>
                                    </filterProperties>
                                    <scriptVariables>
                                        <server.version>${server.version}</server.version>
                                    </scriptVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
