<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jruby</groupId>
    <artifactId>jruby-artifacts</artifactId>
    <version>1.7.18.redhat-001</version>
  </parent>
  <artifactId>jruby-dist</artifactId>
  <packaging>pom</packaging>
  <name>JRuby Dist</name>
  <properties>
    <jruby.home>${basedir}/../..</jruby.home>
    <tesla.dump.readOnly>true</tesla.dump.readOnly>
    <jruby.plugins.version>1.0.3</jruby.plugins.version>
    <main.basedir>${project.parent.parent.basedir}</main.basedir>
    <tesla.dump.pom>pom.xml</tesla.dump.pom>
    <tesla.version>0.1.1</tesla.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>rubygems</groupId>
      <artifactId>ruby-maven</artifactId>
      <version>3.1.1.0.8</version>
      <type>gem</type>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>de.saumya.mojo</groupId>
        <artifactId>gem-maven-plugin</artifactId>
        <version>${jruby.plugins.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>initialize</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack jruby-stdlib</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <stripVersion>true</stripVersion>
              <artifactItems>
                <artifactItem>
                  <groupId>org.jruby</groupId>
                  <artifactId>jruby-stdlib</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <finalName>jruby-dist-1.7.18</finalName>
          <tarLongFileMode>gnu</tarLongFileMode>
          <descriptors>
            <descriptor>src/main/assembly/jruby.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>io.tesla.polyglot</groupId>
        <artifactId>tesla-polyglot-maven-plugin</artifactId>
        <version>${tesla.version}</version>
        <executions>
          <execution>
            <id>fix_executable_bits</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <taskId>fix_executable_bits</taskId>
              <nativePom>pom.rb</nativePom>
            </configuration>
          </execution>
          <execution>
            <id>fix_permissions</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <taskId>fix_permissions</taskId>
              <nativePom>pom.rb</nativePom>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>io.tesla.polyglot</groupId>
            <artifactId>tesla-polyglot-ruby</artifactId>
            <version>${tesla.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>gem proxy</id>
      <activation>
        <file>
          <exists>../jruby</exists>
        </file>
      </activation>
    </profile>
    <profile>
      <id>source dist</id>
      <activation>
        <file>
          <exists>../../.git</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>io.tesla.polyglot</groupId>
            <artifactId>tesla-polyglot-maven-plugin</artifactId>
            <version>${tesla.version}</version>
            <executions>
              <execution>
                <id>pack_sources</id>
                <phase>package</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <taskId>pack_sources</taskId>
                  <nativePom>pom.rb</nativePom>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>io.tesla.polyglot</groupId>
                <artifactId>tesla-polyglot-ruby</artifactId>
                <version>${tesla.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
