address problems with launch4j and jdk-17 (see also 41d009462d3c, copy of 41d009462d3c);
authorwenzelm
Fri, 03 Dec 2021 13:32:58 +0100
changeset 74872 9e9a308562da
parent 74871 0597884e6e91
child 74873 0ab2ed1489eb
address problems with launch4j and jdk-17 (see also 41d009462d3c, copy of 41d009462d3c);
Admin/Release/CHECKLIST
src/Pure/Admin/build_release.scala
src/Pure/Admin/isabelle_devel.scala
--- a/Admin/Release/CHECKLIST	Thu Dec 02 12:46:29 2021 +0100
+++ b/Admin/Release/CHECKLIST	Fri Dec 03 13:32:58 2021 +0100
@@ -73,7 +73,7 @@
 
 - fully-automated packaging (e.g. on lxcisa0):
 
-  hg up -r DISTNAME && Admin/build_release -J .../java11 -D /p/home/isabelle/dist -b HOL -l -R DISTNAME
+  hg up -r DISTNAME && Admin/build_release -D /p/home/isabelle/dist -b HOL -l -R DISTNAME
 
 - Docker image:
 
--- a/src/Pure/Admin/build_release.scala	Thu Dec 02 12:46:29 2021 +0100
+++ b/src/Pure/Admin/build_release.scala	Fri Dec 03 13:32:58 2021 +0100
@@ -17,6 +17,9 @@
   private def execute_tar(dir: Path, args: String, strip: Int = 0): Unit =
     Isabelle_System.gnutar(args, dir = dir, strip = strip).check
 
+  private def bash_java_opens(args: String*): String =
+    Bash.strings(args.toList.flatMap(arg => List("--add-opens", arg + "=ALL-UNNAMED")))
+
   object Release_Context
   {
     def apply(
@@ -490,7 +493,6 @@
     context: Release_Context,
     afp_rev: String = "",
     platform_families: List[Platform.Family.Value] = default_platform_families,
-    java_home: Path = default_java_home,
     more_components: List[Path] = Nil,
     website: Option[Path] = None,
     build_sessions: List[String] = Nil,
@@ -703,9 +705,21 @@
                     "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
                 .replace("\\jdk\\", "\\" + jdk_component + "\\"))
 
+            val java_opts =
+              bash_java_opens(
+                "java.base/java.io",
+                "java.base/java.lang",
+                "java.base/java.lang.reflect",
+                "java.base/java.text",
+                "java.base/java.util",
+                "java.desktop/java.awt.font")
+            val launch4j_jar =
+              Path.explode("windows_app/launch4j-" + Platform.family + "/launch4j.jar")
+
             execute(tmp_dir,
-              "env JAVA_HOME=" + File.bash_platform_path(java_home) +
-              " \"windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j\" isabelle.xml")
+              cat_lines(List(
+                "export LAUNCH4J=" + File.bash_platform_path(launch4j_jar),
+                "isabelle java " + java_opts + " -jar \"$LAUNCH4J\" isabelle.xml")))
 
             Isabelle_System.copy_file(app_template + Path.explode("manifest.xml"),
               isabelle_target + isabelle_exe.ext("manifest"))
@@ -841,15 +855,12 @@
 
   /** command line entry point **/
 
-  def default_java_home: Path = Path.explode("$JAVA_HOME").expand
-
   def main(args: Array[String]): Unit =
   {
     Command_Line.tool {
       var afp_rev = ""
       var components_base: Path = Components.default_components_base
       var target_dir = Path.current
-      var java_home = default_java_home
       var release_name = ""
       var source_archive = ""
       var website: Option[Path] = None
@@ -869,7 +880,6 @@
     -C DIR       base directory for Isabelle components (default: """ +
         Components.default_components_base + """)
     -D DIR       target directory (default ".")
-    -J JAVA_HOME Java version for running launch4j (e.g. version 11)
     -R RELEASE   explicit release name
     -S ARCHIVE   use existing source archive (file or URL)
     -W WEBSITE   produce minimal website in given directory
@@ -886,7 +896,6 @@
         "A:" -> (arg => afp_rev = arg),
         "C:" -> (arg => components_base = Path.explode(arg)),
         "D:" -> (arg => target_dir = Path.explode(arg)),
-        "J:" -> (arg => java_home = Path.explode(arg)),
         "R:" -> (arg => release_name = arg),
         "S:" -> (arg => source_archive = arg),
         "W:" -> (arg => website = Some(Path.explode(arg))),
@@ -933,7 +942,7 @@
         }
 
       build_release(options, context, afp_rev = afp_rev, platform_families = platform_families,
-        java_home = java_home, more_components = more_components, build_sessions = build_sessions,
+        more_components = more_components, build_sessions = build_sessions,
         build_library = build_library, parallel_jobs = parallel_jobs, website = website)
     }
   }
--- a/src/Pure/Admin/isabelle_devel.scala	Thu Dec 02 12:46:29 2021 +0100
+++ b/src/Pure/Admin/isabelle_devel.scala	Fri Dec 03 13:32:58 2021 +0100
@@ -44,7 +44,6 @@
           val context = Build_Release.Release_Context(target_dir)
           Build_Release.build_release_archive(context, rev)
           Build_Release.build_release(options, context, afp_rev = afp_rev,
-            java_home = Path.explode("$BUILD_JAVA_HOME"),
             build_sessions = List(Isabelle_System.getenv("ISABELLE_LOGIC")),
             website = Some(website_dir))
         })