<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>2.7.0</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>
        <!-- remove this when all products are at guava 11 -->
        <guava.osgi.version>10.0.1</guava.osgi.version>
    </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.version}</version>
                                    <type>jar</type>
                                    <outputDirectory>${project.basedir}/src/main/resources/</outputDirectory>
                                    <includes>**/soyutils.js</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <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>maven-amps-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>
                        <!-- we need to export enough of Soy for other plugins to be able to write custom functions -->
                        <Export-Package>com.atlassian.soy.renderer,
                            <!-- TODO TEMPORARY Needed because it gets wrongly exported -->
                            com.atlassian.soy.impl,
                            org.apache.commons.beanutils;version="${beanutils.version}",
                            com.google.template.soy.shared,
                            com.google.template.soy.shared.restricted,
                            com.google.template.soy.data,
                            com.google.template.soy.data.restricted,
                            com.google.template.soy.tofu,
                            com.google.template.soy.tofu.restricted,
                            com.google.template.soy.jssrc,
                            com.google.template.soy.jssrc.restricted,
                            com.google.template.soy.base,
                            com.google.template.soy.internal.base,
                        </Export-Package>
                        <Import-Package>
                            !com.google.inject.internal.asm.util,
                            javax.inject,
                            org.aopalliance*,
                            com.atlassian.soy.renderer,
                            javax.servlet*,
                            com.atlassian.sal.api*;version="${sal.version}",
                            com.atlassian.plugin*;version="${plugins.osgi.version}",
                            com.atlassian.plugin.webresource*;version="${plugins.webresources.osgi.version}",
                            com.atlassian.plugin.osgi.external;version="${plugins.osgi.version}",
                            com.atlassian.plugin.osgi.bridge.external;version="${plugins.osgi.version}",
                            com.atlassian.util.concurrent;version="${atlassian.concurrent.version}",
                            com.google.common.*;version="${guava.osgi.version}",
                            org.slf4j;version="${slf4j.version}",
                            org.apache.commons.beanutils;version="${beanutils.version}",
                            org.apache.commons.lang;version="[2.0,3.0)",
                            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>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>atlassian-soy-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </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</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</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>

