<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.soy</groupId>
        <artifactId>soy-templates-parent</artifactId>
        <version>5.0.1</version>
    </parent>

    <artifactId>soy-template-plugin</artifactId>

    <name>Atlassian Soy - Plugin</name>

    <packaging>atlassian-plugin</packaging>

    <properties>
        <atlassian.plugin.key>com.atlassian.soy.soy-template-plugin</atlassian.plugin.key>
    </properties>

    <build>
        <plugins>
            <!-- SOY-1 Moving the soy util javascript into our folders so we can minify it-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.google.template.soy</groupId>
                                    <artifactId>soycompiler</artifactId>
                                    <version>${soy.libversion}</version>
                                    <type>jar</type>
                                    <outputDirectory>${project.basedir}/src/main/resources/</outputDirectory>
                                    <includes>**/soyutils.js</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <echo>
                                    Replacing first occurrence of /* with /*! in soyutils.js so we don't minify the
                                    license
                                </echo>
                                <replaceregexp file="${project.basedir}/src/main/resources/js/soyutils.js" match="/\*" replace="/*!">
                                </replaceregexp>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <!-- Extracting dependencies prevents com.atlassian.soy.renderer from being imported and exported -->
                    <extractDependencies>false</extractDependencies>
                    <instructions>
                        <Bundle-SymbolicName>${atlassian.plugin.key}</Bundle-SymbolicName>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Private-Package>
                            com.atlassian.soy.impl*,
                            com.google.template.soy*,
                            <!-- Must be Private-Package for soy to work correctly -->
                            javax.annotation*
                        </Private-Package>
                        <Export-Package>
                            com.atlassian.soy.renderer,
                        </Export-Package>
                        <Import-Package>
                            !com.google.inject.internal.asm.util,
                            !javax.annotation*,
                            javax.inject,
                            org.aopalliance*,
                            com.atlassian.soy.renderer,
                            javax.servlet*,
                            com.atlassian.sal.api*;version="${sal.osgi.version}",
                            com.atlassian.plugin.webresource*;version="${plugins.webresources.osgi.version}",
                            com.atlassian.webresource*;version="${plugins.webresources.osgi.version}",
                            com.atlassian.plugin*;version="${plugins.osgi.version}",
                            com.atlassian.plugin.osgi.external;version="${plugins.osgi.version}",
                            com.atlassian.plugin.osgi.bridge.external;version="${plugins.osgi.version}",
                            com.google.common.*,
                            io.atlassian.fugue*,
                            io.atlassian.util.concurrent;version="${atlassian.concurrent.osgi.version}",
                            org.slf4j;version="${slf4j.osgi.version}",
                            org.apache.commons.lang3;version="${commons.lang.osgi.version}",
                            org.apache.commons.logging,
                            org.xml.sax;version="0.0.0",
                            org.xml.sax.helpers;version="0.0.0",
                            org.dom4j*;version="0.0.0"
                        </Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-compile-scope-dependencies</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>*:*:*:*:compile</exclude>
                                        <exclude>*:*:*:*:runtime</exclude>
                                    </excludes>
                                    <includes>
                                        <!-- API and Core is allowed -->
                                        <include>com.atlassian.soy:soy-template-renderer-api</include>
                                        <include>com.atlassian.soy:soy-template-renderer-plugin-api</include>
                                        <include>com.atlassian.soy:atlassian-soy-core</include>
                                        <!-- The Soy compiler -->
                                        <include>com.google.template.soy:soycompiler</include>
                                        <!-- Guice which is required by the Soy compiler -->
                                        <include>org.sonatype.sisu:sisu-guice</include>
                                        <include>org.sonatype.sisu.inject:guice-assistedinject</include>
                                        <include>org.sonatype.sisu.inject:guice-multibindings</include>
                                        <!-- Other Soy compiler's dependencies not provided by the plugin framework -->
                                        <include>com.ibm.icu:icu4j</include>
                                        <include>aopalliance:aopalliance</include>
                                        <include>javax.inject:javax.inject</include>
                                        <include>com.google.code.findbugs:jsr305</include>
                                    </includes>
                                    <message>Only dependencies explicitly included can be compile/runtime scope</message>
                                    <searchTransitive>true</searchTransitive>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-plugin-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>atlassian-soy-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-bridge</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-common</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</groupId>
            <artifactId>atlassian-plugins-webfragment</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <!-- This must be compile scope for soy to work correctly -->
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.template.soy</groupId>
            <artifactId>soycompiler</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.sonatype.sisu</groupId>
            <artifactId>sisu-guice</artifactId>
        </dependency>
        <dependency>
            <groupId>org.sonatype.sisu.inject</groupId>
            <artifactId>guice-multibindings</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

