<?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.runtime</groupId>
        <artifactId>mule-modules</artifactId>
        <version>4.13.0</version>
    </parent>
    <artifactId>mule-module-extensions-support</artifactId>
    <name>Mule Extensions Support</name>
    <packaging>jar</packaging>
    <description>
        Default implementation of the Mule Extension API.
    </description>

    <properties>
        <javaModuleName>org.mule.runtime.extensions.support</javaModuleName>
        <!-- Required by mule-extension-ast-loader -->

        <surefire.args>
            -XX:+IgnoreUnrecognizedVMOptions
            --add-modules=net.bytebuddy.agent
            --add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader.enricher=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader.validator=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.property=org.mule.runtime.extensions.support
              --add-reads=org.mule.runtime.extensions.support=org.mule.runtime.ioc
              --add-reads=org.mule.runtime.extensions.support=com.google.gson
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.loader.validation=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.resources.documentation=jakarta.xml.bind
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.client=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.config=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.config=ALL-UNNAMED
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.connectivity=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.connectivity.oauth=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.connectivity.oauth.authcode=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.execution=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.execution.executor=ALL-UNNAMED
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.resolver=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.resolver=ALL-UNNAMED
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.source=org.mule.runtime.core
              --add-opens=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.runtime.operation=org.mule.runtime.core
            --add-exports=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.type.catalog=org.mule.runtime.core
            --add-exports=org.mule.runtime.extensions.support/org.mule.test.module.extension.internal.util.extension.privileged=org.mule.runtime.core
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.api.processor=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.config=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.context=ALL-UNNAMED
              --add-opens=org.mule.runtime.core.expression/org.mule.runtime.core.internal.el=ALL-UNNAMED
              --add-opens=org.mule.runtime.core.expression/org.mule.runtime.core.internal.el.dataweave=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.exception=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.interception=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.processor.strategy=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.profiling=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.registry=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.serialization=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.privileged.exception=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.privileged.processor=ALL-UNNAMED
              --add-opens=org.mule.runtime.core/org.mule.runtime.core.privileged.processor.chain=ALL-UNNAMED
              --add-opens=org.mule.runtime.errors/org.mule.runtime.config.internal.error=ALL-UNNAMED
            --add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.error=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.core/org.mule.runtime.core.internal.context=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.core.expression/org.mule.runtime.core.internal.el.dataweave=org.mule.runtime.extensions.support
            --add-exports=org.mule.runtime.extensions.support/org.mule.runtime.module.extension.internal.loader.java=ALL-UNNAMED
            --add-exports=org.mule.runtime.ioc/org.mule.runtime.config.internal.errors=org.mule.runtime.extensions.support
            ${surefire.test.unit.open.args}
        </surefire.args>

        <skipExportTests>false</skipExportTests>
    </properties>

    <dependencies>
        <!-- Mule Dependencies -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-xml-api</artifactId>
            <version>${muleAnnotationsApiVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api-dsql</artifactId>
            <version>${muleExtensionsApiVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api-persistence</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-expression</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-connectivity</artifactId>
            <version>${project.version}</version>
        </dependency>
        
        <!-- Allow this utils extract from mule-core to be used by Java extensions -->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-deprecated-utils</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-transformers</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-deployment-model</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.mule</groupId>
                    <artifactId>mule-maven-client-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-metadata-support</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-artifact-ast</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-service-oauth-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.commons</groupId>
            <artifactId>mule-oauth-client-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-service-http-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.sdk</groupId>
            <artifactId>mule-sdk-compatibility-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.sdk</groupId>
            <artifactId>mule-sdk-privileged-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-tracer-customization-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-tracer-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-tracer-internal-impl</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-spring-utils</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!--Other Dependencies-->
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
        </dependency>
        <!-- TODO W-19598658: replace for byte-buddy-dep (not just here but in the whole distribution) -->
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
        </dependency>

        <!--Test Dependencies-->
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-tests</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-runtime-extension-model</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api</artifactId>
            <version>${muleExtensionsApiVersion}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.services</groupId>
            <artifactId>mule-service-weave</artifactId>
            <classifier>mule-service</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-dwb-api</artifactId> 
            <scope>test</scope>             
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-unit</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j2-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-module-properties-config</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-properties-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.skyscreamer</groupId>
            <artifactId>jsonassert</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.testing.compile</groupId>
            <artifactId>compile-testing</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-allure</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Test Extensions dependencies -->
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-metadata-extension</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-vegan-extension</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-heisenberg-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-marvel-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-subtypes-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-petstore-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-values-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>provided-dependency</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-model</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-test-oauth-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>sdk-new-java-version-values-extension</artifactId>
            <version>${project.version}</version>
            <classifier>mule-plugin</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-sample-data-extension</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-core-expression</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.services</groupId>
            <artifactId>mule-service-weave</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <filtering>true</filtering>
                <directory>${basedir}/src/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <configuration>
                            <compilerArgs>
                                <arg>--add-exports=org.mule.runtime.metadata.support/org.mule.runtime.metadata.internal.cache=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader.enricher=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.loader.validator=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.extensions.api/org.mule.runtime.extension.internal.property=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.error=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.core/org.mule.runtime.core.internal.context=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.core.expression/org.mule.runtime.core.internal.el.dataweave=org.mule.runtime.extensions.support</arg>
                                <arg>--add-exports=org.mule.runtime.ioc/org.mule.runtime.config.internal.errors=org.mule.runtime.extensions.support</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>*</include>
                                <include>org/mule/runtime/module/extension/internal/resources/test/**</include>
                                <include>org/mule/runtime/module/extension/internal/loader/parser/java/test/**</include>
                                <include>org/mule/runtime/module/extension/internal/util/test/**</include>
                                <include>org/mule/test/**</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
