rhino: unbreak build on Fedora 34

Sometime during the Fedora 34 lifecycle, ant started to put
/usr/share/java/rhino.jar on the classpath used to invoke javac,
which results in:

    [javac] workdir/UnpackedTarball/rhino/src/org/mozilla/javascript/optimizer/Codegen.java:202: error: reference to Hashtable is ambiguous
    [javac]         Hashtable possibleDirectCalls = null;
    [javac]         ^
    [javac]   both class java.util.Hashtable in java.util and class org.mozilla.javascript.Hashtable in org.mozilla.javascript match

Indeed /usr/share/java/rhino.jar contains a class
org.mozilla.javascript.Hashtable, while it doesn't exist yet in the
older rhino1_5R5.zip that is bundled.

The problem is that the package ant-apache-bsf contains the file
/etc/ant.d/apache-bsf which references the system rhino jar.

It turns out that reading the /etc/ant.d/* files in the shell script
/usr/bin/ant can be suppressed by setting the variable OPT_JAR_LIST to a
non-empty value, which is documented as "A user should
request optional jars and their dependencies via the OPT_JAR_LIST
variable", but which is sadly ignored if set to an empty value.

Another way to fix the problem is to patch the property
build.sysclasspath to "ignore" in build.xml.

http://ant.apache.org/manual/sysclasspath.html

Change-Id: I6d82eb226e5d01d094ebe044dbdada85b8687814
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124934
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl 2021-11-09 18:48:38 +01:00
parent f8a30a87a9
commit bb58293296
2 changed files with 14 additions and 0 deletions

View file

@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,rhino,\
external/rhino/rhino1_5R5.patch \
external/rhino/rhino1_5R5-find_swing.patch \
external/rhino/rhino1_5R5-updateToolTip.patch \
external/rhino/rhino-classpath.patch.1 \
))
$(eval $(call gb_UnpackedTarball_add_file,rhino,toolsrc/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java,external/rhino/OfficeScriptInfo.java))

13
external/rhino/rhino-classpath.patch.1 vendored Normal file
View file

@ -0,0 +1,13 @@
/usr/bin/ant will put dozens of jars on the classpath, including a
rhino.jar that breaks the build
--- rhino/build.xml.orig 2021-11-11 17:25:07.284267174 +0100
+++ rhino/build.xml 2021-11-11 17:25:38.689242510 +0100
@@ -33,6 +33,7 @@
<property file="apiClasses.properties"/>
<property name="docsrc.dir" value="docs"/>
<property name="dist.docsrc.dir" value="src/docs"/>
+ <property name="build.sysclasspath" value="ignore"/>
</target>
<target name="init" depends="properties">