<project name="module-repository" basedir="." default="all">

    <import file="lib.xml"/>

    <property name="output.dir" value="target"/>

    <target name="all">
        <delete dir="target/mavenized"/>
        <antcall target="modules">
            <!-- TODO add OSGI later when we can have maven repo references to those jars -->
            <param name="mavenized.modules" value="true"/>
            <param name="output.dir" value="target/mavenized"/>
        </antcall>
        <antcall target="modules">
            <param name="mavenized.modules" value="false"/>
            <param name="output.dir" value="target"/>
        </antcall>
    </target>


    <target name="modules">
        <!--
          ~ Complete list of modules to assemble.
          ~
          ~ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
          ~ +++++++   KEEP THIS LIST ALPHABETICAL BY MODULE NAME!   +++++++
          ~ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
          -->

        <module-def name="org.reactivestreams">
            <maven-resource group="org.reactivestreams" artifact="reactive-streams"/>
        </module-def>

        <module-def name="com.ibm.async.asyncutil">
            <maven-resource group="com.ibm.async" artifact="asyncutil"/>
        </module-def>

        <module-def name="org.eclipse.microprofile.restclient">
            <maven-resource group="org.eclipse.microprofile.rest.client" artifact="microprofile-rest-client-api"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.core.jackson-core">
            <maven-resource group="com.fasterxml.jackson.core" artifact="jackson-core"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.core.jackson-databind">
            <maven-resource group="com.fasterxml.jackson.core" artifact="jackson-databind"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.core.jackson-annotations">
            <maven-resource group="com.fasterxml.jackson.core" artifact="jackson-annotations"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.datatype.jackson-datatype-jdk8">
            <maven-resource group="com.fasterxml.jackson.datatype" artifact="jackson-datatype-jdk8"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.datatype.jackson-datatype-jsr310">
            <maven-resource group="com.fasterxml.jackson.datatype" artifact="jackson-datatype-jsr310"/>
        </module-def>

        <module-def name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider">
            <maven-resource group="com.fasterxml.jackson.jaxrs" artifact="jackson-jaxrs-json-provider"/>
            <maven-resource group="com.fasterxml.jackson.jaxrs" artifact="jackson-jaxrs-base"/>
            <maven-resource group="com.fasterxml.jackson.module" artifact="jackson-module-jaxb-annotations" />
        </module-def>

        <module-def name="com.google.guava.failureaccess">
            <maven-resource group="com.google.guava" artifact="failureaccess"/>
        </module-def>

        <module-def name="com.google.guava">
            <maven-resource group="com.google.guava" artifact="guava"/>
        </module-def>

        <!-- todo this is temporary and should be removed when wildfly makes the needed update
             -->
        <module-def name="org.apache.james.mime4j">
            <maven-resource group="org.apache.james" artifact="apache-mime4j-core"/>
            <maven-resource group="org.apache.james" artifact="apache-mime4j-dom"/>
            <maven-resource group="org.apache.james" artifact="apache-mime4j-storage"/>
        </module-def>

        <!-- already present in wildfly -->
        <module-def name="javax.ws.rs.api">
            <maven-resource group="org.jboss.spec.javax.ws.rs" artifact="jboss-jaxrs-api_2.1_spec"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-atom-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-atom-provider"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-cdi">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-cdi"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-crypto">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-crypto"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-jackson2-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-jackson2-provider"/>
        </module-def>
    	
        <module-def name="org.jboss.resteasy.resteasy-context-propagation">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-context-propagation"/>
            <maven-resource group="io.smallrye" artifact="smallrye-context-propagation"/>
            <maven-resource group="io.smallrye" artifact="smallrye-context-propagation-api"/>
            <maven-resource group="io.smallrye" artifact="smallrye-context-propagation-storage"/>
            <maven-resource group="jakarta.enterprise" artifact="jakarta.enterprise.cdi-api"/>
            <maven-resource group="org.eclipse.microprofile.context-propagation" artifact="microprofile-context-propagation-api"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-rxjava2">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-rxjava2"/>
         	<maven-resource group="io.reactivex.rxjava2" artifact="rxjava"/>
            <maven-resource group="io.smallrye" artifact="smallrye-context-propagation-propagators-rxjava2"/>
        </module-def>

        <module-def name="com.github.fge.btf">
            <maven-resource group="com.github.java-json-tools" artifact="btf"/>
        </module-def>

        <module-def name="com.github.fge.msg-simple">
            <maven-resource group="com.github.java-json-tools" artifact="msg-simple"/>
        </module-def>

        <module-def name="com.github.fge.jackson-coreutils">
            <maven-resource group="com.github.java-json-tools" artifact="jackson-coreutils"/>
        </module-def>

        <module-def name="com.github.fge.json-patch">
            <maven-resource group="com.github.java-json-tools" artifact="json-patch"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-jaxb-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-jaxb-provider"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-core-spi">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-core-spi"/>
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-tracing-api"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-core">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-core"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-client-api">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-client-api"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-client">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-client"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-client-microprofile">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-client-microprofile"/>
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-client-microprofile-base"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-jaxrs"/>

        <module-def name="org.jboss.resteasy.jose-jwt">
            <maven-resource group="org.jboss.resteasy" artifact="jose-jwt"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-jsapi">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-jsapi"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-json-p-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-json-p-provider"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-json-binding-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-json-binding-provider"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-multipart-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-multipart-provider"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-spring">
            <maven-resource-bundle group="org.jboss.resteasy" artifact="resteasy-spring" subdir="bundled/resteasy-spring-jar"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-spring-web">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-spring-web"/>
        </module-def>

        <module-def name="org.jboss.resteasy.resteasy-validator-provider">
            <maven-resource group="org.jboss.resteasy" artifact="resteasy-validator-provider"/>
        </module-def>

        <!-- no need to create zip file as maven-assembly-plugin running after antrun plugin takes care of that -->
        <!--
        <zip destfile="${output.dir}/zz-resteasy-jboss-modules-${project.version}.zip">
            <zipfileset dir="${output.dir}/modules"/>
        </zip>
        -->

    </target>

    <target name="clean-target">
        <delete dir="${output.dir}"/>
    </target>

    <target name="clean" depends="clean-target">
        <delete file="maven-ant-tasks.jar"/>
    </target>

</project>
