<?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>

  <groupId>com.atlassian.bamboo</groupId>
  <artifactId>karma-bamboo</artifactId>
  <packaging>pom</packaging>
  <version>0.0.10</version>

  <name>Karma Bamboo Plugin</name>
  <organization>
    <name>Atlassian</name>
    <url>http://www.atlassian.com/</url>
  </organization>

  <scm>
    <connection>scm:git:git://bitbucket.org/atlassian/_pplewa/karma-bamboo.git</connection>
    <developerConnection>scm:git:ssh://git@bitbucket.org/_pplewa/karma-bamboo.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <profiles>
    <profile>
      <id>plugin</id>
      <activation>
        <property>
          <name>plugin</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>extract-js-dependencies</id>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.aui</groupId>
                      <artifactId>auiplugin</artifactId>
                      <version>${aui.version}</version>
                    </artifactItem>
                    <artifactItem>
                      <groupId>com.atlassian.bamboo</groupId>
                      <artifactId>atlassian-bamboo-web-app</artifactId>
                      <version>${bamboo.version}</version>
                      <type>war</type>
                    </artifactItem>
                    <artifactItem>
                      <groupId>com.atlassian.bamboo.plugins</groupId>
                      <artifactId>atlassian-bamboo-plugin-web-resources</artifactId>
                      <version>${bamboo.version}</version>
                    </artifactItem>
                  </artifactItems>
                  <includes>**/*.js,**/*.soy</includes>
                  <excludes>
                    **/WEB-INF/**,
                    **/related-deployment-list.soy,
                    **/deployment-result-details.soy,
                    **/related-deployment-list.soy,
                    **/view-deployment-result.soy,
                    **/configure-deployment-project.soy,
                    **/agent.soy,
                    **/time.soy,
                    **/*.min.js,
                    **/*-tests.js,
                    **/*-min.js
                  </excludes>
                  <outputDirectory>${project.build.directory}/js</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>core</id>
      <activation>
        <property>
          <name>core</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>extract-js-dependencies</id>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.aui</groupId>
                      <artifactId>auiplugin</artifactId>
                      <version>${aui.version}</version>
                    </artifactItem>
                  </artifactItems>
                  <includes>**/*.js,**/*.soy</includes>
                  <excludes>
                    **/WEB-INF/**,
                    **/*.min.js,
                    **/*-tests.js,
                    **/*-min.js
                  </excludes>
                  <outputDirectory>${project.build.directory}/js</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
            <executions>
              <execution>
                <id>copy-resources</id>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/js</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${bamboo.dir}</directory>
                      <filtering>false</filtering>
                      <includes>
                        <include>**/*.js</include>
                        <include>**/*.soy</include>
                      </includes>
                      <excludes>
                        <exclude>**/WEB-INF/**</exclude>
                        <exclude>**/related-deployment-list.soy</exclude>
                        <exclude>**/deployment-result-details.soy</exclude>
                        <exclude>**/related-deployment-list.soy</exclude>
                        <exclude>**/view-deployment-result.soy</exclude>
                        <exclude>**/configure-deployment-project.soy</exclude>
                        <exclude>**/agent.soy</exclude>
                        <exclude>**/time.soy</exclude>
                        <exclude>**/*.min.js</exclude>
                        <exclude>**/*-tests.js</exclude>
                        <exclude>**/*-min.js</exclude>
                        <exclude>**/target/**</exclude>
                      </excludes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>
  </profiles>

</project>