Skip to content

Commit

Permalink
Simplify building with OpenJDK 8
Browse files Browse the repository at this point in the history
Don't require editing of build.properties. Now it's enough to use:

    ant -Djava8only=true
  • Loading branch information
Larhzu committed Jul 28, 2024
1 parent 1c40f63 commit 7f4ccd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Building with Apache Ant

* If you are using OpenJDK version older than 9:

Comment the `sourcever9` line in the file `build.properties`.
When it is commented, `module-info.java` and other files
requiring Java 9 won't be built. `xz.jar` won't be a modular JAR.
To build with OpenJDK 8, use `-Djava8only=true` on the `ant`
command line. Then the files requiring Java >= 9 won't be built,
and `xz.jar` won't be a modular JAR.

* If you are using OpenJDK version older than 8:

Expand Down
8 changes: 3 additions & 5 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ debug = true
#
# sourcever9 does the same as sourcever but for files that require Java 9 or
# later. The resulting classes are packaged as multi-release JAR, including
# module-info.java. If sourcever9 is commented out, these files won't be
# built but the package will still work.
# module-info.java.
#
# If you need to build this on OpenJDK 8:
# - Set sourcever = 8
# - Comment the sourcever9 line below to disable building Java 9 files.
# To build with OpenJDK 8, use -Djava8only=true on the ant command line.
sourcever = 8
sourcever9 = 9
java8only = false

# If true, javadoc is called with en_US locale to force the headings and
# such strings from javadoc to be in English, independent of the system
Expand Down
17 changes: 6 additions & 11 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,13 @@
<compilerarg compiler="modern" line="-implicit:none"/>
</javac>

<!-- Build Java 9 files only if sourcever9 is set: -->
<mkdir dir="${classes9_dir}"/>
<condition property="exclude_java9" value="**">
<not><isset property="sourcever9"/></not>
</condition>

<javac srcdir="." sourcepath="${src9_dir}:${src_dir}"
<mkdir unless:true="${java8only}" dir="${classes9_dir}"/>
<javac unless:true="${java8only}"
srcdir="." sourcepath="${src9_dir}:${src_dir}"
destdir="${classes9_dir}"
includeAntRuntime="false" debug="${debug}"
release="${sourcever9}"
includesfile="fileset-src9.txt"
excludes="${exclude_java9}">
includesfile="fileset-src9.txt">
<compilerarg compiler="modern" line="-Xlint"/>
<compilerarg compiler="modern" line="-implicit:none"/>
</javac>
Expand All @@ -79,14 +74,14 @@
<jar destfile="${jar_dir}/xz.jar">
<fileset dir="${classes_dir}" includes="org/tukaani/xz/**"/>
<zipfileset prefix="META-INF/versions/9/" dir="${classes9_dir}"
if:set="sourcever9"/>
unless:true="${java8only}"/>
<manifest>
<attribute name="Implementation-Title" value="${title}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-URL" value="${homepage}"/>
<attribute name="Sealed" value="true"/>
<attribute name="Multi-Release" value="true"
if:set="sourcever9"/>
unless:true="${java8only}"/>
<!-- Attributes for OSGi bundles: -->
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-SymbolicName" value="org.tukaani.xz"/>
Expand Down

0 comments on commit 7f4ccd6

Please sign in to comment.