<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jruby</groupId>
    <artifactId>jruby-parent</artifactId>
    <version>9.1.2.0</version>
  </parent>
  <artifactId>jruby-truffle</artifactId>
  <name>JRuby Truffle</name>
  <properties>
    <maven.test.skip>true</maven.test.skip>
    <jruby.basedir>${basedir}/..</jruby.basedir>
    <polyglot.dump.readonly>true</polyglot.dump.readonly>
    <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
    <truffle.version>0.13</truffle.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.14</version>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4-runtime</artifactId>
      <version>4.5.1-1</version>
    </dependency>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.oracle.truffle</groupId>
      <artifactId>truffle-api</artifactId>
      <version>${truffle.version}</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.truffle</groupId>
      <artifactId>truffle-debug</artifactId>
      <version>${truffle.version}</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.truffle</groupId>
      <artifactId>truffle-dsl-processor</artifactId>
      <version>${truffle.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.oracle.truffle</groupId>
      <artifactId>truffle-tck</artifactId>
      <version>${truffle.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <defaultGoal>package</defaultGoal>
    <resources>
      <resource>
        <targetPath>${project.build.directory}/classes/jruby-truffle</targetPath>
        <directory>src/main/ruby</directory>
        <includes>
          <include>**/*rb</include>
        </includes>
      </resource>
      <resource>
        <targetPath>${project.build.outputDirectory}/META-INF/</targetPath>
        <directory>${project.basedir}/..</directory>
        <includes>
          <include>BSDL</include>
          <include>COPYING</include>
          <include>LEGAL</include>
          <include>LICENSE.RUBY</include>
        </includes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-maven-plugin</artifactId>
        <version>4.5.1-1</version>
        <executions>
          <execution>
            <goals>
              <goal>antlr4</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <fork>true</fork>
              <annotationProcessors>
                <annotationProcessor>com.oracle.truffle.object.dsl.processor.LayoutProcessor</annotationProcessor>
                <annotationProcessor>com.oracle.truffle.dsl.processor.InstrumentableProcessor</annotationProcessor>
                <annotationProcessor>com.oracle.truffle.dsl.processor.TruffleProcessor</annotationProcessor>
                <annotationProcessor>com.oracle.truffle.dsl.processor.interop.InteropDSLProcessor</annotationProcessor>
                <annotationProcessor>com.oracle.truffle.dsl.processor.verify.VerifyTruffleProcessor</annotationProcessor>
                <annotationProcessor>com.oracle.truffle.dsl.processor.LanguageRegistrationProcessor</annotationProcessor>
              </annotationProcessors>
              <generatedSourcesDirectory>target/generated-sources</generatedSourcesDirectory>
              <compilerArgs>
                <compilerArg>-XDignore.symbol.file=true</compilerArg>
                <compilerArg>-J-Duser.language=en</compilerArg>
                <compilerArg>-J-Dfile.encoding=UTF-8</compilerArg>
                <compilerArg>-J-ea</compilerArg>
              </compilerArgs>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <encoding>utf-8</encoding>
          <debug>true</debug>
          <verbose>false</verbose>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
          <source>1.8</source>
          <target>1.8</target>
          <useIncrementalCompilation>false</useIncrementalCompilation>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>create lib/jruby-truffle.jar</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <outputFile>${jruby.basedir}/lib/jruby-truffle.jar</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <jruby.home>${basedir}/..</jruby.home>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>dist</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
              <execution>
                <id>pack jruby-truffle-complete.jar</id>
                <phase>verify</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <artifactSet>
                    <includes>
                      <include>com.oracle:truffle</include>
                      <include>com.oracle:truffle-interop</include>
                    </includes>
                  </artifactSet>
                  <outputFile>${project.build.directory}/jruby-truffle-${project.version}-complete.jar</outputFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jruby-jars</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
              <execution>
                <id>pack jruby-truffle-complete.jar</id>
                <phase>verify</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <artifactSet>
                    <includes>
                      <include>com.oracle:truffle</include>
                      <include>com.oracle:truffle-interop</include>
                    </includes>
                  </artifactSet>
                  <outputFile>${project.build.directory}/jruby-truffle-${project.version}-complete.jar</outputFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>all</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
              <execution>
                <id>pack jruby-truffle-complete.jar</id>
                <phase>verify</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <artifactSet>
                    <includes>
                      <include>com.oracle:truffle</include>
                      <include>com.oracle:truffle-interop</include>
                    </includes>
                  </artifactSet>
                  <outputFile>${project.build.directory}/jruby-truffle-${project.version}-complete.jar</outputFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
              <execution>
                <id>pack jruby-truffle-complete.jar</id>
                <phase>verify</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <artifactSet>
                    <includes>
                      <include>com.oracle:truffle</include>
                      <include>com.oracle:truffle-interop</include>
                    </includes>
                  </artifactSet>
                  <outputFile>${project.build.directory}/jruby-truffle-${project.version}-complete.jar</outputFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>test</id>
      <properties>
        <maven.test.skip>false</maven.test.skip>
      </properties>
    </profile>
  </profiles>
</project>
