# HG changeset patch # User wenzelm # Date 1736628666 -3600 # Node ID eb40020efda75d994653448e66c7b1ba0c55ea37 # Parent fcba3250fb2a81d8787df3752d2effa8ff744136 activate admin tools; clarified elm settings; diff -r fcba3250fb2a -r eb40020efda7 etc/build.props --- a/etc/build.props Sat Jan 11 21:31:13 2025 +0100 +++ b/etc/build.props Sat Jan 11 21:51:06 2025 +0100 @@ -23,6 +23,7 @@ src/Pure/Admin/component_cygwin.scala \ src/Pure/Admin/component_e.scala \ src/Pure/Admin/component_easychair.scala \ + src/Pure/Admin/component_elm.scala \ src/Pure/Admin/component_eptcs.scala \ src/Pure/Admin/component_foiltex.scala \ src/Pure/Admin/component_fonts.scala \ @@ -42,6 +43,7 @@ src/Pure/Admin/component_prismjs.scala \ src/Pure/Admin/component_rsync.scala \ src/Pure/Admin/component_scala.scala \ + src/Pure/Admin/component_solr.scala \ src/Pure/Admin/component_spass.scala \ src/Pure/Admin/component_sqlite.scala \ src/Pure/Admin/component_stack.scala \ diff -r fcba3250fb2a -r eb40020efda7 src/Pure/Admin/component_elm.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/Admin/component_elm.scala Sat Jan 11 21:51:06 2025 +0100 @@ -0,0 +1,127 @@ +/* Author: Fabian Huch, TU Muenchen + +Build Isabelle Elm component from official downloads. See also: https://elm-lang.org/ +*/ + +package isabelle + + +object Component_Elm { + /* platform information */ + + sealed case class Download_Platform(platform_name: String, file_name: String) { + override def toString: String = platform_name + + def archive_name = file_name + ".gz" + def download(base_url: String, version: String): String = + base_url + "/" + version + "/" + archive_name + } + + val platforms: List[Download_Platform] = + List( + Download_Platform("arm64-darwin", "binary-for-mac-64-bit-ARM"), + Download_Platform("x86_64-darwin", "binary-for-mac-64-bit"), + Download_Platform("x86_64-linux", "binary-for-linux-64-bit"), + Download_Platform("x86_64-windows", "binary-for-windows-64-bit")) + + + /* build elm */ + + val default_url = "https://github.com/elm/compiler/releases/download" + val default_version = "0.19.1" + + def build_elm( + base_url: String = default_url, + version: String = default_version, + target_dir: Path = Path.current, + progress: Progress = new Progress + ): Unit = { + Isabelle_System.require_command("gunzip") + + + /* component */ + + val component = "elm-" + version + val component_dir = + Components.Directory(target_dir + Path.basic(component)).create(progress = progress) + + + /* download */ + + for (platform <- platforms) { + val platform_dir = + Isabelle_System.make_directory(component_dir.path + Path.basic(platform.platform_name)) + + val exe = Path.basic("elm") + val download = platform.download(base_url, version) + + Isabelle_System.with_tmp_dir("download", component_dir.path.file) { download_dir => + Isabelle_System.with_tmp_dir("tmp", component_dir.path.file) { tmp_dir => + val archive_file = download_dir + Path.basic(platform.archive_name) + + Isabelle_System.download_file(download, archive_file, progress = progress) + Isabelle_System.bash("gunzip " + File.bash_path(archive_file)) + Isabelle_System.copy_file(archive_file.drop_ext, platform_dir + exe) + File.set_executable(platform_dir + exe) + } + } + } + + /* license */ + + File.write( + component_dir.LICENSE, + Url.read("https://raw.githubusercontent.com/elm/compiler/master/LICENSE")) + + + /* settings */ + + component_dir.write_settings(""" +ISABELLE_ELM_HOME="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}}" +""") + + + /* README */ + + File.write(component_dir.README, + """This Isabelle component provides elm """ + version + """. + +See also https://elm-lang.org and executables from """ + base_url + """ + + Fabian Huch + """ + Date.Format.date(Date.now()) + "\n") + } + + + /* Isabelle tool wrapper */ + + val isabelle_tool = + Isabelle_Tool("component_elm", "build elm component", Scala_Project.here, + { args => + var target_dir = Path.current + var base_url = default_url + var version = default_version + + val getopts = Getopts(""" +Usage: isabelle component_elm [OPTIONS] + + Options are: + -D DIR target directory (default ".") + -U URL download URL (default: """" + default_url + """") + -V VERSION version (default: """" + default_version + """") + + Build elm component. +""", + "D:" -> (arg => target_dir = Path.explode(arg)), + "U:" -> (arg => base_url = arg), + "V:" -> (arg => version = arg)) + + val more_args = getopts(args) + if (more_args.nonEmpty) getopts.usage() + + val progress = new Console_Progress() + + build_elm(base_url = base_url, version = version, target_dir = target_dir, + progress = progress) + }) +} \ No newline at end of file diff -r fcba3250fb2a -r eb40020efda7 src/Pure/Admin/component_solr.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/Admin/component_solr.scala Sat Jan 11 21:51:06 2025 +0100 @@ -0,0 +1,125 @@ +/* Author: Fabian Huch, TU Muenchen + +Build Isabelle Solr component from official downloads. See also: https://solr.apache.org/ +*/ + +package isabelle + + +object Component_Solr { + val default_download_url = "https://dlcdn.apache.org/solr/solr/9.6.1/solr-9.6.1.tgz" + + + /* build solr */ + + def build_solr( + download_url: String = default_download_url, + progress: Progress = new Progress, + target_dir: Path = Path.current + ): Unit = + Isabelle_System.with_tmp_dir("build") { tmp_dir => + /* component */ + + val Archive_Name = """^.*/([^/]+)$""".r + val Version = """^solr-(.*)\.tgz$""".r + + val archive_name = + download_url match { + case Archive_Name(name) => name + case _ => error("Failed to determine source archive name from " + quote(download_url)) + } + + val version = + archive_name match { + case Version(version) => version + case _ => error("Failed to determine component version from " + quote(archive_name)) + } + + val component_name = "solr-" + version + val component_dir = + Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress) + + + /* download */ + + val archive_path = tmp_dir + Path.basic(archive_name) + Isabelle_System.download_file(download_url, archive_path, progress = progress) + + Isabelle_System.extract(archive_path, tmp_dir) + val source_dir = File.get_dir(tmp_dir, title = download_url) + + Isabelle_System.copy_file(source_dir + Path.explode("LICENSE.txt"), component_dir.path) + + val webapp_lib_dir = source_dir + Path.explode("server/solr-webapp/webapp/WEB-INF/lib") + val server_lib_dir = source_dir + Path.explode("server/lib") + + + /* jars */ + + Isabelle_System.make_directory(component_dir.lib) + + val compile = List("solr-solrj", "solr-api", "solr-core") + + val jars = + File.find_files(webapp_lib_dir.file, _.getName.endsWith(".jar")) ++ + File.find_files(server_lib_dir.file, _.getName.endsWith(".jar")) + + for (jar <- jars) Isabelle_System.copy_file(jar, component_dir.lib.file) + + + /* settings */ + + def jar_path(file: String): String = "$SOLR_HOME/lib/" + file + + component_dir.write_settings(""" +SOLR_HOME="$COMPONENT" +SOLR_JARS=""" + quote(compile.map(_ + "-" + version + ".jar").map(jar_path).mkString(":")) + """ +classpath """ + quote(File.read_dir(component_dir.lib).map(jar_path).mkString(":")) + """ + +SOLR_LUCENE_VERSION="9.10" +SOLR_SCHEMA_VERSION="1.6" +""") + + + /* README */ + + File.write(component_dir.README, + "This Isabelle component provides Solr " + version + " jars from\n" + download_url + """ + + Fabian + """ + Date.Format.date(Date.now()) + "\n") + } + + + /* Isabelle tool wrapper */ + + val isabelle_tool = + Isabelle_Tool("component_solr", "build Isabelle solr jar distribution", Scala_Project.here, + { args => + var target_dir = Path.current + var download_url = default_download_url + var verbose = false + + val getopts = Getopts(""" +Usage: isabelle component_solr [OPTIONS] + + Options are: + -D DIR target directory (default ".") + -U URL download URL + (default: """" + default_download_url + """") + -v verbose + + Build solr component from official download. +""", + "D:" -> (arg => target_dir = Path.explode(arg)), + "U:" -> (arg => download_url = arg), + "v" -> (_ => verbose = true)) + + val more_args = getopts(args) + if (more_args.nonEmpty) getopts.usage() + + val progress = new Console_Progress(verbose = verbose) + + build_solr(download_url = download_url, progress = progress, target_dir = target_dir) + }) +} diff -r fcba3250fb2a -r eb40020efda7 src/Pure/System/isabelle_tool.scala --- a/src/Pure/System/isabelle_tool.scala Sat Jan 11 21:31:13 2025 +0100 +++ b/src/Pure/System/isabelle_tool.scala Sat Jan 11 21:51:06 2025 +0100 @@ -177,6 +177,7 @@ Component_E.isabelle_tool, Component_EPTCS.isabelle_tool, Component_Easychair.isabelle_tool, + Component_Elm.isabelle_tool, Component_Foiltex.isabelle_tool, Component_Fonts.isabelle_tool, Component_Hugo.isabelle_tool, @@ -198,6 +199,7 @@ Component_SPASS.isabelle_tool, Component_SQLite.isabelle_tool, Component_Scala.isabelle_tool, + Component_Solr.isabelle_tool, Component_Stack.isabelle_tool, Component_Vampire.isabelle_tool, Component_VeriT.isabelle_tool, diff -r fcba3250fb2a -r eb40020efda7 src/Tools/Find_Facts/component_elm.scala --- a/src/Tools/Find_Facts/component_elm.scala Sat Jan 11 21:31:13 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* Author: Fabian Huch, TU Muenchen - -Build Isabelle Elm component from official downloads. See also: https://elm-lang.org/ -*/ - -package isabelle - - -object Component_Elm { - /* platform information */ - - sealed case class Download_Platform(platform_name: String, file_name: String) { - override def toString: String = platform_name - - def archive_name = file_name + ".gz" - def download(base_url: String, version: String): String = - base_url + "/" + version + "/" + archive_name - } - - val platforms: List[Download_Platform] = - List( - Download_Platform("arm64-darwin", "binary-for-mac-64-bit-ARM"), - Download_Platform("x86_64-darwin", "binary-for-mac-64-bit"), - Download_Platform("x86_64-linux", "binary-for-linux-64-bit"), - Download_Platform("x86_64-windows", "binary-for-windows-64-bit")) - - - /* build elm */ - - val default_url = "https://github.com/elm/compiler/releases/download" - val default_version = "0.19.1" - - def build_elm( - base_url: String = default_url, - version: String = default_version, - target_dir: Path = Path.current, - progress: Progress = new Progress - ): Unit = { - Isabelle_System.require_command("gunzip") - - - /* component */ - - val component = "elm-" + version - val component_dir = - Components.Directory(target_dir + Path.basic(component)).create(progress = progress) - - - /* download */ - - for (platform <- platforms) { - val platform_dir = - Isabelle_System.make_directory(component_dir.path + Path.basic(platform.platform_name)) - - val exe = Path.basic("elm") - val download = platform.download(base_url, version) - - Isabelle_System.with_tmp_dir("download", component_dir.path.file) { download_dir => - Isabelle_System.with_tmp_dir("tmp", component_dir.path.file) { tmp_dir => - val archive_file = download_dir + Path.basic(platform.archive_name) - - Isabelle_System.download_file(download, archive_file, progress = progress) - Isabelle_System.bash("gunzip " + File.bash_path(archive_file)) - Isabelle_System.copy_file(archive_file.drop_ext, platform_dir + exe) - File.set_executable(platform_dir + exe) - } - } - } - - /* license */ - - File.write( - component_dir.LICENSE, - Url.read("https://raw.githubusercontent.com/elm/compiler/master/LICENSE")) - - - /* settings */ - - component_dir.write_settings(""" -ISABELLE_ELM="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}}" -""") - - - /* README */ - - File.write(component_dir.README, - """This Isabelle component provides elm """ + version + """. - -See also https://elm-lang.org and executables from """ + base_url + """ - - Fabian Huch - """ + Date.Format.date(Date.now()) + "\n") - } - - - /* Isabelle tool wrapper */ - - val isabelle_tool = - Isabelle_Tool("component_elm", "build elm component", Scala_Project.here, - { args => - var target_dir = Path.current - var base_url = default_url - var version = default_version - - val getopts = Getopts(""" -Usage: isabelle component_elm [OPTIONS] - - Options are: - -D DIR target directory (default ".") - -U URL download URL (default: """" + default_url + """") - -V VERSION version (default: """" + default_version + """") - - Build elm component. -""", - "D:" -> (arg => target_dir = Path.explode(arg)), - "U:" -> (arg => base_url = arg), - "V:" -> (arg => version = arg)) - - val more_args = getopts(args) - if (more_args.nonEmpty) getopts.usage() - - val progress = new Console_Progress() - - build_elm(base_url = base_url, version = version, target_dir = target_dir, - progress = progress) - }) -} \ No newline at end of file diff -r fcba3250fb2a -r eb40020efda7 src/Tools/Find_Facts/component_solr.scala --- a/src/Tools/Find_Facts/component_solr.scala Sat Jan 11 21:31:13 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* Author: Fabian Huch, TU Muenchen - -Build Isabelle Solr component from official downloads. See also: https://solr.apache.org/ -*/ - -package isabelle - - -object Component_Solr { - val default_download_url = "https://dlcdn.apache.org/solr/solr/9.6.1/solr-9.6.1.tgz" - - - /* build solr */ - - def build_solr( - download_url: String = default_download_url, - progress: Progress = new Progress, - target_dir: Path = Path.current - ): Unit = - Isabelle_System.with_tmp_dir("build") { tmp_dir => - /* component */ - - val Archive_Name = """^.*/([^/]+)$""".r - val Version = """^solr-(.*)\.tgz$""".r - - val archive_name = - download_url match { - case Archive_Name(name) => name - case _ => error("Failed to determine source archive name from " + quote(download_url)) - } - - val version = - archive_name match { - case Version(version) => version - case _ => error("Failed to determine component version from " + quote(archive_name)) - } - - val component_name = "solr-" + version - val component_dir = - Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress) - - - /* download */ - - val archive_path = tmp_dir + Path.basic(archive_name) - Isabelle_System.download_file(download_url, archive_path, progress = progress) - - Isabelle_System.extract(archive_path, tmp_dir) - val source_dir = File.get_dir(tmp_dir, title = download_url) - - Isabelle_System.copy_file(source_dir + Path.explode("LICENSE.txt"), component_dir.path) - - val webapp_lib_dir = source_dir + Path.explode("server/solr-webapp/webapp/WEB-INF/lib") - val server_lib_dir = source_dir + Path.explode("server/lib") - - - /* jars */ - - Isabelle_System.make_directory(component_dir.lib) - - val compile = List("solr-solrj", "solr-api", "solr-core") - - val jars = - File.find_files(webapp_lib_dir.file, _.getName.endsWith(".jar")) ++ - File.find_files(server_lib_dir.file, _.getName.endsWith(".jar")) - - for (jar <- jars) Isabelle_System.copy_file(jar, component_dir.lib.file) - - - /* settings */ - - def jar_path(file: String): String = "$SOLR_HOME/lib/" + file - - component_dir.write_settings(""" -SOLR_HOME="$COMPONENT" -SOLR_JARS=""" + quote(compile.map(_ + "-" + version + ".jar").map(jar_path).mkString(":")) + """ -classpath """ + quote(File.read_dir(component_dir.lib).map(jar_path).mkString(":")) + """ - -SOLR_LUCENE_VERSION="9.10" -SOLR_SCHEMA_VERSION="1.6" -""") - - - /* README */ - - File.write(component_dir.README, - "This Isabelle component provides Solr " + version + " jars from\n" + download_url + """ - - Fabian - """ + Date.Format.date(Date.now()) + "\n") - } - - - /* Isabelle tool wrapper */ - - val isabelle_tool = - Isabelle_Tool("component_solr", "build Isabelle solr jar distribution", Scala_Project.here, - { args => - var target_dir = Path.current - var download_url = default_download_url - var verbose = false - - val getopts = Getopts(""" -Usage: isabelle component_solr [OPTIONS] - - Options are: - -D DIR target directory (default ".") - -U URL download URL - (default: """" + default_download_url + """") - -v verbose - - Build solr component from official download. -""", - "D:" -> (arg => target_dir = Path.explode(arg)), - "U:" -> (arg => download_url = arg), - "v" -> (_ => verbose = true)) - - val more_args = getopts(args) - if (more_args.nonEmpty) getopts.usage() - - val progress = new Console_Progress(verbose = verbose) - - build_solr(download_url = download_url, progress = progress, target_dir = target_dir) - }) -} diff -r fcba3250fb2a -r eb40020efda7 src/Tools/Find_Facts/elm.scala --- a/src/Tools/Find_Facts/elm.scala Sat Jan 11 21:31:13 2025 +0100 +++ b/src/Tools/Find_Facts/elm.scala Sat Jan 11 21:51:06 2025 +0100 @@ -14,10 +14,7 @@ object Elm { - private lazy val elm_home = - proper_string(Isabelle_System.getenv("ISABELLE_ELM")).getOrElse(error("No elm component found")) - - private lazy val exec = Path.explode(elm_home) + Path.basic("elm") + private lazy val exec = Path.explode("$ISABELLE_ELM_HOME/elm").expand object Project { def apply( diff -r fcba3250fb2a -r eb40020efda7 src/Tools/Find_Facts/find_facts_tools.scala --- a/src/Tools/Find_Facts/find_facts_tools.scala Sat Jan 11 21:31:13 2025 +0100 +++ b/src/Tools/Find_Facts/find_facts_tools.scala Sat Jan 11 21:51:06 2025 +0100 @@ -1,8 +1,6 @@ package isabelle class Find_Facts_Tools extends Isabelle_Scala_Tools( - Component_Elm.isabelle_tool, - Component_Solr.isabelle_tool, Find_Facts.isabelle_tool, Find_Facts.isabelle_tool1, Find_Facts.isabelle_tool2)