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

  <parent>
    <groupId>org.torquebox</groupId>
    <artifactId>torquebox-build</artifactId>
    <version>2.1.2.redhat.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>org.torquebox</groupId>
  <artifactId>torquebox-dist</artifactId>
  <packaging>pom</packaging>
  <name>TorqueBox Build Distribution</name>
  <description />

  <profiles>
    <profile>
      <id>integ</id>
      <dependencies>
        <dependency>
          <groupId>org.torquebox</groupId>
          <artifactId>torquebox-integration-tests</artifactId>
          <version>${project.version}</version>
          <type>pom</type>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>


  <dependencies>
    <dependency>
      <groupId>org.torquebox</groupId>
      <artifactId>torquebox-build-assembly</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>dist-bin</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal> 
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/dist-bin.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
          <execution>
            <id>dist-modules</id>
            <phase>package</phase> 
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/dist-modules.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
          <execution>
            <id>dist-rubygem-repo</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/dist-rubygem-repo.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
          <execution>
            <id>dist-eap-overlay</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/dist-eap-overlay.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
          <execution>
            <id>dist-src</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/dist-src.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>          
        </executions>
      </plugin>
      <plugin>
        <groupId>de.saumya.mojo</groupId>
        <artifactId>jruby-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>install-json</id>
            <phase>package</phase>
            <goals>
              <goal>jruby</goal>
            </goals>
            <configuration>
              <args>-S gem install json_pure --no-ri --no-rdoc</args>
              <gemHome>./target/rubygems</gemHome>
              <gemPath>./target/rubygems</gemPath>
            </configuration>
          </execution>
          <execution>
            <id>generate-build-metadata</id>
            <phase>package</phase>
            <goals>
              <goal>jruby</goal>
            </goals>
            <configuration>
              <file>bin/generate_build_metadata.rb</file>
            </configuration>
          </execution>
          <execution>
            <id>generate-sha1</id>
            <phase>package</phase>
            <goals>
              <goal>jruby</goal>
            </goals>
            <configuration>
              <file>bin/generate_sha1.rb</file>
              <args>target/*.{zip,json}</args>
              <jrubyJvmArgs>-Xmx1024m</jrubyJvmArgs>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
