[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - configure.ac jvmfwk/CustomTarget_jreproperties.mk ridljar/Jar_libreoffice.mk ridljar/source solenv/gbuild

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 23:10:46 UTC 2020


 configure.ac                                |   41 +-------
 jvmfwk/CustomTarget_jreproperties.mk        |    2 
 ridljar/Jar_libreoffice.mk                  |    8 +
 ridljar/source/libreoffice/module-info.java |  140 ++++++++++++++++++++++++++++
 solenv/gbuild/Jar.mk                        |   14 ++
 solenv/gbuild/JavaClassSet.mk               |   38 ++++++-
 solenv/gbuild/gbuild.mk                     |    2 
 7 files changed, 205 insertions(+), 40 deletions(-)

New commits:
commit 8b6c0b73afbf201ffef6541625b902939dd116f6
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu May 7 09:42:22 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jun 5 01:10:15 2020 +0200

    tdf#131572 Add java 9 module info for libreoffice.jar
    
    Add a java module named "org.libreoffice.uno" for this jar.
    
    This needs to be compiled with Java 9.
    But since we want to keep b/c with Java 8,
    the rest of the jar has to be compiled with Java 8.
    
    This bumps the *build* requirement to Java 9 while keeping
    the *runtime* requirement at Java 8.
    
    The gbuild JavaClassSet class is changed to invoke javac twice,
    where the 2nd invocation compiles with --release 9 and a --patch-modules
    argument so that it finds the results of the first invocation and also
    the javamaker generated files in CustomTargets.
    
    Change-Id: I888f5dbe097cc37136e68db5919939877c981862
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91105
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 941b567a41569260fef14a7337511e8f42337323)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95049
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/configure.ac b/configure.ac
index 10da45dafaa9..de98eeaca272 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1970,7 +1970,7 @@ AC_ARG_WITH(linker-hash-style,
 
 AC_ARG_WITH(jdk-home,
     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
-        [If you have installed JDK 8 or later on your system please supply the
+        [If you have installed JDK 9 or later on your system please supply the
          path here. Note that this is not the location of the java command but the
          location of the entire distribution.]),
 ,)
@@ -7278,20 +7278,12 @@ if test "$ENABLE_JAVA" != ""; then
                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
                 _jdk_home=$regvalue
             fi
-            if test -z "$with_jdk_home"; then
-                for ver in 1.8; do
-                    reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
-                    if test -n "$regvalue"; then
-                        _jdk_home=$regvalue
-                        break
-                    fi
-                done
-            fi
+
             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
                 with_jdk_home="$_jdk_home"
                 howfound="found automatically"
             else
-                AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
+                AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK >= 9])
             fi
         else
             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
@@ -7373,24 +7365,7 @@ if test "$ENABLE_JAVA" != ""; then
         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
-            JDK=ibm
-
-            dnl IBM JDK specific tests
-            _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
-            _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
-
-            if test "$_jdk_ver" -lt 10800; then
-                AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
-            fi
-
-            AC_MSG_RESULT([found (IBM JDK $_jdk)])
-
-            if test "$with_jdk_home" = ""; then
-                AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
-you must use the "--with-jdk-home" configure option explicitly])
-            fi
-
-            JAVA_HOME=$with_jdk_home
+            AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
         else
             JDK=sun
 
@@ -7398,10 +7373,10 @@ you must use the "--with-jdk-home" configure option explicitly])
             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
 
-            if test "$_jdk_ver" -lt 10800; then
-                AC_MSG_ERROR([JDK is too old, you need at least 8])
+            if test "$_jdk_ver" -lt 10900; then
+                AC_MSG_ERROR([JDK is too old, you need at least 9])
             fi
-            if test "$_jdk_ver" -gt 10800; then
+            if test "$_jdk_ver" -gt 10900; then
                 JAVA_CLASSPATH_NOT_SET=TRUE
             fi
 
@@ -7417,7 +7392,7 @@ you must use the "--with-jdk-home" configure option explicitly])
             JAVAFLAGS=-J-Xmx128M
         fi
     else
-        AC_MSG_ERROR([Java not found. You need at least JDK 8])
+        AC_MSG_ERROR([Java not found. You need at least JDK 9])
     fi
 else
     dnl Java disabled
diff --git a/jvmfwk/CustomTarget_jreproperties.mk b/jvmfwk/CustomTarget_jreproperties.mk
index 678163efa4d1..c578ca879c4c 100644
--- a/jvmfwk/CustomTarget_jreproperties.mk
+++ b/jvmfwk/CustomTarget_jreproperties.mk
@@ -16,6 +16,6 @@ $(call gb_CustomTarget_get_workdir,jvmfwk/jreproperties)/JREProperties.class : \
 		| $(call gb_CustomTarget_get_workdir,jvmfwk/jreproperties)/.dir
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),JCS,1)
 	$(call gb_Helper_abbreviate_dirs, \
-	cd $(dir $@) && $(gb_JavaClassSet_JAVACCOMMAND) $(gb_JavaClassSet_JAVACDEBUG) -d $(dir $@) $^)
+	cd $(dir $@) && $(call gb_JavaClassSet_JAVACCOMMAND,$(JAVA_TARGET_VER))  $(gb_JavaClassSet_JAVACDEBUG) -d $(dir $@) $^)
 
 # vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/ridljar/Jar_libreoffice.mk b/ridljar/Jar_libreoffice.mk
index 4d0f5ef2545f..d34ae3f5ebda 100644
--- a/ridljar/Jar_libreoffice.mk
+++ b/ridljar/Jar_libreoffice.mk
@@ -7,7 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Jar_Jar,libreoffice))
+$(eval $(call gb_Jar_Jar,libreoffice,org.libreoffice.uno))
 
 $(eval $(call gb_Jar_use_customtargets,libreoffice,\
     ridljar/javamaker \
@@ -27,9 +27,15 @@ $(eval $(call gb_Jar_add_manifest_classpath,libreoffice, \
     $(if $(filter MACOSX,$(OS)),../../Frameworks/,../) \
 ))
 
+# ugly: the module-info.class is manually added here since it's not in "com" dir
 $(eval $(call gb_Jar_add_packagedirs,libreoffice,\
     $(call gb_CustomTarget_get_workdir,ridljar/javamaker)/com \
     $(call gb_CustomTarget_get_workdir,unoil/javamaker)/com \
+	$(call gb_JavaClassSet_get_classdir,$(call gb_Jar_get_classsetname,libreoffice))/module-info.class \
+))
+
+$(eval $(call gb_Jar_add_sourcefiles_java9,libreoffice,\
+    ridljar/source/libreoffice/module-info \
 ))
 
 $(eval $(call gb_Jar_add_sourcefiles,libreoffice,\
diff --git a/ridljar/source/libreoffice/module-info.java b/ridljar/source/libreoffice/module-info.java
new file mode 100644
index 000000000000..4399586fc558
--- /dev/null
+++ b/ridljar/source/libreoffice/module-info.java
@@ -0,0 +1,140 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+module org.libreoffice.uno
+{
+    exports com.sun.star.accessibility;
+    exports com.sun.star.animations;
+    exports com.sun.star.auth;
+    exports com.sun.star.awt;
+    exports com.sun.star.awt.grid;
+    exports com.sun.star.awt.tab;
+    exports com.sun.star.awt.tree;
+    exports com.sun.star.beans;
+    exports com.sun.star.bridge;
+    exports com.sun.star.bridge.oleautomation;
+    exports com.sun.star.chart;
+    exports com.sun.star.chart2;
+    exports com.sun.star.chart2.data;
+    exports com.sun.star.comp.bridgefactory;
+    exports com.sun.star.comp.connections;
+    exports com.sun.star.comp.helper;
+    exports com.sun.star.comp.loader;
+    exports com.sun.star.comp.servicemanager;
+    exports com.sun.star.comp.urlresolver;
+    exports com.sun.star.configuration;
+    exports com.sun.star.configuration.backend;
+    exports com.sun.star.connection;
+    exports com.sun.star.container;
+    exports com.sun.star.cui;
+    exports com.sun.star.datatransfer;
+    exports com.sun.star.datatransfer.clipboard;
+    exports com.sun.star.datatransfer.dnd;
+    exports com.sun.star.deployment;
+    exports com.sun.star.deployment.test;
+    exports com.sun.star.deployment.ui;
+    exports com.sun.star.document;
+    exports com.sun.star.drawing;
+    exports com.sun.star.drawing.framework;
+    exports com.sun.star.embed;
+    exports com.sun.star.form;
+    exports com.sun.star.form.binding;
+    exports com.sun.star.form.control;
+    exports com.sun.star.form.runtime;
+    exports com.sun.star.form.submission;
+    exports com.sun.star.form.validation;
+    exports com.sun.star.formula;
+    exports com.sun.star.frame;
+    exports com.sun.star.frame.status;
+    exports com.sun.star.gallery;
+    exports com.sun.star.geometry;
+    exports com.sun.star.graphic;
+    exports com.sun.star.i18n;
+    exports com.sun.star.inspection;
+    exports com.sun.star.io;
+    exports com.sun.star.java;
+    exports com.sun.star.lang;
+    exports com.sun.star.ldap;
+    exports com.sun.star.lib.connections.pipe;
+    exports com.sun.star.lib.connections.socket;
+    exports com.sun.star.lib.uno;
+    exports com.sun.star.lib.uno.adapter;
+    exports com.sun.star.lib.uno.bridges.java_remote;
+    exports com.sun.star.lib.uno.environments.java;
+    exports com.sun.star.lib.uno.environments.remote;
+    exports com.sun.star.lib.uno.helper;
+    exports com.sun.star.lib.uno.protocols.urp;
+    exports com.sun.star.lib.uno.typedesc;
+    exports com.sun.star.lib.uno.typeinfo;
+    exports com.sun.star.lib.util;
+    exports com.sun.star.linguistic2;
+    exports com.sun.star.loader;
+    exports com.sun.star.logging;
+    exports com.sun.star.mail;
+    exports com.sun.star.media;
+    exports com.sun.star.mozilla;
+    exports com.sun.star.office;
+    exports com.sun.star.packages;
+    exports com.sun.star.packages.manifest;
+    exports com.sun.star.packages.zip;
+    exports com.sun.star.presentation;
+    exports com.sun.star.qa;
+    exports com.sun.star.rdf;
+    exports com.sun.star.reflection;
+    exports com.sun.star.registry;
+    exports com.sun.star.rendering;
+    exports com.sun.star.report;
+    exports com.sun.star.report.inspection;
+    exports com.sun.star.report.meta;
+    exports com.sun.star.resource;
+    exports com.sun.star.scanner;
+    exports com.sun.star.script;
+    exports com.sun.star.script.browse;
+    exports com.sun.star.script.provider;
+    exports com.sun.star.script.vba;
+    exports com.sun.star.sdb;
+    exports com.sun.star.sdb.application;
+    exports com.sun.star.sdb.tools;
+    exports com.sun.star.sdbc;
+    exports com.sun.star.sdbcx;
+    exports com.sun.star.security;
+    exports com.sun.star.setup;
+    exports com.sun.star.sheet;
+    exports com.sun.star.sheet.opencl;
+    exports com.sun.star.smarttags;
+    exports com.sun.star.style;
+    exports com.sun.star.svg;
+    exports com.sun.star.system;
+    exports com.sun.star.table;
+    exports com.sun.star.task;
+    exports com.sun.star.text;
+    exports com.sun.star.text.textfield;
+    exports com.sun.star.tiledrendering;
+    exports com.sun.star.ucb;
+    exports com.sun.star.ui;
+    exports com.sun.star.ui.dialogs;
+    exports com.sun.star.ui.test;
+    exports com.sun.star.uno;
+    exports com.sun.star.uri;
+    exports com.sun.star.util;
+    exports com.sun.star.view;
+    exports com.sun.star.xforms;
+    exports com.sun.star.xml;
+    exports com.sun.star.xml.crypto;
+    exports com.sun.star.xml.crypto.sax;
+    exports com.sun.star.xml.csax;
+    exports com.sun.star.xml.dom;
+    exports com.sun.star.xml.dom.events;
+    exports com.sun.star.xml.dom.views;
+    exports com.sun.star.xml.input;
+    exports com.sun.star.xml.sax;
+    exports com.sun.star.xml.wrapper;
+    exports com.sun.star.xml.xpath;
+    exports com.sun.star.xml.xslt;
+    exports com.sun.star.xsd;
+}
diff --git a/solenv/gbuild/Jar.mk b/solenv/gbuild/Jar.mk
index c647ffd59d95..bd47e605f3e5 100644
--- a/solenv/gbuild/Jar.mk
+++ b/solenv/gbuild/Jar.mk
@@ -92,6 +92,7 @@ endef
 # creates a class set and a dependency to it
 # registers target and clean target
 # adds jar files to DeliverLogTarget
+# call gb_Jar_Jar,jarname,java9modulename
 define gb_Jar_Jar
 ifeq (,$$(findstring $(1),$$(gb_Jar_KNOWN)))
 $$(eval $$(call gb_Output_info,Currently known jars are: $(sort $(gb_Jar_KNOWN)),ALL))
@@ -104,7 +105,7 @@ $(call gb_Jar_get_target,$(1)) : PACKAGEDIRS :=
 $(call gb_Jar_get_target,$(1)) : PACKAGEFILES :=
 $(call gb_Jar_get_target,$(1)) : \
 	$(call gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,$(1)))
-$(call gb_JavaClassSet_JavaClassSet,$(call gb_Jar_get_classsetname,$(1)))
+$(call gb_JavaClassSet_JavaClassSet,$(call gb_Jar_get_classsetname,$(1)),$(2))
 $(eval $(call gb_Module_register_target,Jar_$(1),$(call gb_Jar_get_target,$(1)),$(call gb_Jar_get_clean_target,$(1))))
 $(call gb_Helper_make_userfriendly_targets,$(1),Jar,$(call gb_Jar_get_target,$(1)))
 
@@ -119,6 +120,12 @@ $(call gb_JavaClassSet_add_sourcefile,$(call gb_Jar_get_classsetname,$(1)),$(2))
 
 endef
 
+define gb_Jar_add_sourcefile_java9
+$(call gb_JavaClassSet_add_sourcefile_java9,$(call gb_Jar_get_classsetname,$(1)),$(2))
+
+endef
+
+
 # PACKAGEROOTS is the list of all root folders created by the JavaClassSet to pack into the jar (without META-INF as this is added automatically)
 define gb_Jar_set_packageroot
 $(call gb_Jar_get_target,$(1)) : PACKAGEROOTS := $(2)
@@ -157,6 +164,11 @@ $(foreach sourcefile,$(2),$(call gb_Jar_add_sourcefile,$(1),$(sourcefile)))
 
 endef
 
+define gb_Jar_add_sourcefiles_java9
+$(foreach sourcefile,$(2),$(call gb_Jar_add_sourcefile_java9,$(1),$(sourcefile)))
+
+endef
+
 define gb_Jar_add_generated_sourcefile
 $(call gb_JavaClassSet_add_generated_sourcefile,$(call gb_Jar_get_classsetname,$(1)),$(2))
 
diff --git a/solenv/gbuild/JavaClassSet.mk b/solenv/gbuild/JavaClassSet.mk
index ee94a6525c26..541490448b05 100644
--- a/solenv/gbuild/JavaClassSet.mk
+++ b/solenv/gbuild/JavaClassSet.mk
@@ -17,10 +17,11 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-gb_JavaClassSet_JAVACCOMMAND := $(ICECREAM_RUN) $(JAVACOMPILER) $(JAVAFLAGS) \
+gb_JavaClassSet_JAVACCOMMAND = $(ICECREAM_RUN) $(JAVACOMPILER) $(JAVAFLAGS) \
     -encoding utf8 \
-    -source $(JAVA_SOURCE_VER) -target $(JAVA_TARGET_VER) \
+    --release $(1) \
     $(if $(JAVA_CLASSPATH_NOT_SET),-Xlint:-options)
+
 gb_JavaClassSet_JAVACDEBUG :=
 
 # Enforces correct dependency order for possibly generated stuff:
@@ -31,19 +32,34 @@ ifneq ($(gb_DEBUGLEVEL),0)
 gb_JavaClassSet_JAVACDEBUG := -g
 endif
 
+# $(PACKAGEDIRS) inherited from Jar -- assumption is the last part of the path
+# is top-level java package directory
+# for Java 9 modules, invoke javac another time, with --patch-module so that
+# it finds all the class files for whose packages the module-info contains a
+# declaration
 define gb_JavaClassSet__command
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) && \
 	$(if $(filter-out $(JARDEPS),$(4)), \
 		rm -rf $(call gb_JavaClassSet_get_classdir,$(2))/* && \
 		RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\
-			$(filter-out $(JARDEPS),$(4))) && \
-		$(if $(3),$(gb_JavaClassSet_JAVACCOMMAND) \
+			$(filter-out $(JARDEPS) $(T_JAVA9FILES),$(4))) && \
+		$(if $(3),$(call gb_JavaClassSet_JAVACCOMMAND,$(JAVA_TARGET_VER)) \
 			$(gb_JavaClassSet_JAVACDEBUG) \
 			-classpath "$(T_CP)$(gb_CLASSPATHSEP)$(call gb_JavaClassSet_get_classdir,$(2))" \
 			-d $(call gb_JavaClassSet_get_classdir,$(2)) \
 			@$$RESPONSEFILE &&) \
 		rm -f $$RESPONSEFILE &&) \
+		$(if $(T_MODULENAME),\
+			RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\
+				$(T_JAVA9FILES)) && \
+			$(if $(3),$(call gb_JavaClassSet_JAVACCOMMAND,9) \
+				$(gb_JavaClassSet_JAVACDEBUG) \
+				-classpath "$(T_CP)$(gb_CLASSPATHSEP)$(call gb_JavaClassSet_get_classdir,$(2))" \
+				$(if $(T_MODULENAME),--patch-module $(T_MODULENAME)="$(subst $(WHITESPACE),$(gb_CLASSPATHSEP),$(strip $(dir $(PACKAGEDIRS))))") \
+				-d $(call gb_JavaClassSet_get_classdir,$(2)) \
+				@$$RESPONSEFILE &&) \
+			) \
 	touch $(1))
 
 endef
@@ -62,6 +78,7 @@ $(call gb_JavaClassSet_get_preparation_target,%) :
 	mkdir -p $(dir $@) && touch $@
 
 # depend on makefile to enforce a rebuild if files are removed from the classset
+# call gb_JavaClassSet_JavaClassSet,csname,java9modulename
 define gb_JavaClassSet_JavaClassSet
 $(call gb_JavaClassSet_get_target,$(1)) : \
 	$(gb_Module_CURRENTMAKEFILE) \
@@ -69,6 +86,8 @@ $(call gb_JavaClassSet_get_target,$(1)) : \
 $(call gb_JavaClassSet_get_target,$(1)) : JARDEPS := \
 	$(gb_Module_CURRENTMAKEFILE) \
 	$(call gb_JavaClassSet_get_preparation_target,$(1))
+$(call gb_JavaClassSet_get_target,$(1)) : T_MODULENAME := $(2)
+$(call gb_JavaClassSet_get_target,$(1)) : T_JAVA9FILES :=
 
 endef
 
@@ -90,6 +109,17 @@ $(foreach sourcefile,$(2),$(call gb_JavaClassSet_add_sourcefile,$(1),$(sourcefil
 
 endef
 
+define gb_JavaClassSet_add_sourcefile_java9
+$(call gb_JavaClassSet_get_target,$(1)) : $(call gb_JavaClassSet__get_sourcefile,$(2))
+$(call gb_JavaClassSet_get_target,$(1)) : T_JAVA9FILES += $(call gb_JavaClassSet__get_sourcefile,$(2))
+
+endef
+
+define gb_JavaClassSet_add_sourcefiles_java9
+$(foreach sourcefile,$(2),$(call gb_JavaClassSet_add_sourcefile_java9,$(1),$(sourcefile)))
+
+endef
+
 define gb_JavaClassSet_add_generated_sourcefile
 $(call gb_JavaClassSet_get_target,$(1)) : $(call gb_JavaClassSet__get_generated_sourcefile,$(2))
 $(call gb_JavaClassSet__get_generated_sourcefile,$(2)) :| $(call gb_JavaClassSet_get_preparation_target,$(1))
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index d41c40123bc2..c80d622f1b81 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -60,6 +60,8 @@ COMMA :=,
 OPEN_PAREN :=(
 CLOSE_PAREN :=)
 
+gb_SPACE:=$(gb_SPACE) $(gb_SPACE)
+
 gb_VERBOSE := $(verbose)
 
 include $(GBUILDDIR)/Helper.mk


More information about the Libreoffice-commits mailing list