<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.kohlschutter.jdk.compiler</groupId>
        <artifactId>standalone</artifactId>
        <version>1.1.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>standalone-jdk21</artifactId>

    <licenses>
        <license>
            <name>GPL-2.0-with-classpath-exception</name>
            <url>https://www.gnu.org/software/classpath/license.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <maven.compiler.release>11</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
        <file.encoding>UTF-8</file.encoding>
        <maven.compile.encoding>UTF-8</maven.compile.encoding>
        <xlint.compiler.arg>-Xlint:none</xlint.compiler.arg>
        <spotbugs.disabled>true</spotbugs.disabled>
        <javadoc.strict>false</javadoc.strict>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>de.thetaphi</groupId>
                <artifactId>forbiddenapis</artifactId>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>skip</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>checkstyle-during-compile</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>skip</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>skip</phase>
                    </execution>
                    <execution>
                        <id>default-cpd-check</id>
                        <goals>
                            <goal>cpd-check</goal>
                        </goals>
                        <phase>skip</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>spotbugs-during-install</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>skip</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <?m2e ignore?>
                        <id>java21-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/versions/21</outputDirectory>
                            <release>21</release>
                            <multiReleaseOutput>false</multiReleaseOutput>
                            <compileSourceRoots>
                                <compileSourceRoot>
                                    ${project.basedir}/src/main/java21</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                    <execution>
                        <?m2e ignore?>
                        <id>java18-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/versions/18</outputDirectory>
                            <release>18</release>
                            <multiReleaseOutput>false</multiReleaseOutput>
                            <compileSourceRoots>
                                <compileSourceRoot>
                                    ${project.basedir}/src/main/java18</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                    <execution>
                        <?m2e ignore?>
                        <id>java16-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/versions/16</outputDirectory>
                            <release>16</release>
                            <multiReleaseOutput>false</multiReleaseOutput>
                            <compileSourceRoots>
                                <compileSourceRoot>
                                    ${project.basedir}/src/main/java16</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                    <execution>
                        <?m2e ignore?>
                        <id>java15-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/versions/15</outputDirectory>
                            <release>15</release>
                            <multiReleaseOutput>false</multiReleaseOutput>
                            <compileSourceRoots>
                                <compileSourceRoot>
                                    ${project.basedir}/src/main/java15</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                    <execution>
                        <?m2e ignore?>
                        <id>java14-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/versions/14</outputDirectory>
                            <release>14</release>
                            <multiReleaseOutput>false</multiReleaseOutput>
                            <compileSourceRoots>
                                <compileSourceRoot>
                                    ${project.basedir}/src/main/java14</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>build-native</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>compile-no-fork</goal>
                                </goals>
                                <configuration>
                                    <mainClass>
                                        standalone.com.sun.tools.javac.Main</mainClass>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <skip>false</skip>
                            <useArgFile>false</useArgFile>
                            <imageName>${project.name}-${project.version}-javac</imageName>
                            <fallback>false</fallback>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jar-with-dependencies</id>
            <activation>
                <property>
                    <name>jar-with-dependencies</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-shade-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jar-with-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <createDependencyReducedPom>false</createDependencyReducedPom>
                                    <shadedArtifactAttached>true</shadedArtifactAttached>
                                    <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
                                    <transformers>
                                        <transformer
                                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>
                                                standalone.com.sun.tools.javac.Main</mainClass>
                                        </transformer>
                                        <transformer
                                            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                    </transformers>
                                    <minimizeJar>false</minimizeJar>
                                    <filters>
                                        <filter>
                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>/logging.properties</exclude>
                                                <exclude>META-INF/LICENSE</exclude>
                                                <exclude>META-INF/*.md</exclude>
                                                <exclude>META-INF/*.MF</exclude>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                                <exclude>
                                                    META-INF/*.kotlin_module</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.kohlschutter.jdk</groupId>
            <artifactId>standalone-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.kohlschutter.jdk</groupId>
            <artifactId>standalone-home</artifactId>
            <version>1.1.0</version>
            <classifier>jdk21</classifier>
        </dependency>
    </dependencies>
</project>
