<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-build-assembly</artifactId>
  <packaging>pom</packaging>
  <name>TorqueBox Build Assembly</name>

  <properties>
    <assembly.args>--jruby</assembly.args>
  </properties>


  <dependencies>
    <dependency>
      <groupId>org.jboss.as</groupId>
      <artifactId>jboss-as-dist</artifactId>
      <version>${version.jbossas}</version>
      <type>zip</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-dist</artifactId>
      <classifier>bin</classifier>
      <type>zip</type>
      <version>${version.jruby}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectodd.stilts</groupId>
      <artifactId>stilts-stomp-client-js</artifactId>
      <type>js</type>
      <version>${version.org.projectodd.stilts}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>rubygems</groupId>
      <artifactId>builder</artifactId>
      <version>3.0.0</version>
      <type>gem</type>
      <scope>compile</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>de.saumya.mojo</groupId>
            <artifactId>jruby-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>adjust-rails-template</id>
                <phase>package</phase>
                <goals>
                  <goal>jruby</goal>
                </goals>
                <configuration>
                  <file>bin/adjust-rails-template.rb</file>
                  <args>${project.version} ${env.BUILD_NUMBER}</args>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>wfk</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <assembly.args>--no-jruby --no-unzip</assembly.args>
      </properties>
    </profile>
    <profile>
      <id>wfk-test</id>
      <activation>
        <property>
          <name>wfk</name>
          <value>test</value>
        </property>
      </activation>
      <properties>
        <assembly.args />
      </properties>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>de.saumya.mojo</groupId>
        <artifactId>gem-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>install-builder</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>initialize</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>de.saumya.mojo</groupId>
        <artifactId>jruby-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>perform-assembly</id>
            <inherited>true</inherited>
            <phase>package</phase>
            <goals>
              <goal>jruby</goal>
            </goals>
            <configuration>
              <file>bin/assemble.rb</file>
              <jrubyArgs>
                -m ${settings.localRepository} 
                ${assembly.args}
              </jrubyArgs>
              <jrubyJvmArgs>
                -Dversion.torquebox=${project.version}
                -Dversion.jbossas=${version.jbossas}
                -Dversion.jruby=${version.jruby}
                -Dversion.polyglot=${version.polyglot}
                -Dversion.stilts=${version.org.projectodd.stilts}
              </jrubyJvmArgs>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
