<?xml version="1.0" encoding="UTF-8"?>
<!--
  SPDX-License-Identifier: Apache-2.0
  Copyright Blazebit
  -->

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.blazebit</groupId>
        <artifactId>blaze-persistence-core</artifactId>
        <version>1.6.16</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>blaze-persistence-core-api</artifactId>
    <packaging>jar</packaging>

    <name>Blazebit Persistence Core API</name>

    <properties>
        <module.name>com.blazebit.persistence.core</module.name>
    </properties>

    <dependencies>
        <!-- Actually we only need JPA but since there is no official artifact we rather use this than provider specific apis -->
        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>javaee-api</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <module>
                                <moduleInfoSource>
                                    module ${module.name} {
                                        requires transitive java.sql;
                                        requires transitive java.persistence;
                                        exports com.blazebit.persistence;
                                        exports com.blazebit.persistence.spi;
                                        exports com.blazebit.persistence.internal;
                                        uses com.blazebit.persistence.spi.CriteriaBuilderConfigurationProvider;
                                    }
                                </moduleInfoSource>
                            </module>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>java9</id>
            <activation>
                <jdk>[1.9,)</jdk>
            </activation>
            <properties>
                <jdkSpecificSourceDirectory>src/main/java9</jdkSpecificSourceDirectory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>compile-java9</id>
                                <phase>compile</phase>
                                <configuration>
                                    <target>
                                        <mkdir dir="${project.build.outputDirectory}/META-INF/versions/9" />
                                        <javac srcdir="${project.basedir}/src/main/java9" destdir="${project.build.outputDirectory}/META-INF/versions/9" classpath="${project.build.outputDirectory}" includeantruntime="false" source="9" target="9" />
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <inherited>true</inherited>
                        <configuration>
                            <archive>
                                <manifestEntries>
                                    <Multi-Release>true</Multi-Release>
                                </manifestEntries>
                            </archive>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
