diff --git a/admin/etc/build.props b/admin/etc/build.props deleted file mode 100644 --- a/admin/etc/build.props +++ /dev/null @@ -1,5 +0,0 @@ -title = Afp/Admin -module = $AFP_BASE/tools/lib/classes/afp_admin.jar -requirements = \ - env:ISABELLE_SCALA_JAR -services = afp.Admin_Tools diff --git a/etc/build.props b/etc/build.props --- a/etc/build.props +++ b/etc/build.props @@ -1,26 +1,25 @@ title = AFP/Tools module = $AFP_BASE/tools/lib/classes/afp_tools.jar requirements = \ env:ISABELLE_SCALA_JAR \ $ISABELLE_CI_EXTRAS_JAR sources = \ - tools/admin/afp_component_hugo.scala \ tools/afp_build.scala \ tools/afp_check_metadata.scala \ tools/afp_check_roots.scala \ tools/afp_dependencies.scala \ tools/afp_release.scala \ tools/afp_site_gen.scala \ tools/afp_submit.scala \ tools/afp_structure.scala \ tools/afp_tool.scala \ tools/hugo.scala \ tools/metadata.scala \ tools/rake.scala \ tools/utils.scala \ tools/web_app.scala resources = \ tools/SmartStoplist.txt:SmartStoplist.txt services = \ afp.Tools \ afp.CI_Builds diff --git a/tools/admin/afp_component_hugo.scala b/tools/admin/afp_component_hugo.scala deleted file mode 100644 --- a/tools/admin/afp_component_hugo.scala +++ /dev/null @@ -1,125 +0,0 @@ -/* Author: Fabian Huch, TU Muenchen - -Build Isabelle component for hugo site generator. See also: - - - https://gohugo.io - - https://github.com/gohugoio/hugo - */ - -package afp - - -import isabelle._ - - -object AFP_Component_Hugo { - /* platform information */ - - sealed case class Download_Platform(platform_name: String, url_template: String) { - override def toString: String = platform_name - - def is_windows: Boolean = url_template.contains("windows") - def url(base_url: String, version: String): String = - base_url + "/v" + version + "/" + url_template.replace("{V}", version) - } - - val platforms: List[Download_Platform] = - List( - Download_Platform("arm64-darwin", "hugo_extended_{V}_darwin-universal.tar.gz"), - Download_Platform("arm64-linux", "hugo_extended_{V}_linux-arm64.tar.gz"), - Download_Platform("x86_64-darwin", "hugo_extended_{V}_darwin-universal.tar.gz"), - Download_Platform("x86_64-linux", "hugo_extended_{V}_linux-amd64.tar.gz"), - Download_Platform("x86_64-windows", "hugo_extended_{V}_windows-amd64.zip")) - - - /* build hugo */ - - val default_url = "https://github.com/gohugoio/hugo/releases/download" - val default_version = "0.119.0" - - def build_hugo( - base_url: String = default_url, - version: String = default_version, - target_dir: Path = Path.current, - progress: Progress = new Progress - ): Unit = { - /* component */ - - val component = "hugo-" + 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 url = platform.url(base_url, version) - val name = Library.take_suffix(_ != '/', url.toList)._2.mkString - - val exe = Path.basic("hugo").exe_if(platform.is_windows) - - 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(name) - - Isabelle_System.download_file(url, archive_file, progress = progress) - Isabelle_System.extract(archive_file, tmp_dir) - Isabelle_System.move_file(tmp_dir + exe, platform_dir) - Isabelle_System.move_file(tmp_dir + Path.basic("LICENSE"), component_dir.LICENSE) - File.set_executable(platform_dir + exe) - } - } - } - - - /* settings */ - - component_dir.write_settings(""" -ISABELLE_HUGO="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}}" -""") - - - /* README */ - - File.write(component_dir.README, - """This Isabelle components provides a hugo extended """ + version + """. - -See also https://gohugo.io and executables from """ + base_url + """ - - Fabian - """ + Date.Format.date(Date.now()) + "\n") - } - - val isabelle_tool = - Isabelle_Tool("afp_component_hugo", "build afp hugo component", Scala_Project.here, - { args => - var target_dir = Path.current - var base_url = default_url - var version = default_version - - val getopts = Getopts(""" -Usage: isabelle afp_component_hugo [OPTIONS] - - Options are: - -D DIR target directory (default ".") - -U URL download URL (default: """" + default_url + """") - -V VERSION version (default: """" + default_version + """") - - Build extended hugo 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_hugo(base_url = base_url, version = version, target_dir = target_dir, - progress = progress) - }) -} \ No newline at end of file diff --git a/tools/afp_tool.scala b/tools/afp_tool.scala --- a/tools/afp_tool.scala +++ b/tools/afp_tool.scala @@ -1,16 +1,13 @@ package afp import isabelle._ -class Admin_Tools extends Isabelle_Scala_Tools( - AFP_Component_Hugo.isabelle_tool) - class Tools extends Isabelle_Scala_Tools( AFP_Site_Gen.isabelle_tool, AFP_Check_Roots.isabelle_tool, AFP_Check_Metadata.isabelle_tool, AFP_Dependencies.isabelle_tool, AFP_Release.isabelle_tool, AFP_Submit.isabelle_tool)