|
18 | 18 |
|
19 | 19 | <!-- set properties for this build --> |
20 | 20 | <property name="src.dir" value="src/java/"/> |
| 21 | + <property name="src.java9.dir" value="src/java9/"/> |
21 | 22 | <property name="native.dir" value="native"/> |
22 | 23 | <property name="lib.dir" value="lib/"/> |
23 | 24 | <property name="build.dir" value="build"/> |
|
38 | 39 | <!-- check for SNIHostName class to determine if JDK version >= 1.8 --> |
39 | 40 | <available property="have-SNIHostName" classname="javax.net.ssl.SNIHostName" /> |
40 | 41 |
|
| 42 | + <!-- Detect Java 9+ for module-info.java compilation --> |
| 43 | + <condition property="isJava9Plus"> |
| 44 | + <not> |
| 45 | + <or> |
| 46 | + <equals arg1="${ant.java.version}" arg2="1.5"/> |
| 47 | + <equals arg1="${ant.java.version}" arg2="1.6"/> |
| 48 | + <equals arg1="${ant.java.version}" arg2="1.7"/> |
| 49 | + <equals arg1="${ant.java.version}" arg2="1.8"/> |
| 50 | + </or> |
| 51 | + </not> |
| 52 | + </condition> |
| 53 | + |
41 | 54 | <!-- Detect if running on Windows host --> |
42 | 55 | <condition property="isWindows"> |
43 | 56 | <os family="windows" /> |
|
98 | 111 | </delete> |
99 | 112 | </target> |
100 | 113 |
|
101 | | - <target name="build" depends="init, compile-nativeheaderdir, compile-javah, jar, jar-jsse, javah, javadoc"/> |
| 114 | + <target name="build" depends="init, compile-nativeheaderdir, compile-javah, compile-module-info, jar, jar-jsse, javah, javadoc"/> |
102 | 115 | <target name="build-jacoco" depends="init, compile-nativeheaderdir, compile-javah, jar, jar-jsse, javah, javadoc, examples, test-jacoco, coverage-report"/> |
103 | 116 |
|
104 | 117 | <target name="compile-nativeheaderdir" if="have-nativeheaderdir"> |
|
148 | 161 | </copy> |
149 | 162 | </target> |
150 | 163 |
|
| 164 | + <!-- Compile module-info.java for Java 9+ module support. |
| 165 | + Only runs when building with Java 9 or later. When building with |
| 166 | + Java 8 or earlier, this target is skipped and the resulting JAR |
| 167 | + will be a standard (non-modular) JAR file. --> |
| 168 | + <target name="compile-module-info" if="isJava9Plus" |
| 169 | + description="Compile module-info.java for Java 9+ (skipped on Java 8)"> |
| 170 | + <javac srcdir="${src.java9.dir}" |
| 171 | + destdir="${build.dir}" |
| 172 | + release="9" |
| 173 | + modulepath="${build.dir}" |
| 174 | + includeantruntime="false"> |
| 175 | + <include name="module-info.java"/> |
| 176 | + </javac> |
| 177 | + <echo message="Compiled module-info.java for Java 9+ module support"/> |
| 178 | + </target> |
| 179 | + |
151 | 180 | <target name="javah" unless="have-nativeheaderdir"> |
152 | 181 | <javah destdir="${native.dir}" force="yes" classpathref="classpath"> |
153 | 182 | <class name="com.wolfssl.WolfSSL"/> |
|
0 commit comments