<?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>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <packaging>jar</packaging>
  <groupId>org.webjars</groupId>
  <artifactId>bpmn-js</artifactId>
  <version>0.13.1</version>
  <name>bpmn-js</name>
  <description>A webjar for bpmn-js</description>
  <url>http://bpmn.io</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <upstream.version>0.12.1</upstream.version>
    <upstream.archiveName>bower-bpmn-js-${upstream.version}</upstream.archiveName>
    <upstream.baseUrl>https://github.com/bpmn-io/bower-bpmn-js</upstream.baseUrl>
    <upstream.archiveUrl>${upstream.baseUrl}/archive/v${upstream.version}.tar.gz</upstream.archiveUrl>

    <webjar.base>${project.build.outputDirectory}/META-INF/resources/webjars</webjar.base>
    <webjar.dest>${webjar.base}/${project.artifactId}/${project.version}</webjar.dest>
    <requirejs>
        {
           "paths": {
               "bpmn-viewer": "bpmn-viewer"
           },
           "shim": {
               "bpmn-viewer": ["jquery", "jquery-mousewheel", "lodash", "sax", "snap-svg"]
           }
        }
    </requirejs>
  </properties>

  <developers>
    <developer>
      <id>Nikku</id>
      <name>Nico Rehwaldt</name>
    </developer>
    <developer>
      <id>Daniel</id>
      <name>Daniel Klotz</name>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>bpmn-js License</name>
      <url>http://bpmn.io/license</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <url>http://github.com/webjars/bpmn-js</url>
    <connection>scm:git:https://github.com/webjars/bpmn-js.git</connection>
    <developerConnection>scm:git:https://github.com/webjars/bpmn-js.git</developerConnection>
    <tag>bpmn-js-0.13.1</tag>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>lodash</artifactId>
      <version>2.4.1-6</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>sax</artifactId>
      <version>0.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>Snap.svg</artifactId>
      <version>0.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery-mousewheel</artifactId>
      <version>3.1.11</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>hammerjs</artifactId>
      <version>2.0.3</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals><goal>run</goal></goals>
            <configuration>
              <target>
                <echo message="download pre-packaged distribution" />
                <get src="${upstream.archiveUrl}" dest="${project.build.directory}" />

                <echo message="extract archive" />
                <untar src="${project.build.directory}/v${upstream.version}.tar.gz" dest="${project.build.directory}/${upstream.version}" compression="gzip">

                  <patternset>
                    <exclude name="${upstream.archiveName}/test/" />
                  </patternset>
                </untar>

                <echo message="moving resources" />
                <copy todir="${webjar.dest}">
                  <fileset dir="${project.build.directory}/${upstream.version}/${upstream.archiveName}/dist" />
                </copy>
              </target>

            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.1</version>
      </plugin>

      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.5</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>sonatype-nexus-staging</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
