<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.github.daishy</groupId>
    <artifactId>range-slider</artifactId>
    <version>1.0.1</version>
    <packaging>jar</packaging>

    <name>range-slider</name>
    <description>A rangeslider for Vaadin 8</description>
    <url>https://github.com/daishy/range-slider</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>


        <!-- ZIP Manifest fields -->
        <Implementation-Version>${project.version}</Implementation-Version>
        <!-- Must not change this because of the Directory -->
        <Implementation-Title>${project.name}</Implementation-Title>
        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
        <Vaadin-License-Title>Apache License 2.0</Vaadin-License-Title>
        <Vaadin-Addon>${project.artifactId}-${project.version}.jar</Vaadin-Addon>
    </properties>

    <developers>
        <developer>
            <id>daishy</id>
            <name>Andre Schemschat</name>
            <email>daishy@github.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <organization>
        <name>Daishy</name>
        <url>https://github.com/daishy/range-slider/</url>
    </organization>

    <scm>
        <url>git://github.com/daishy/range-slider.git</url>
        <connection>scm:git:git://github.com/daishy/range-slider.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:/daishy/range-slider.git</developerConnection>
        <tag>range-slider-1.0.0</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/daishy/range-slider/issues</url>
    </issueManagement>

    <dependencies>
        <!-- Vaadin -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>[8.0.0,9.0.0)</version>
            <scope>provided</scope>
        </dependency>

        <!-- Unit-Tests -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <!-- Package format version - do not change -->
                            <Vaadin-Package-Version>1</Vaadin-Package-Version>
                            <Vaadin-License-Title>${Vaadin-License-Title}</Vaadin-License-Title>
                            <Vaadin-Widgetsets>com.github.daishy.rangeslider.WidgetSet</Vaadin-Widgetsets>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>


            <!-- Minifies the JS and CSS files -->
            <plugin>
                <groupId>com.samaxes.maven</groupId>
                <artifactId>minify-maven-plugin</artifactId>
                <version>1.7.6</version>
                <executions>
                    <execution>
                        <configuration>
                            <!-- Configuring the pathes seems neccessary somehow -->
                            <webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
                            <webappTargetDir>${basedir}/src/main/resources</webappTargetDir>
                            <cssSourceDir>com/github/daishy/rangeslider</cssSourceDir>
                            <cssTargetDir>com/github/daishy/rangeslider/generated</cssTargetDir>
                            <jsSourceDir>com/github/daishy/rangeslider</jsSourceDir>
                            <jsTargetDir>com/github/daishy/rangeslider/generated</jsTargetDir>

                            <cssSourceFiles>
                                <cssSourceFile>nouislider.css</cssSourceFile>
                                <cssSourceFile>rangeslider-styles.css</cssSourceFile>
                            </cssSourceFiles>
                            <cssFinalFile>rangeslider.css</cssFinalFile>

                            <jsSourceFiles>
                                <jsSourceFile>nouislider.js</jsSourceFile>
                                <jsSourceFile>rangeslider-connector.js</jsSourceFile>
                            </jsSourceFiles>
                            <jsFinalFile>rangeslider.js</jsFinalFile>


                            <cssEngine>YUI</cssEngine>
                            <jsEngine>CLOSURE</jsEngine>
                            <closureCompilationLevel>SIMPLE_OPTIMIZATIONS</closureCompilationLevel>
                        </configuration>
                        <goals>
                            <goal>minify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <!-- Testing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
            </plugin>
        </plugins>

        <!-- This is needed for the sources required by the client-side compiler to be
            included in the produced JARs -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>rebel.xml</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

    </build>

    <profiles>

        <!-- The following profile handles creating the zip-file for the vaadin-directory -->
        <profile>
            <id>vaadin-release</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>assembly/assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

        </profile>

        <!-- The following profile handles deploying to maven-central / oosrh -->
        <profile>
            <id>oss-release</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
            </distributionManagement>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>


</project>
