| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| |
| --> |
| <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"> |
| <parent> |
| <groupId>org.apache.fory</groupId> |
| <artifactId>fory-parent</artifactId> |
| <version>1.4.0-SNAPSHOT</version> |
| </parent> |
| <modelVersion>4.0.0</modelVersion> |
| |
| <artifactId>fory-json</artifactId> |
| |
| <description> |
| Apache Fory JSON serialization. |
| </description> |
| |
| <properties> |
| <maven.compiler.source>8</maven.compiler.source> |
| <maven.compiler.target>8</maven.compiler.target> |
| <fory.java.rootdir>${basedir}/..</fory.java.rootdir> |
| <fory.json.mr.classes>${project.build.directory}/multi-release-classes</fory.json.mr.classes> |
| <fory.json.jdk25.test.classes>${project.build.directory}/jdk25-test-classes</fory.json.jdk25.test.classes> |
| <fory.core.jdk25.test.classes>${project.basedir}/../fory-core/target/jdk25-test-classes</fory.core.jdk25.test.classes> |
| </properties> |
| |
| <dependencies> |
| <dependency> |
| <groupId>org.apache.fory</groupId> |
| <artifactId>fory-core</artifactId> |
| <version>${project.version}</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.fory</groupId> |
| <artifactId>fory-test-core</artifactId> |
| <version>${project.version}</version> |
| <scope>test</scope> |
| </dependency> |
| <dependency> |
| <groupId>com.google.guava</groupId> |
| <artifactId>guava</artifactId> |
| <optional>true</optional> |
| </dependency> |
| </dependencies> |
| |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-jar-plugin</artifactId> |
| <configuration> |
| <archive> |
| <manifestEntries> |
| <Automatic-Module-Name>org.apache.fory.json</Automatic-Module-Name> |
| <Multi-Release>true</Multi-Release> |
| </manifestEntries> |
| </archive> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| |
| <profiles> |
| <profile> |
| <id>jpms-java9</id> |
| <activation> |
| <jdk>[9,)</jdk> |
| </activation> |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-antrun-plugin</artifactId> |
| <version>3.1.0</version> |
| <executions> |
| <execution> |
| <id>compile-java9-module-info</id> |
| <phase>process-classes</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <mkdir dir="${project.build.directory}/jpms-classes/java9"/> |
| <condition |
| property="fory.core.module.jar" |
| value="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar" |
| else="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"> |
| <available |
| file="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar"/> |
| </condition> |
| <path id="fory.core.compile.path"> |
| <pathelement location="${project.basedir}/../fory-core/target/classes"/> |
| <pathelement |
| location="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"/> |
| </path> |
| <path id="compile.module.path.elements"> |
| <pathelement location="${fory.core.module.jar}"/> |
| <difference> |
| <path refid="maven.compile.classpath"/> |
| <path refid="fory.core.compile.path"/> |
| </difference> |
| </path> |
| <pathconvert property="compile.module.path" refid="compile.module.path.elements" |
| pathsep="${path.separator}"/> |
| <javac srcdir="${project.basedir}/src/main/java9" |
| destdir="${project.build.directory}/jpms-classes/java9" |
| includeantruntime="false" |
| fork="true" |
| executable="${java.home}/bin/javac" |
| debug="true"> |
| <include name="module-info.java"/> |
| <compilerarg value="--release"/> |
| <compilerarg value="9"/> |
| <compilerarg value="--module-path"/> |
| <compilerarg path="${compile.module.path}"/> |
| <compilerarg value="--patch-module"/> |
| <compilerarg value="org.apache.fory.json=${project.build.outputDirectory}"/> |
| </javac> |
| </target> |
| </configuration> |
| </execution> |
| <execution> |
| <id>inject-java9-module-info</id> |
| <phase>package</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <jar destfile="${project.build.directory}/${project.build.finalName}.jar" update="true"> |
| <zipfileset dir="${project.build.directory}/jpms-classes/java9" |
| prefix="META-INF/versions/9" |
| includes="module-info.class"/> |
| </jar> |
| </target> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| </profile> |
| <profile> |
| <id>jdk25-multi-release</id> |
| <activation> |
| <jdk>[25,)</jdk> |
| </activation> |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-source-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>attach-sources</id> |
| <phase>package</phase> |
| <goals> |
| <goal>jar</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-antrun-plugin</artifactId> |
| <version>3.1.0</version> |
| <executions> |
| <execution> |
| <id>compile-jdk25-classes</id> |
| <phase>process-classes</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <delete dir="${fory.json.mr.classes}/25"/> |
| <mkdir dir="${fory.json.mr.classes}/25"/> |
| <javac srcdir="${project.basedir}/src/main/java25" |
| destdir="${fory.json.mr.classes}/25" |
| includeantruntime="false" |
| fork="true" |
| executable="${java.home}/bin/javac" |
| debug="true"> |
| <include name="org/**/*.java"/> |
| <classpath> |
| <path refid="maven.compile.classpath"/> |
| <pathelement location="${project.build.outputDirectory}"/> |
| </classpath> |
| <compilerarg value="--release"/> |
| <compilerarg value="22"/> |
| <compilerarg value="-sourcepath"/> |
| <compilerarg value=""/> |
| </javac> |
| </target> |
| </configuration> |
| </execution> |
| <execution> |
| <id>inject-jdk25-classes</id> |
| <phase>package</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <jar destfile="${project.build.directory}/${project.build.finalName}.jar" |
| update="true"> |
| <zipfileset dir="${fory.json.mr.classes}/25" |
| prefix="META-INF/versions/25" |
| includes="**/*.class"/> |
| </jar> |
| </target> |
| </configuration> |
| </execution> |
| <execution> |
| <id>prepare-jdk25-test-classes</id> |
| <phase>process-test-classes</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <delete dir="${fory.json.jdk25.test.classes}"/> |
| <mkdir dir="${fory.json.jdk25.test.classes}"/> |
| <!-- Reactor tests see dependency target/classes instead of the packaged |
| multi-release jar. Put Fory core's JDK25 test overlay ahead of the raw |
| dependency classes so JsonCodegen exercises the same CodecBuilder owner |
| path as packaged JDK25 runs. --> |
| <copy todir="${fory.json.jdk25.test.classes}"> |
| <fileset dir="${project.build.outputDirectory}"> |
| <exclude name="module-info.class"/> |
| </fileset> |
| </copy> |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> |
| <fileset dir="${fory.json.mr.classes}/25"> |
| <exclude name="module-info.class"/> |
| </fileset> |
| </copy> |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> |
| <fileset dir="${fory.core.jdk25.test.classes}" erroronmissingdir="false"> |
| <exclude name="module-info.class"/> |
| </fileset> |
| </copy> |
| </target> |
| </configuration> |
| </execution> |
| <execution> |
| <id>verify-jdk25-multi-release-jar</id> |
| <phase>verify</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <condition |
| property="fory.core.module.jar" |
| value="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar" |
| else="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"> |
| <available |
| file="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar"/> |
| </condition> |
| <java |
| classname="org.apache.fory.json.writer.Jdk25MultiReleaseJarVerifier" |
| fork="true" |
| failonerror="true"> |
| <classpath> |
| <pathelement location="${project.build.testOutputDirectory}"/> |
| <path refid="maven.test.classpath"/> |
| </classpath> |
| <arg value="${project.build.directory}/${project.build.finalName}.jar"/> |
| <arg value="${project.build.directory}/${project.build.finalName}-sources.jar"/> |
| <arg value="${fory.core.module.jar}"/> |
| </java> |
| </target> |
| </configuration> |
| </execution> |
| <execution> |
| <id>patch-jdk25-source-jar</id> |
| <phase>package</phase> |
| <goals> |
| <goal>run</goal> |
| </goals> |
| <configuration> |
| <target> |
| <property |
| name="jdk25.sources.jar" |
| value="${project.build.directory}/${project.build.finalName}-sources.jar"/> |
| <available file="${jdk25.sources.jar}" property="jdk25.sources.jar.present"/> |
| <fail |
| unless="jdk25.sources.jar.present" |
| message="Multi-release source patching requires ${jdk25.sources.jar}."/> |
| <jar destfile="${jdk25.sources.jar}" update="true"> |
| <zipfileset dir="${project.basedir}/src/main/java25" |
| prefix="META-INF/versions/25"> |
| <include name="**/*.java"/> |
| </zipfileset> |
| </jar> |
| </target> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-surefire-plugin</artifactId> |
| <configuration> |
| <argLine>${argLine} --add-opens=java.base/java.lang.invoke=ALL-UNNAMED</argLine> |
| <classesDirectory>${fory.json.jdk25.test.classes}</classesDirectory> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| </profile> |
| </profiles> |
| </project> |