Support java 17+ sealed types

This commit is contained in:
Andrea Cavalli 2021-12-08 00:00:21 +01:00
parent 0d44fbfcf8
commit bac39f6e9a
39 changed files with 276 additions and 117 deletions

View File

@ -1,11 +1,17 @@
#!/bin/bash -e
set -e
cd ./scripts/core/
./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
./generate_tdapi_java_file.sh
./build_generated_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=sealed ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh
echo "Done."
exit 0

View File

@ -1,7 +1,21 @@
#!/bin/bash -e
# MAIN REQUIRED ENVIRONMENT VARIABLES:
# API_TYPE = <legacy | sealed>
# Check variables correctness
if [ -z "${API_TYPE}" ]; then
echo "Missing parameter: API_TYPE"
exit 1
fi
# Print details
echo "Building TdApi package..."
echo "Current directory: $(pwd)"
echo "API type: ${API_TYPE}"
cd ../../generated
mvn -B clean install
mvn -B "-D${API_TYPE}" clean install
echo "Done."
exit 0

View File

@ -43,7 +43,7 @@ echo "Creating missing folders..."
# Generate pom.xml
echo "Generating pom.xml..."
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}.sed" src/main/jni-project-src/pom.template.xml > generated/pom.xml
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}-sealed.sed" src/main/jni-project-src/pom.template.xml > generated/pom.xml
# Copy source files
echo "Copying source files..."

View File

@ -3,6 +3,7 @@
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | s390x | armhf | ppc64le>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# API_TYPE = <legacy | sealed>
# CPU_CORES = "-- -j<cores>" or "-m" on Windows
# OTHER REQUIRED ENVIRONMENT VARIABLES:
# CMAKE_EXTRA_ARGUMENTS = <args>
@ -20,6 +21,10 @@ if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
if [ -z "${API_TYPE}" ]; then
echo "Missing parameter: API_TYPE"
exit 1
fi
if [ -z "${CPU_CORES}" ]; then
echo "Missing parameter: CPU_CORES"
exit 1
@ -27,6 +32,14 @@ fi
source ./setup-variables.sh
if [[ "$API_TYPE" == "sealed" ]]; then
MIN_JDK_VERSION="17"
SEALED="true"
else
MIN_JDK_VERSION="8"
SEALED="false"
fi
cd ../../
JAVA_API_PACKAGE_PATH="it/tdlight/jni"
JAVA_LIB_PACKAGE_PATH="it/tdlight/tdnative"
@ -37,6 +50,9 @@ echo "Current directory: $(pwd)"
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}"
echo "API type: ${API_TYPE}"
echo "Min jdk version: ${MIN_JDK_VERSION}"
echo "Sealed: ${SEALED}"
echo "CPU cores count: ${CPU_CORES}"
echo "CMake extra arguments: '${CMAKE_EXTRA_ARGUMENTS}'"
echo "JAVA_API_PACKAGE_PATH: '${JAVA_API_PACKAGE_PATH}'"
@ -59,7 +75,6 @@ echo "Deleting old data..."
# Create missing folders
echo "Creating missing folders..."
[ -d "./generated/src/main/java17/${JAVA_API_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java17/${JAVA_API_PACKAGE_PATH}/"
[ -d "./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java/${JAVA_API_PACKAGE_PATH}/"
[ -d "./generated/src/main/java/${JAVA_LIB_PACKAGE_PATH}/" ] || mkdir -p "./generated/src/main/java/${JAVA_LIB_PACKAGE_PATH}/"
[ -d ./generated/tdjni_build/ ] || mkdir ./generated/tdjni_build/
@ -87,19 +102,8 @@ echo "Generating TdApi.java..."
php ./implementation/td/generate/JavadocTlDocumentationGenerator.php "./implementation/td/generate/scheme/td_api.tl" "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java"
mv "./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java" "./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java"
echo "Patching TdApi.java for Java 17..."
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java)" "$(realpath -m ./src/main/java17/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)" true
if [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
unexpand --tabs=2 ./src/main/java17/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ./src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java
else
unexpand -t 2 ./src/main/java17/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ./src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java
fi
rm ./src/main/java17/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java
echo "Generated '$(realpath -m ./src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java)'"
echo "Patching TdApi.java for Java 8..."
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java)" "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)" false
echo "Patching TdApi.java for Java ${MIN_JDK_VERSION}..."
${PYTHON_EXECUTABLE} ../scripts/core/tdlib-serializer "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java)" "$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java)" "$(realpath -m ../scripts/core/tdlib-serializer/headers.txt)" "$SEALED"
if [[ "$OPERATING_SYSTEM_NAME" == "osx" ]]; then
unexpand --tabs=2 ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java > ./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java
else
@ -107,7 +111,7 @@ else
fi
rm ./src/main/java/${JAVA_API_PACKAGE_PATH}/unexpanded_TdApi.java
echo "Generated '$(realpath -m ./src/main/java17/${JAVA_API_PACKAGE_PATH}/TdApi.java)'"
echo "Generated '$(realpath -m ./src/main/java/${JAVA_API_PACKAGE_PATH}/TdApi.java)'"
rm ./src/main/java/${JAVA_API_PACKAGE_PATH}/php_TdApi.java

View File

@ -3,6 +3,7 @@
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64 | 386 | s390x | armhf | ppc64le>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# API_TYPE = <legacy | sealed>
# Check variables correctness
if [ -z "${OPERATING_SYSTEM_NAME}" ]; then
@ -17,6 +18,10 @@ if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
if [ -z "${API_TYPE}" ]; then
echo "Missing parameter: API_TYPE"
exit 1
fi
source ./setup-variables.sh
@ -28,6 +33,7 @@ echo "Current directory: $(pwd)"
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}"
echo "API type: ${API_TYPE}"
# Delete old data
echo "Deleting old data..."
@ -40,7 +46,7 @@ echo "Creating missing folders..."
# Generate pom.xml
echo "Generating pom.xml..."
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}.sed" src/main/tdapi-project-src/pom.template.xml > generated/pom.xml
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}-${API_TYPE}.sed" src/main/tdapi-project-src/pom.template.xml > generated/pom.xml
# Copy source files
echo "Copying source files..."

View File

@ -15,11 +15,18 @@ cd ../core
source ./setup-variables.sh
./install-dependencies.sh
./generate_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
./generate_tdapi_java_file.sh
./build_generated_tdapi_maven_project.sh
API_TYPE=legacy ./generate_tdapi_java_file.sh
API_TYPE=legacy ./build_generated_tdapi_maven_project.sh
API_TYPE=sealed ./generate_tdapi_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
API_TYPE=sealed ./generate_tdapi_java_file.sh
API_TYPE=sealed ./build_generated_tdapi_maven_project.sh
echo "Done."
exit 0

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/x86/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/aarch64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/armhf/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/ppc64le/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/linux/
s/${OPERATING_SYSTEM_NAME_SHORT}/linux/
s/${CPU_ARCHITECTURE_NAME}/s390x/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/osx/
s/${OPERATING_SYSTEM_NAME_SHORT}/osx/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlib/
s/${API_TYPE}/sealed/

View File

@ -2,3 +2,4 @@ s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/legacy/

View File

@ -0,0 +1,5 @@
s/${OPERATING_SYSTEM_NAME}/windows/
s/${OPERATING_SYSTEM_NAME_SHORT}/win/
s/${CPU_ARCHITECTURE_NAME}/amd64/
s/${IMPLEMENTATION_NAME}/tdlight/
s/${API_TYPE}/sealed/

View File

@ -1,7 +1,7 @@
<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>
<groupId>it.tdlight</groupId>
<artifactId>${IMPLEMENTATION_NAME}-api</artifactId>
<artifactId>${IMPLEMENTATION_NAME}-api-${API_TYPE}</artifactId>
<version>4.0.${revisionNumber}${revisionSuffix}</version>
<name>${IMPLEMENTATION_NAME} API</name>
<packaging>jar</packaging>
@ -10,6 +10,124 @@
<revisionNumber>0</revisionNumber>
<revisionSuffix>-SNAPSHOT</revisionSuffix>
</properties>
<profiles>
<profile>
<id>legacy</id>
<activation>
<property>
<name>!sealed</name>
</property>
</activation>
<build>
<plugins>
<!-- ensure the project is compiling with JDK 9+ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jdk9</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.9,)</version>
<message>JDK 9+ is required for compilation</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<!-- disable default phase due to fixed id and position in lifecycle -->
<execution>
<id>default-compile</id>
<phase>none</phase>
<!-- specify source/target for IDE integration -->
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- compile sources with Java 9 to generate and validate module-info.java -->
<execution>
<id>java-9-module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- recompile sources as Java 8 to overwrite Java 9 class files, except module-info.java -->
<execution>
<id>java-8-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<!-- specify JDK 9+ release flag to ensure no classes/methods later than Java 8 are used accidentally -->
<release>8</release>
<!-- exclude module-info.java from the compilation, as it is unsupported by Java 8 -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sealed</id>
<activation>
<property>
<name>sealed</name>
</property>
</activation>
<build>
<plugins>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
@ -93,98 +211,6 @@
</execution>
</executions>
</plugin>
<!-- ensure the project is compiling with JDK 9+ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jdk9</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.9,)</version>
<message>JDK 9+ is required for compilation</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- compile sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<!-- disable default phase due to fixed id and position in lifecycle -->
<execution>
<id>default-compile</id>
<phase>none</phase>
<!-- specify source/target for IDE integration -->
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- compile sources with Java 17 -->
<execution>
<id>java-17-module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>17</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java17</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
<!-- compile sources with Java 9 to generate and validate module-info.java -->
<execution>
<id>java-9-module-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
</configuration>
</execution>
<!-- recompile sources as Java 8 to overwrite Java 9 class files, except module-info.java -->
<execution>
<id>java-8-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<!-- specify JDK 9+ release flag to ensure no classes/methods later than Java 8 are used accidentally -->
<release>8</release>
<!-- exclude module-info.java from the compilation, as it is unsupported by Java 8 -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>