<?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.pom</groupId>
    <artifactId>closedsource-pom</artifactId>
    <version>5.0.7</version>
  </parent>

  <groupId>com.atlassian.jira.plugins</groupId>
  <artifactId>jira-ui</artifactId>
  <version>0.3.0</version>
  <organization>
    <name>Atlassian</name>
    <url>https://www.atlassian.com</url>
  </organization>

  <name>jira-ui</name>
  <description>JiraUI wraps AUI to deliver outstanding and consistent UX for Jira</description>
  <packaging>atlassian-plugin</packaging>

  <scm>
    <connection>scm:git:ssh://git@bitbucket.org/atlassian/jiraui.git</connection>
    <developerConnection>scm:git:ssh://git@bitbucket.org/atlassian/jiraui.git</developerConnection>
    <url>https://bitbucket.org/atlassian/jiraui/</url>
    <tag>jira-ui-0.3.0</tag>
  </scm>

  <dependencies>
    <!-- provided -->
    <dependency>
      <groupId>com.atlassian.sal</groupId>
      <artifactId>sal-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- test -->
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.8.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.atlassian.platform</groupId>
        <artifactId>platform</artifactId>
        <version>${platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.atlassian.platform</groupId>
        <artifactId>third-party</artifactId>
        <version>${platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-amps-plugin</artifactId>
        <version>${amps.version}</version>
        <extensions>true</extensions>
        <configuration>
          <product>jira</product>
          <productVersion>${jira.version}</productVersion>
          <enableQuickReload>true</enableQuickReload>
          <enableFastdev>false</enableFastdev>
          <compressResources>false</compressResources>
          <!-- See here for an explanation of default instructions: -->
          <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
          <instructions>
            <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
            <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
            <!-- Add package to export here -->
            <Export-Package />
            <!-- Add package import here -->
            <!-- Ensure plugin is spring powered -->
            <Spring-Context>*</Spring-Context>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <forceCreation>true</forceCreation>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.6.1</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M1</version>
        <executions>
          <execution>
            <id>enforce-files-exist</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.2.5,4.0.0)</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[1.8,)</version>
                </requireJavaVersion>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>${frontend.maven.plugin.version}</version>
        <configuration>
          <installDirectory>${basedir}/target</installDirectory>
          <workingDirectory>${basedir}/</workingDirectory>
          <nodeVersion>${node.version}</nodeVersion>
          <yarnVersion>${yarn.version}</yarnVersion>
        </configuration>
        <executions>
          <execution>
            <id>install-node-and-yarn</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>install-node-and-yarn</goal>
            </goals>
          </execution>

          <execution>
            <id>install-bolt</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>global add bolt@${bolt.version}</arguments>
            </configuration>
            <phase>generate-resources</phase>
          </execution>
          <execution>
            <id>install-frontend-dependencies</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>bolt</arguments>
            </configuration>
            <phase>generate-resources</phase>
          </execution>

          <execution>
            <id>build-frontend-for-p2</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>build:p2:webpack</arguments>
            </configuration>
            <phase>process-resources</phase>
          </execution>

          <execution>
            <id>frontend-lint</id>
            <phase>test</phase>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>lint</arguments>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
          <execution>
            <id>frontend-typecheck</id>
            <phase>test</phase>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>typecheck</arguments>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
          <execution>
            <id>frontend-test</id>
            <phase>test</phase>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>test</arguments>
              <skip>${skipTests}</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <properties>
    <jira.version>7.9.0-QR-20180301091234</jira.version>

    <amps.version>6.3.15</amps.version>
    <platform.version>3.0.0</platform.version>

    <frontend.maven.plugin.version>1.6</frontend.maven.plugin.version>
    <node.version>v8.10.0</node.version>
    <yarn.version>v1.5.1</yarn.version>
    <bolt.version>^0.20.0</bolt.version>

    <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
    <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
  </properties>

</project>
