<?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.mule.extensions</groupId>
        <artifactId>mule-core-modules-parent</artifactId>
        <version>1.2.1</version>
    </parent>
    <groupId>org.mule.modules</groupId>
    <artifactId>mule-scripting-module</artifactId>
    <packaging>mule-extension</packaging>
    <version>2.1.0</version>
    <name>Scripting Module</name>
    <description>Support for embedding scripts inside Mule artifacts</description>
    <properties>
        <munit.extensions.maven.plugin.version>1.2.0-rc2</munit.extensions.maven.plugin.version>
        <munit.version>3.1.0-rc3</munit.version>
        <formatterConfigPath>formatter.xml</formatterConfigPath>
        <jython.version>2.7.3</jython.version>
        <groovy.version>3.0.19</groovy.version>
        <jruby.version>9.3.8.0</jruby.version>
        <graal.version>22.0.0</graal.version>
        <project.reactor.version>3.4.23</project.reactor.version>
        <commons.lang.version>3.13.0</commons.lang.version>
        <file.connector.version>1.5.2</file.connector.version>
        <mtf.tools.version>1.2.0-rc1</mtf.tools.version>
        <jacoco.version>0.8.10</jacoco.version>
        <mtf.javaopts></mtf.javaopts>
        <mulesoftLicenseVersion>1.4.0</mulesoftLicenseVersion>
        <license.maven.plugin.version>4.2</license.maven.plugin.version>
        <licensePath>LICENSE_HEADER_CPAL.txt</licensePath>
        <licenseYear>2023</licenseYear>
        <mule.sdk.api.version>0.7.0</mule.sdk.api.version>
    </properties>
    <dependencies>
        <!-- Reactor -->
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>${project.reactor.version}</version>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>org.mule.tests.plugin</groupId>
            <artifactId>mule-tests-component-plugin</artifactId>
            <version>${mule.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-model</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <!--Groovy-->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-jsr223</artifactId>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <!--Jython-->
        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython-standalone</artifactId>
            <version>${jython.version}</version>
            <scope>test</scope>
        </dependency>
        <!--Ruby-->
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-core</artifactId>
            <version>${jruby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-stdlib</artifactId>
            <version>${jruby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-file-connector</artifactId>
            <version>${file.connector.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.sdk</groupId>
            <artifactId>mule-sdk-api</artifactId>
            <version>${mule.sdk.api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>${graal.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>${graal.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license.maven.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.mulesoft.license</groupId>
                        <artifactId>license</artifactId>
                        <version>${mulesoftLicenseVersion}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <header>${licensePath}</header>
                    <properties>
                        <year>${licenseYear}</year>
                    </properties>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <jruby.version>${jruby.version}</jruby.version>
                        <jython.version>${jython.version}</jython.version>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit</groupId>
                <artifactId>munit-extensions-maven-plugin</artifactId>
                <version>${munit.extensions.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <runtimeConfiguration>
                        <discoverRuntimes>
                            <minMuleVersion>${minVersion}</minMuleVersion>
                            <includeSnapshots>false</includeSnapshots>
                            <product>EE</product>
                        </discoverRuntimes>
                    </runtimeConfiguration>
                    <sharedLibraries>
                        <sharedLibrary>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-jsr223</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.python</groupId>
                            <artifactId>jython-standalone</artifactId>
                        </sharedLibrary>
                        <sharedLibrary>
                            <groupId>org.jruby</groupId>
                            <artifactId>jruby-core</artifactId>
                        </sharedLibrary>
                    </sharedLibraries>
                    <argLines>
                        <argLine>
                            -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${session.executionRootDirectory}/target/jacoco-munit.exec
                        </argLine>
                    </argLines>
                    <environmentVariables>
                        <!-- Toggles the JDK17 style flag -->
                        <!-- ugly hack -->
                        <_JAVA_OPTIONS>-XX:+PrintCommandLineFlags ${mtf.javaopts}</_JAVA_OPTIONS>
                    </environmentVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>munit-runner</artifactId>
                        <version>${munit.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>munit-tools</artifactId>
                        <version>${munit.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>com.mulesoft.munit</groupId>
                        <artifactId>mtf-tools</artifactId>
                        <version>${mtf.tools.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jdeps-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>jdkinternals</goal> <!-- verify main classes -->
                            <goal>test-jdkinternals</goal> <!-- verify test classes -->
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnWarning>true</failOnWarning>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
