<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.stash</groupId>
        <artifactId>stash-plugins-parent</artifactId>
        <version>1.0.1-m1</version>
    </parent>

    <artifactId>stash-rest</artifactId>
    <packaging>atlassian-plugin</packaging>
    <name>Atlassian Stash REST Plugin</name>
    <description>REST-ish endpoint for interacting with Stash</description>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.stash</groupId>
            <artifactId>stash-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash</groupId>
            <artifactId>stash-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-servlet</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-module</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-stash-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
        <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.sun.jersey.contribs</groupId>
                        <artifactId>maven-wadl-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate</id>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <phase>prepare-package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <wadlFile>${project.build.directory}/stash-rest.wadl</wadlFile>
                            <formatWadlFile>true</formatWadlFile>
                            <baseUri>http://example.com/rest/</baseUri>
                            <packagesResourceConfig>
                                <param>com.atlassian.stash.rest</param>
                            </packagesResourceConfig>
                            <wadlGenerators>
                                <wadlGeneratorDescription>
                                    <className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
                                    <properties>
                                        <property>
                                            <name>applicationDocsFile</name>
                                            <value>${project.build.outputDirectory}/application-doc.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                                <wadlGeneratorDescription>
                                    <className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport</className>
                                    <properties>
                                        <property>
                                            <name>grammarsFile</name>
                                            <value>${project.build.outputDirectory}/application-grammars.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                                <wadlGeneratorDescription>
                                    <className>
                                        com.atlassian.plugins.rest.doclet.generators.resourcedoc.AtlassianWadlGeneratorResourceDocSupport
                                    </className>
                                    <properties>
                                        <property>
                                            <name>resourceDocFile</name>
                                            <value>${project.build.outputDirectory}/resourcedoc.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                            </wadlGenerators>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>exec-xsltproc</id>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <executable>xsltproc</executable>
                                    <commandlineArgs>-o ${project.build.directory}/stash-rest.html ${project.basedir}/src/main/doc/wadl-documentation.xsl ${project.build.directory}/stash-rest.wadl</commandlineArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
