updated to flatlaf-3.5.4, with fallback on 2.6 for arm64-linux;
authorwenzelm
Sat, 01 Feb 2025 22:13:49 +0100
changeset 82035 e074ba489ab0
parent 82034 1a20848a159e
child 82036 5be1b4354638
updated to flatlaf-3.5.4, with fallback on 2.6 for arm64-linux;
Admin/components/components.sha1
Admin/components/main
NEWS
etc/build.props
src/Pure/Admin/component_flatlaf.scala
src/Pure/System/isabelle_tool.scala
--- a/Admin/components/components.sha1	Sat Feb 01 20:05:06 2025 +0100
+++ b/Admin/components/components.sha1	Sat Feb 01 22:13:49 2025 +0100
@@ -123,6 +123,7 @@
 212a0f1f867511722024cc60156fd71872a16f92 flatlaf-1.6.tar.gz
 6d4dbb6f2bde5804298d9008e3edceb0b9ee20ae flatlaf-2.4.tar.gz
 31d6abd58a4c2f7522f14283dfe04e2801a6e828 flatlaf-2.6.tar.gz
+a93a98c80536a6984db118e129b1b3a778c700ce flatlaf-3.5.4.tar.gz
 b1c40ce6c087da7e70e221ddd3fcadfa569acb2f foiltex-2.1.4b.tar.gz
 f339234ec18369679be0095264e0c0af7762f351 gnu-utils-20210414.tar.gz
 71259aa46134e6cf2c6473b4fc408051b3336490 gnu-utils-20211030.tar.gz
--- a/Admin/components/main	Sat Feb 01 20:05:06 2025 +0100
+++ b/Admin/components/main	Sat Feb 01 22:13:49 2025 +0100
@@ -8,7 +8,7 @@
 elm-0.19.1
 easychair-3.5
 eptcs-1.7.0
-flatlaf-2.6
+flatlaf-3.5.4
 foiltex-2.1.4b
 idea-icons-20210508
 isabelle_fonts-20241227
--- a/NEWS	Sat Feb 01 20:05:06 2025 +0100
+++ b/NEWS	Sat Feb 01 22:13:49 2025 +0100
@@ -191,6 +191,12 @@
 
 * Update to jEdit 5.7.0, the latest release.
 
+* Update to FlatLaf 3.5.4, the latest release. 2.6 was the last portable
+version, but 3.x requires a Java jar together with a native library. The
+latter is missing for arm64-linux, so old 2.6 is used on that platform:
+this may lead to minor differences in GUI appearance and behaviour.
+
+
 
 *** Isabelle/VSCode Prover IDE ***
 
--- a/etc/build.props	Sat Feb 01 20:05:06 2025 +0100
+++ b/etc/build.props	Sat Feb 01 22:13:49 2025 +0100
@@ -25,6 +25,7 @@
   src/Pure/Admin/component_easychair.scala \
   src/Pure/Admin/component_elm.scala \
   src/Pure/Admin/component_eptcs.scala \
+  src/Pure/Admin/component_flatlaf.scala \
   src/Pure/Admin/component_foiltex.scala \
   src/Pure/Admin/component_fonts.scala \
   src/Pure/Admin/component_hol_light.scala \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/Admin/component_flatlaf.scala	Sat Feb 01 22:13:49 2025 +0100
@@ -0,0 +1,133 @@
+/*  Title:      Pure/Admin/component_flatlaf.scala
+    Author:     Makarius
+
+Build Isabelle flatlaf component from official downloads.
+*/
+
+package isabelle
+
+
+object Component_FlatLaf {
+  /* platform information */
+
+  sealed case class Platform_Info(name: String, exe: Boolean = false)
+
+  private val platforms =
+    List(
+      Platform_Info("flatlaf-{V}-macos-arm64.dylib"),
+      Platform_Info("flatlaf-{V}-macos-x86_64.dylib"),
+      Platform_Info("flatlaf-{V}-linux-x86_64.so"),
+      Platform_Info("flatlaf-{V}-windows-x86_64.dll", exe = true))
+
+
+  /* build flatlaf */
+
+  val default_download_url = "https://repo1.maven.org/maven2/com/formdev/flatlaf"
+  val default_portable_version = "2.6"
+  val default_native_version = "3.5.4"
+
+  def build_flatlaf(
+    target_dir: Path = Path.current,
+    download_url: String = default_download_url,
+    portable_version: String = default_portable_version,
+    native_version: String = default_native_version,
+    progress: Progress = new Progress,
+  ): Unit = {
+    /* component */
+
+    val component_name = "flatlaf-" + native_version
+    val component_dir =
+      Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress)
+
+
+    /* download */
+
+    Isabelle_System.make_directory(component_dir.lib)
+
+    def download(name: String, version: String, dir: Path): Path = {
+      val download_name = name.replace("{V}", version)
+      val target = dir + Path.basic(download_name)
+      Isabelle_System.download_file(
+        download_url + "/" + version + "/" + download_name, target, progress = progress)
+      target
+    }
+
+    download("flatlaf-{V}-no-natives.jar", native_version, component_dir.lib)
+    download("flatlaf-{V}.jar", portable_version, component_dir.lib)
+
+    for (platform <- platforms) {
+      val path = download(platform.name, native_version, component_dir.lib)
+      if (platform.exe) File.set_executable(path)
+    }
+
+
+    /* settings */
+
+    component_dir.write_settings("""
+ISABELLE_FLATLAF_HOME="$COMPONENT"
+
+if [ "$ISABELLE_PLATFORM64" = "arm64-linux" ]; then
+  classpath "$ISABELLE_FLATLAF_HOME/lib/flatlaf-""" + portable_version + """.jar"
+else
+  classpath "$ISABELLE_FLATLAF_HOME/lib/flatlaf-""" + native_version + """-no-natives.jar"
+fi
+
+isabelle_scala_service "isabelle.FlatLightLaf"
+isabelle_scala_service "isabelle.FlatDarkLaf"
+""")
+
+
+    /* README */
+
+    File.write(component_dir.README,
+      """This is the FlatLaf Java/Swing look-and-feel from
+https://www.formdev.com/flatlaf and
+https://mvnrepository.com/artifact/com.formdev/flatlaf
+
+It is covered by the Apache License 2.0 license.
+
+The last portable version was """ + portable_version + ", but current " + native_version +
+""" requires a Java jar
+together with a native library (e.g. in the same directory).
+
+
+        Makarius
+        """ + Date.Format.date(Date.now()) + "\n")
+  }
+
+
+  /* Isabelle tool wrapper */
+
+  val isabelle_tool =
+    Isabelle_Tool("component_flatlaf", "build Isabelle flatlaf component from official downloads",
+      Scala_Project.here,
+      { args =>
+        var target_dir = Path.current
+        var download_url = default_download_url
+        var native_version = default_native_version
+        var portable_version = default_portable_version
+
+        val getopts = Getopts("""
+Usage: isabelle component_flatlaf [OPTIONS]
+
+  Options are:
+    -D DIR       target directory (default ".")
+    -U URL       download URL (default: """ + quote(default_download_url) + """)
+    -N VERSION   native version (default: """ + quote(default_native_version) + """)
+    -P VERSION   portable version (default: """ + quote(default_portable_version) + """)
+
+  Build flatlaf component from official downloads.""",
+          "D:" -> (arg => target_dir = Path.explode(arg)),
+          "U:" -> (arg => download_url = arg),
+          "N:" -> (arg => native_version = arg),
+          "P:" -> (arg => portable_version = arg))
+
+        val more_args = getopts(args)
+        if (more_args.nonEmpty) getopts.usage()
+
+        val progress = new Console_Progress()
+
+        build_flatlaf(target_dir = target_dir, download_url = download_url,
+          portable_version = portable_version, native_version = native_version, progress = progress)
+      })
+}
--- a/src/Pure/System/isabelle_tool.scala	Sat Feb 01 20:05:06 2025 +0100
+++ b/src/Pure/System/isabelle_tool.scala	Sat Feb 01 22:13:49 2025 +0100
@@ -178,6 +178,7 @@
   Component_EPTCS.isabelle_tool,
   Component_Easychair.isabelle_tool,
   Component_Elm.isabelle_tool,
+  Component_FlatLaf.isabelle_tool,
   Component_Foiltex.isabelle_tool,
   Component_Fonts.isabelle_tool,
   Component_HOL_Light.isabelle_tool,