<?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>one.jpro.platform.jpms</groupId>
        <artifactId>jpms-parent</artifactId>
        <version>1.0.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>${core.artifact.artifactId}</artifactId>
    <packaging>jar</packaging>
    <version>${core.artifact.version}-${core.artifact.release}</version>

    <name>JPro Platform Eclipse Collections API JPMS Module</name>
    <description>A customized, modularized version of Eclipse Collections API, repackaged for the JPro platform with
        additional support for JPMS and enhanced artifact management.</description>

    <properties>
        <!-- Change release here-->
        <core.artifact.groupId>org.eclipse.collections</core.artifact.groupId>
        <core.artifact.artifactId>eclipse-collections-api</core.artifact.artifactId>
        <core.artifact.version>11.1.0</core.artifact.version>
    </properties>

    <licenses>
        <license>
            <name>Eclipse Public License - v 1.0</name>
            <url>https://www.eclipse.org/legal/epl-v10.html</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>Eclipse Distribution License - v 1.0</name>
            <url>https://www.eclipse.org/licenses/edl-v10.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <dependencies>
        <!-- This artifact has no transitive dependencies -->
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${basedir}/</directory>
                <includes>
                    <include>LICENSE-EDL.txt</include>
                    <include>LICENSE-EPL.txt</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sources</id>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${core.artifact.groupId}</groupId>
                                    <artifactId>${core.artifact.artifactId}</artifactId>
                                    <version>${core.artifact.version}</version>
                                    <classifier>sources</classifier>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${core.artifact.groupId}</groupId>
                                    <artifactId>${core.artifact.artifactId}</artifactId>
                                    <version>${core.artifact.version}</version>
                                    <classifier>javadoc</classifier>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-sources.jar</file>
                                    <type>jar</type>
                                    <classifier>sources</classifier>
                                </artifact>
                                <artifact>
                                    <file>${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-javadoc.jar</file>
                                    <type>jar</type>
                                    <classifier>javadoc</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/moditect</outputDirectory>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                            <modules>
                                <module>
                                    <artifact>
                                        <groupId>${core.artifact.groupId}</groupId>
                                        <artifactId>${core.artifact.artifactId}</artifactId>
                                        <version>${core.artifact.version}</version>
                                    </artifact>
                                    <moduleInfoSource>
                                        open module org.eclipse.collections.api {
                                            exports org.eclipse.collections.api;
                                            exports org.eclipse.collections.api.annotation;
                                            exports org.eclipse.collections.api.bag;
                                            exports org.eclipse.collections.api.bag.primitive;
                                            exports org.eclipse.collections.api.bag.sorted;
                                            exports org.eclipse.collections.api.bimap;
                                            exports org.eclipse.collections.api.block;
                                            exports org.eclipse.collections.api.block.comparator;
                                            exports org.eclipse.collections.api.block.comparator.primitive;
                                            exports org.eclipse.collections.api.block.factory;
                                            exports org.eclipse.collections.api.block.function;
                                            exports org.eclipse.collections.api.block.function.primitive;
                                            exports org.eclipse.collections.api.block.predicate;
                                            exports org.eclipse.collections.api.block.predicate.primitive;
                                            exports org.eclipse.collections.api.block.procedure;
                                            exports org.eclipse.collections.api.block.procedure.primitive;
                                            exports org.eclipse.collections.api.collection;
                                            exports org.eclipse.collections.api.collection.primitive;
                                            exports org.eclipse.collections.api.factory;
                                            exports org.eclipse.collections.api.factory.bag;
                                            exports org.eclipse.collections.api.factory.bag.primitive;
                                            exports org.eclipse.collections.api.factory.bag.sorted;
                                            exports org.eclipse.collections.api.factory.bag.strategy;
                                            exports org.eclipse.collections.api.factory.bimap;
                                            exports org.eclipse.collections.api.factory.list;
                                            exports org.eclipse.collections.api.factory.list.primitive;
                                            exports org.eclipse.collections.api.factory.map;
                                            exports org.eclipse.collections.api.factory.map.primitive;
                                            exports org.eclipse.collections.api.factory.map.sorted;
                                            exports org.eclipse.collections.api.factory.map.strategy;
                                            exports org.eclipse.collections.api.factory.primitive;
                                            exports org.eclipse.collections.api.factory.set;
                                            exports org.eclipse.collections.api.factory.set.primitive;
                                            exports org.eclipse.collections.api.factory.set.sorted;
                                            exports org.eclipse.collections.api.factory.set.strategy;
                                            exports org.eclipse.collections.api.factory.stack;
                                            exports org.eclipse.collections.api.factory.stack.primitive;
                                            exports org.eclipse.collections.api.iterator;
                                            exports org.eclipse.collections.api.list;
                                            exports org.eclipse.collections.api.list.primitive;
                                            exports org.eclipse.collections.api.map;
                                            exports org.eclipse.collections.api.map.primitive;
                                            exports org.eclipse.collections.api.map.sorted;
                                            exports org.eclipse.collections.api.multimap;
                                            exports org.eclipse.collections.api.multimap.bag;
                                            exports org.eclipse.collections.api.multimap.list;
                                            exports org.eclipse.collections.api.multimap.ordered;
                                            exports org.eclipse.collections.api.multimap.set;
                                            exports org.eclipse.collections.api.multimap.sortedbag;
                                            exports org.eclipse.collections.api.multimap.sortedset;
                                            exports org.eclipse.collections.api.ordered;
                                            exports org.eclipse.collections.api.ordered.primitive;
                                            exports org.eclipse.collections.api.partition;
                                            exports org.eclipse.collections.api.partition.bag;
                                            exports org.eclipse.collections.api.partition.bag.sorted;
                                            exports org.eclipse.collections.api.partition.list;
                                            exports org.eclipse.collections.api.partition.ordered;
                                            exports org.eclipse.collections.api.partition.set;
                                            exports org.eclipse.collections.api.partition.set.sorted;
                                            exports org.eclipse.collections.api.partition.stack;
                                            exports org.eclipse.collections.api.set;
                                            exports org.eclipse.collections.api.set.primitive;
                                            exports org.eclipse.collections.api.set.sorted;
                                            exports org.eclipse.collections.api.stack;
                                            exports org.eclipse.collections.api.stack.primitive;
                                            exports org.eclipse.collections.api.tuple;
                                            exports org.eclipse.collections.api.tuple.primitive;

                                            uses org.eclipse.collections.api.factory.bag.ImmutableBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.MultiReaderBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.MutableBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableBooleanBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableByteBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableCharBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableDoubleBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableFloatBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableIntBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableLongBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.ImmutableShortBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableBooleanBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableByteBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableCharBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableDoubleBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableFloatBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableIntBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableLongBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.primitive.MutableShortBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.sorted.ImmutableSortedBagFactory;
                                            uses org.eclipse.collections.api.factory.bag.sorted.MutableSortedBagFactory;
                                            uses org.eclipse.collections.api.factory.list.FixedSizeListFactory;
                                            uses org.eclipse.collections.api.factory.list.ImmutableListFactory;
                                            uses org.eclipse.collections.api.factory.list.MultiReaderListFactory;
                                            uses org.eclipse.collections.api.factory.list.MutableListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.ImmutableCharListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.ImmutableIntListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.ImmutableLongListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.MutableCharListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.MutableIntListFactory;
                                            uses org.eclipse.collections.api.factory.list.primitive.MutableLongListFactory;
                                            uses org.eclipse.collections.api.factory.map.FixedSizeMapFactory;
                                            uses org.eclipse.collections.api.factory.map.ImmutableMapFactory;
                                            uses org.eclipse.collections.api.factory.map.MutableMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.ImmutableIntIntMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.ImmutableIntObjectMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.ImmutableObjectDoubleMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.ImmutableObjectIntMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.ImmutableObjectLongMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.MutableIntIntMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.MutableIntObjectMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.MutableObjectDoubleMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.MutableObjectIntMapFactory;
                                            uses org.eclipse.collections.api.factory.map.primitive.MutableObjectLongMapFactory;
                                            uses org.eclipse.collections.api.factory.map.sorted.ImmutableSortedMapFactory;
                                            uses org.eclipse.collections.api.factory.map.sorted.MutableSortedMapFactory;
                                            uses org.eclipse.collections.api.factory.set.FixedSizeSetFactory;
                                            uses org.eclipse.collections.api.factory.set.ImmutableSetFactory;
                                            uses org.eclipse.collections.api.factory.set.MultiReaderSetFactory;
                                            uses org.eclipse.collections.api.factory.set.MutableSetFactory;
                                            uses org.eclipse.collections.api.factory.set.primitive.ImmutableIntSetFactory;
                                            uses org.eclipse.collections.api.factory.set.primitive.ImmutableLongSetFactory;
                                            uses org.eclipse.collections.api.factory.set.primitive.MutableIntSetFactory;
                                            uses org.eclipse.collections.api.factory.set.primitive.MutableLongSetFactory;
                                            uses org.eclipse.collections.api.factory.set.sorted.ImmutableSortedSetFactory;
                                            uses org.eclipse.collections.api.factory.set.sorted.MutableSortedSetFactory;
                                        }
                                    </moduleInfoSource>
                                </module>
                            </modules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>rename-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo message="renaming sources file" />
                                <copy file="${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-sources.jar"
                                      tofile="${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-sources.jar" />
                            </target>
                        </configuration>
                    </execution>
                    <execution>
                        <id>rename-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo message="renaming javadoc file" />
                                <copy file="${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-javadoc.jar"
                                      tofile="${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-javadoc.jar" />
                            </target>
                        </configuration>
                    </execution>

                    <execution>
                        <phase>prepare-package</phase>
                        <configuration>
                            <target>
                                <echo message="unzipping files" />
                                <unzip
                                        src="${project.build.directory}/moditect/${project.artifactId}-${core.artifact.version}.jar"
                                        dest="${project.build.directory}/classes/">
                                    <patternset>
                                        <exclude name="**/MANIFEST.MF" />
                                    </patternset>
                                </unzip>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
