| author | wenzelm | 
| Wed, 22 Jun 2022 17:07:00 +0200 | |
| changeset 75597 | e6e0a95f87f3 | 
| parent 75491 | 47d790984e82 | 
| child 75906 | 2167b9e3157a | 
| permissions | -rw-r--r-- | 
| 73653 | 1 | /* Title: Pure/Admin/build_jedit.scala | 
| 2 | Author: Makarius | |
| 3 | ||
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 4 | Build component for jEdit text-editor. | 
| 73653 | 5 | */ | 
| 6 | ||
| 7 | package isabelle | |
| 8 | ||
| 9 | ||
| 73983 | 10 | import java.nio.charset.Charset | 
| 11 | ||
| 12 | import scala.jdk.CollectionConverters._ | |
| 13 | ||
| 14 | ||
| 75393 | 15 | object Build_JEdit {
 | 
| 73660 | 16 | /* modes */ | 
| 17 | ||
| 75393 | 18 |   object Mode {
 | 
| 73660 | 19 |     val empty: Mode = new Mode("", "", Nil)
 | 
| 20 | ||
| 21 | val init: Mode = | |
| 22 | empty + | |
| 23 |         ("noWordSep" -> """_'?⇩\^<>""") +
 | |
| 24 |         ("unalignedOpenBrackets" -> "{[(«‹⟨⌈⌊⦇⟦⦃⦉") +
 | |
| 25 |         ("unalignedCloseBrackets" -> "⦊⦄⟧⦈⌋⌉⟩›»)]}") +
 | |
| 26 |         ("tabSize" -> "2") +
 | |
| 27 |         ("indentSize" -> "2")
 | |
| 28 | ||
| 75393 | 29 |     val list: List[Mode] = {
 | 
| 73660 | 30 |       val isabelle_news: Mode = init.define("isabelle-news", "Isabelle NEWS")
 | 
| 31 | ||
| 32 | val isabelle: Mode = | |
| 33 |         init.define("isabelle", "Isabelle theory") +
 | |
| 34 |           ("commentStart" -> "(*") +
 | |
| 35 |           ("commentEnd" -> "*)")
 | |
| 36 | ||
| 37 |       val isabelle_ml: Mode = isabelle.define("isabelle-ml", "Isabelle/ML")
 | |
| 38 | ||
| 39 |       val isabelle_root: Mode = isabelle.define("isabelle-root", "Isabelle session root")
 | |
| 40 | ||
| 41 |       val isabelle_options: Mode = isabelle.define("isabelle-options", "Isabelle options")
 | |
| 42 | ||
| 43 | val sml: Mode = | |
| 44 |         init.define("sml", "Standard ML") +
 | |
| 45 |           ("commentStart" -> "(*") +
 | |
| 46 |           ("commentEnd" -> "*)") +
 | |
| 47 |           ("noWordSep" -> "_'")
 | |
| 48 | ||
| 49 | List(isabelle_news, isabelle, isabelle_ml, isabelle_root, isabelle_options, sml) | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 75393 | 53 |   final case class Mode private(name: String, description: String, rev_props: Properties.T) {
 | 
| 73660 | 54 | override def toString: String = name | 
| 55 | ||
| 56 | def define(a: String, b: String): Mode = new Mode(a, b, rev_props) | |
| 57 | ||
| 58 | def + (entry: Properties.Entry): Mode = | |
| 59 | new Mode(name, description, Properties.put(rev_props, entry)) | |
| 60 | ||
| 75393 | 61 |     def write(dir: Path): Unit = {
 | 
| 73660 | 62 | require(name.nonEmpty && description.nonEmpty, "Bad Isabelle/jEdit mode content") | 
| 63 | ||
| 64 | val properties = | |
| 65 | rev_props.reverse.map(p => | |
| 66 | Symbol.spaces(4) + | |
| 67 |           XML.string_of_tree(XML.elem(Markup("PROPERTY", List("NAME" -> p._1, "VALUE" -> p._2)))))
 | |
| 68 | ||
| 69 | File.write(dir + Path.basic(name).xml, | |
| 70 | """<?xml version="1.0" encoding="UTF-8"?> | |
| 71 | <!DOCTYPE MODE SYSTEM "xmode.dtd"> | |
| 72 | ||
| 73 | <!-- """ + XML.text(description) + """ mode --> | |
| 74 | <MODE> | |
| 73665 | 75 |   <PROPS>""" + properties.mkString("\n", "\n", "") + """
 | 
| 73660 | 76 | </PROPS> | 
| 77 | </MODE> | |
| 78 | """) | |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | ||
| 73653 | 83 | /* build jEdit component */ | 
| 84 | ||
| 85 | private val download_jars: List[(String, String)] = | |
| 86 | List( | |
| 87 | "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" -> | |
| 88 | "jsr305-3.0.2.jar") | |
| 89 | ||
| 90 | private val download_plugins: List[(String, String)] = | |
| 91 | List( | |
| 92 | "Code2HTML" -> "0.7", | |
| 93 | "CommonControls" -> "1.7.4", | |
| 94 | "Console" -> "5.1.4", | |
| 95 | "ErrorList" -> "2.4.0", | |
| 74548 | 96 | "Highlight" -> "2.5", | 
| 73653 | 97 | "Navigator" -> "2.7", | 
| 98 | "SideKick" -> "1.8") | |
| 99 | ||
| 74104 | 100 | private def exclude_package(name: String): Boolean = | 
| 101 |     name.startsWith("de.masters_of_disaster.ant") ||
 | |
| 102 | name == "doclet" || | |
| 103 | name == "installer" | |
| 104 | ||
| 73653 | 105 | def build_jedit( | 
| 106 | component_dir: Path, | |
| 107 | version: String, | |
| 108 | original: Boolean = false, | |
| 109 | java_home: Path = default_java_home, | |
| 75393 | 110 | progress: Progress = new Progress | 
| 111 |   ): Unit = {
 | |
| 73653 | 112 |     Isabelle_System.require_command("ant", test = "-version")
 | 
| 113 |     Isabelle_System.require_command("patch")
 | |
| 114 |     Isabelle_System.require_command("unzip", test = "-h")
 | |
| 115 | ||
| 116 | Isabelle_System.new_directory(component_dir) | |
| 117 | ||
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 118 |     val etc_dir = Isabelle_System.make_directory(component_dir + Path.explode("etc"))
 | 
| 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 119 | |
| 73653 | 120 | |
| 121 | /* jEdit directory */ | |
| 122 | ||
| 123 | val jedit = "jedit" + version | |
| 124 | val jedit_patched = jedit + "-patched" | |
| 125 | ||
| 126 | val jedit_dir = Isabelle_System.make_directory(component_dir + Path.basic(jedit)) | |
| 127 | val jedit_patched_dir = component_dir + Path.basic(jedit_patched) | |
| 128 | ||
| 75393 | 129 |     def download_jedit(dir: Path, name: String, target_name: String = ""): Path = {
 | 
| 73653 | 130 | val jedit_name = jedit + name | 
| 131 | val url = | |
| 132 | "https://sourceforge.net/projects/jedit/files/jedit/" + | |
| 133 | version + "/" + jedit_name + "/download" | |
| 73660 | 134 | val path = dir + Path.basic(proper_string(target_name) getOrElse jedit_name) | 
| 73653 | 135 | Isabelle_System.download_file(url, path, progress = progress) | 
| 136 | path | |
| 137 | } | |
| 138 | ||
| 75491 | 139 |     Isabelle_System.with_tmp_dir("build") { tmp_dir =>
 | 
| 73653 | 140 | /* original version */ | 
| 141 | ||
| 142 | val install_path = download_jedit(tmp_dir, "install.jar") | |
| 143 |       Isabelle_System.bash("""export CLASSPATH=""
 | |
| 144 | isabelle_java java -Duser.home=""" + File.bash_platform_path(tmp_dir) + | |
| 145 | " -jar " + File.bash_platform_path(install_path) + " auto " + | |
| 146 | File.bash_platform_path(jedit_dir) + " unix-script=off unix-man=off").check | |
| 147 | ||
| 148 | val source_path = download_jedit(tmp_dir, "source.tar.bz2") | |
| 149 |       Isabelle_System.gnutar("-xjf " + File.bash_path(source_path), dir = jedit_dir).check
 | |
| 150 | ||
| 151 | ||
| 152 | /* patched version */ | |
| 153 | ||
| 154 | Isabelle_System.copy_dir(jedit_dir, jedit_patched_dir) | |
| 155 | ||
| 156 |       val source_dir = jedit_patched_dir + Path.basic("jEdit")
 | |
| 74660 
a755733c1eb5
suppress sources from jEdit/test, which prevent regular build of the generated scala_project;
 wenzelm parents: 
74548diff
changeset | 157 |       val org_source_dir = source_dir + Path.basic("org")
 | 
| 73653 | 158 |       val tmp_source_dir = tmp_dir + Path.basic("jEdit")
 | 
| 159 | ||
| 160 |       progress.echo("Patching jEdit sources ...")
 | |
| 161 |       for {
 | |
| 162 |         file <- File.find_files(Path.explode("~~/src/Tools/jEdit/patches").file).iterator
 | |
| 163 | name = file.getName | |
| 164 |         if !name.endsWith("~") && !name.endsWith(".orig")
 | |
| 165 |       } {
 | |
| 166 |         progress.bash("patch -p2 < " + File.bash_path(File.path(file)),
 | |
| 167 | cwd = source_dir.file, echo = true).check | |
| 168 | } | |
| 169 | ||
| 73660 | 170 |       for { theme <- List("classic", "tango") } {
 | 
| 171 |         val path = Path.explode("org/gjt/sp/jedit/icons/themes/" + theme + "/32x32/apps/isabelle.gif")
 | |
| 172 |         Isabelle_System.copy_file(Path.explode("~~/lib/logo/isabelle_transparent-32.gif"),
 | |
| 173 | source_dir + path) | |
| 174 | } | |
| 175 | ||
| 73653 | 176 |       progress.echo("Building jEdit ...")
 | 
| 177 | Isabelle_System.copy_dir(source_dir, tmp_source_dir) | |
| 178 |       progress.bash("env JAVA_HOME=" + File.bash_platform_path(java_home) + " ant",
 | |
| 179 | cwd = tmp_source_dir.file, echo = true).check | |
| 180 |       Isabelle_System.copy_file(tmp_source_dir + Path.explode("build/jedit.jar"), jedit_patched_dir)
 | |
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 181 | |
| 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 182 | val java_sources = | 
| 74104 | 183 |         for {
 | 
| 74660 
a755733c1eb5
suppress sources from jEdit/test, which prevent regular build of the generated scala_project;
 wenzelm parents: 
74548diff
changeset | 184 |           file <- File.find_files(org_source_dir.file, file => file.getName.endsWith(".java"))
 | 
| 74104 | 185 | package_name <- Scala_Project.package_name(File.path(file)) | 
| 186 | if !exclude_package(package_name) | |
| 75221 | 187 | } yield File.path(component_dir.java_path.relativize(file.toPath).toFile).implode | 
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 188 | |
| 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 189 |       File.write(etc_dir + Path.explode("build.props"),
 | 
| 74057 | 190 | "module = " + jedit_patched + "/jedit.jar\n" + | 
| 191 | "no_build = true\n" + | |
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 192 | "requirements = env:JEDIT_JARS\n" + | 
| 75221 | 193 |         ("sources =" :: java_sources.sorted.map("  " + _)).mkString("", " \\\n", "\n"))
 | 
| 75394 | 194 | } | 
| 73653 | 195 | |
| 196 | ||
| 197 | /* jars */ | |
| 198 | ||
| 199 |     val jars_dir = Isabelle_System.make_directory(jedit_patched_dir + Path.basic("jars"))
 | |
| 200 | ||
| 201 |     for { (url, name) <- download_jars } {
 | |
| 202 | Isabelle_System.download_file(url, jars_dir + Path.basic(name), progress = progress) | |
| 203 | } | |
| 204 | ||
| 205 |     for { (name, vers) <- download_plugins } {
 | |
| 75394 | 206 |       Isabelle_System.with_tmp_file("tmp", ext = "zip") { zip_path =>
 | 
| 73653 | 207 | val url = | 
| 208 | "https://sourceforge.net/projects/jedit-plugins/files/" + name + "/" + vers + "/" + | |
| 209 | name + "-" + vers + "-bin.zip/download" | |
| 210 | Isabelle_System.download_file(url, zip_path, progress = progress) | |
| 211 |         Isabelle_System.bash("unzip -x " + File.bash_path(zip_path), cwd = jars_dir.file).check
 | |
| 75394 | 212 | } | 
| 73653 | 213 | } | 
| 214 | ||
| 215 | ||
| 73660 | 216 | /* resources */ | 
| 217 | ||
| 73983 | 218 |     val keep_encodings = List("ISO-8859-1", "ISO-8859-15", "US-ASCII", "UTF-8", "windows-1252")
 | 
| 219 | val drop_encodings = | |
| 220 | Charset.availableCharsets().keySet().asScala.toList.sorted.filterNot(keep_encodings.contains) | |
| 221 | ||
| 73660 | 222 |     File.write(jedit_patched_dir + Path.explode("properties/jEdit.props"),
 | 
| 223 | """#jEdit properties | |
| 224 | autoReloadDialog=false | |
| 225 | buffer.deepIndent=false | |
| 226 | buffer.encoding=UTF-8-Isabelle | |
| 227 | buffer.indentSize=2 | |
| 228 | buffer.lineSeparator=\n | |
| 229 | buffer.maxLineLen=100 | |
| 230 | buffer.noTabs=true | |
| 231 | buffer.sidekick.keystroke-parse=false | |
| 232 | buffer.tabSize=2 | |
| 233 | buffer.undoCount=1000 | |
| 234 | close-docking-area.shortcut2=C+e C+CIRCUMFLEX | |
| 235 | complete-word.shortcut= | |
| 236 | console.dock-position=floating | |
| 237 | console.encoding=UTF-8 | |
| 238 | console.font=Isabelle DejaVu Sans Mono | |
| 239 | console.fontsize=14 | |
| 240 | delete-line.shortcut=A+d | |
| 241 | delete.shortcut2=C+d | |
| 73983 | 242 | """ + drop_encodings.map(a => "encoding.opt-out." + a + "=true").mkString("\n") + """
 | 
| 73660 | 243 | encodingDetectors=BOM XML-PI buffer-local-property | 
| 244 | end.shortcut= | |
| 245 | expand-abbrev.shortcut2=CA+SPACE | |
| 246 | expand-folds.shortcut= | |
| 247 | fallbackEncodings=UTF-8 ISO-8859-15 US-ASCII | |
| 248 | firstTime=false | |
| 249 | focus-buffer-switcher.shortcut2=A+CIRCUMFLEX | |
| 250 | foldPainter=Circle | |
| 251 | gatchan.highlight.overview=false | |
| 252 | helpviewer.font=Isabelle DejaVu Serif | |
| 253 | helpviewer.fontsize=12 | |
| 254 | home.shortcut= | |
| 255 | hypersearch-results.dock-position=right | |
| 256 | insert-newline-indent.shortcut= | |
| 257 | insert-newline.shortcut= | |
| 258 | isabelle-debugger.dock-position=floating | |
| 259 | isabelle-documentation.dock-position=left | |
| 260 | isabelle-export-browser.label=Browse theory exports | |
| 261 | isabelle-output.dock-position=bottom | |
| 262 | isabelle-output.height=174 | |
| 263 | isabelle-output.width=412 | |
| 264 | isabelle-query.dock-position=bottom | |
| 265 | isabelle-session-browser.label=Browse session information | |
| 266 | isabelle-simplifier-trace.dock-position=floating | |
| 267 | isabelle-sledgehammer.dock-position=bottom | |
| 268 | isabelle-state.dock-position=right | |
| 269 | isabelle-symbols.dock-position=bottom | |
| 270 | isabelle-theories.dock-position=right | |
| 271 | isabelle.antiquoted_cartouche.label=Make antiquoted cartouche | |
| 272 | isabelle.complete-word.label=Complete word | |
| 273 | isabelle.complete.label=Complete Isabelle text | |
| 274 | isabelle.complete.shortcut2=C+b | |
| 275 | isabelle.control-bold.label=Control bold | |
| 276 | isabelle.control-bold.shortcut=C+e RIGHT | |
| 277 | isabelle.control-emph.label=Control emphasized | |
| 278 | isabelle.control-emph.shortcut=C+e LEFT | |
| 279 | isabelle.control-reset.label=Control reset | |
| 280 | isabelle.control-reset.shortcut=C+e BACK_SPACE | |
| 281 | isabelle.control-sub.label=Control subscript | |
| 282 | isabelle.control-sub.shortcut=C+e DOWN | |
| 283 | isabelle.control-sup.label=Control superscript | |
| 284 | isabelle.control-sup.shortcut=C+e UP | |
| 285 | isabelle.decrease-font-size.label=Decrease font size | |
| 286 | isabelle.decrease-font-size.shortcut2=C+SUBTRACT | |
| 287 | isabelle.decrease-font-size.shortcut=C+MINUS | |
| 288 | isabelle.decrease-font-size2.label=Decrease font size (clone) | |
| 289 | isabelle.draft.label=Show draft in browser | |
| 290 | isabelle.exclude-word-permanently.label=Exclude word permanently | |
| 291 | isabelle.exclude-word.label=Exclude word | |
| 292 | isabelle.first-error.label=Go to first error | |
| 293 | isabelle.first-error.shortcut=CS+a | |
| 294 | isabelle.goto-entity.label=Go to definition of formal entity at caret | |
| 295 | isabelle.goto-entity.shortcut=CS+d | |
| 296 | isabelle.include-word-permanently.label=Include word permanently | |
| 297 | isabelle.include-word.label=Include word | |
| 298 | isabelle.increase-font-size.label=Increase font size | |
| 299 | isabelle.increase-font-size.shortcut2=C+ADD | |
| 300 | isabelle.increase-font-size.shortcut=C+PLUS | |
| 301 | isabelle.increase-font-size2.label=Increase font size (clone) | |
| 302 | isabelle.increase-font-size2.shortcut=C+EQUALS | |
| 303 | isabelle.java-monitor.label=Java/VM monitor | |
| 304 | isabelle.last-error.label=Go to last error | |
| 305 | isabelle.last-error.shortcut=CS+z | |
| 306 | isabelle.message.label=Show message | |
| 307 | isabelle.message.shortcut=CS+m | |
| 308 | isabelle.newline.label=Newline with indentation of Isabelle keywords | |
| 309 | isabelle.newline.shortcut=ENTER | |
| 310 | isabelle.next-error.label=Go to next error | |
| 311 | isabelle.next-error.shortcut=CS+n | |
| 312 | isabelle.options.label=Isabelle options | |
| 313 | isabelle.prev-error.label=Go to previous error | |
| 314 | isabelle.prev-error.shortcut=CS+p | |
| 315 | isabelle.preview.label=Show preview in browser | |
| 316 | isabelle.reset-continuous-checking.label=Reset continuous checking | |
| 317 | isabelle.reset-font-size.label=Reset font size | |
| 318 | isabelle.reset-node-required.label=Reset node required | |
| 319 | isabelle.reset-words.label=Reset non-permanent words | |
| 320 | isabelle.select-entity.label=Select all occurences of formal entity at caret | |
| 321 | isabelle.select-entity.shortcut=CS+ENTER | |
| 322 | isabelle.set-continuous-checking.label=Set continuous checking | |
| 323 | isabelle.set-node-required.label=Set node required | |
| 324 | isabelle.toggle-breakpoint.label=Toggle Breakpoint | |
| 325 | isabelle.toggle-continuous-checking.label=Toggle continuous checking | |
| 326 | isabelle.toggle-continuous-checking.shortcut=C+e ENTER | |
| 327 | isabelle.toggle-node-required.label=Toggle node required | |
| 328 | isabelle.toggle-node-required.shortcut=C+e SPACE | |
| 329 | isabelle.tooltip.label=Show tooltip | |
| 330 | isabelle.tooltip.shortcut=CS+b | |
| 331 | isabelle.update-state.label=Update state output | |
| 332 | isabelle.update-state.shortcut=S+ENTER | |
| 333 | lang.usedefaultlocale=false | |
| 334 | largefilemode=full | |
| 335 | line-end.shortcut=END | |
| 336 | line-home.shortcut=HOME | |
| 337 | logo.icon.medium=32x32/apps/isabelle.gif | |
| 338 | lookAndFeel=com.formdev.flatlaf.FlatLightLaf | |
| 339 | match-bracket.shortcut2=C+9 | |
| 340 | metal.primary.font=Isabelle DejaVu Sans | |
| 341 | metal.primary.fontsize=12 | |
| 342 | metal.secondary.font=Isabelle DejaVu Sans | |
| 343 | metal.secondary.fontsize=12 | |
| 344 | navigator.showOnToolbar=true | |
| 345 | new-file-in-mode.shortcut= | |
| 346 | next-bracket.shortcut2=C+e C+9 | |
| 347 | options.shortcuts.deletekeymap.label=Delete | |
| 348 | options.shortcuts.duplicatekeymap.dialog.title=Keymap name | |
| 349 | options.shortcuts.duplicatekeymap.label=Duplicate | |
| 350 | options.shortcuts.resetkeymap.dialog.title=Reset keymap | |
| 351 | options.shortcuts.resetkeymap.label=Reset | |
| 352 | options.textarea.lineSpacing=1 | |
| 353 | plugin-blacklist.MacOSX.jar=true | |
| 354 | plugin.MacOSXPlugin.altDispatcher=false | |
| 355 | plugin.MacOSXPlugin.disableOption=true | |
| 356 | prev-bracket.shortcut2=C+e C+8 | |
| 357 | print.font=Isabelle DejaVu Sans Mono | |
| 358 | print.glyphVector=true | |
| 359 | recent-buffer.shortcut2=C+CIRCUMFLEX | |
| 360 | restore.remote=false | |
| 361 | restore=false | |
| 362 | search.subdirs.toggle=true | |
| 363 | select-block.shortcut2=C+8 | |
| 364 | sidekick-tree.dock-position=right | |
| 365 | sidekick.auto-complete-popup-get-focus=true | |
| 366 | sidekick.buffer-save-parse=true | |
| 367 | sidekick.complete-delay=0 | |
| 368 | sidekick.complete-instant.toggle=false | |
| 369 | sidekick.complete-popup.accept-characters=\\t | |
| 370 | sidekick.complete-popup.insert-characters= | |
| 371 | sidekick.persistentFilter=true | |
| 372 | sidekick.showFilter=true | |
| 373 | sidekick.splitter.location=721 | |
| 374 | systrayicon=false | |
| 375 | tip.show=false | |
| 376 | toggle-full-screen.shortcut2=S+F11 | |
| 377 | toggle-multi-select.shortcut2=C+NUMBER_SIGN | |
| 378 | toggle-rect-select.shortcut2=A+NUMBER_SIGN | |
| 379 | twoStageSave=false | |
| 380 | vfs.browser.dock-position=left | |
| 381 | vfs.favorite.0.type=1 | |
| 382 | vfs.favorite.0=$ISABELLE_HOME | |
| 383 | vfs.favorite.1.type=1 | |
| 384 | vfs.favorite.1=$ISABELLE_HOME_USER | |
| 385 | vfs.favorite.2.type=1 | |
| 386 | vfs.favorite.2=$JEDIT_HOME | |
| 387 | vfs.favorite.3.type=1 | |
| 388 | vfs.favorite.3=$JEDIT_SETTINGS | |
| 389 | vfs.favorite.4.type=1 | |
| 390 | vfs.favorite.4=isabelle-export: | |
| 391 | vfs.favorite.5.type=1 | |
| 392 | vfs.favorite.5=isabelle-session: | |
| 393 | view.antiAlias=subpixel HRGB | |
| 394 | view.blockCaret=true | |
| 395 | view.caretBlink=false | |
| 396 | view.docking.framework=PIDE | |
| 397 | view.eolMarkers=false | |
| 398 | view.extendedState=0 | |
| 399 | view.font=Isabelle DejaVu Sans Mono | |
| 400 | view.fontsize=18 | |
| 401 | view.fracFontMetrics=false | |
| 402 | view.gutter.font=Isabelle DejaVu Sans Mono | |
| 403 | view.gutter.fontsize=12 | |
| 404 | view.gutter.lineNumbers=false | |
| 405 | view.gutter.selectionAreaWidth=18 | |
| 406 | view.height=850 | |
| 407 | view.middleMousePaste=true | |
| 408 | view.showToolbar=true | |
| 409 | view.status.memory.background=#666699 | |
| 410 | view.status=( mode , fold , encoding ) locked wrap multiSelect rectSelect overwrite lineSep buffersets task-monitor java-status ml-status errors clock | |
| 411 | view.thickCaret=true | |
| 412 | view.width=1200 | |
| 413 | xml-insert-closing-tag.shortcut= | |
| 414 | """) | |
| 415 | ||
| 416 |     val modes_dir = jedit_patched_dir + Path.basic("modes")
 | |
| 417 | ||
| 418 | Mode.list.foreach(_.write(modes_dir)) | |
| 419 | ||
| 75202 | 420 |     File.change_lines(modes_dir + Path.basic("catalog")) { _.flatMap(line =>
 | 
| 421 |       if (line.containsSlice("FILE=\"ml.xml\"") ||
 | |
| 422 |         line.containsSlice("FILE_NAME_GLOB=\"*.{sml,ml}\"") ||
 | |
| 423 |         line.containsSlice("FILE_NAME_GLOB=\"*.ftl\"")) Nil
 | |
| 424 |       else if (line.containsSlice("NAME=\"jamon\"")) {
 | |
| 425 | List( | |
| 426 |           """<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="{*.thy,ROOT0.ML,ROOT.ML}"/>""",
 | |
| 427 | "", | |
| 428 | """<MODE NAME="isabelle-ml" FILE="isabelle-ml.xml" FILE_NAME_GLOB="*.ML"/>""", | |
| 429 | "", | |
| 430 | """<MODE NAME="isabelle-news" FILE="isabelle-news.xml"/>""", | |
| 431 | "", | |
| 432 | """<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>""", | |
| 433 | "", | |
| 434 | """<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>""", | |
| 435 | "", | |
| 436 | line) | |
| 437 | } | |
| 438 |       else if (line.containsSlice("NAME=\"sqr\"")) {
 | |
| 439 | List( | |
| 440 |           """<MODE NAME="sml" FILE="sml.xml" FILE_NAME_GLOB="*.{sml,sig}"/>""",
 | |
| 441 | "", | |
| 442 | line) | |
| 443 | } | |
| 444 | else List(line)) | |
| 445 | } | |
| 73660 | 446 | |
| 447 | ||
| 448 | /* doc */ | |
| 449 | ||
| 450 |     val doc_dir = jedit_patched_dir + Path.basic("doc")
 | |
| 451 | ||
| 452 | download_jedit(doc_dir, "manual-a4.pdf", target_name = "jedit-manual.pdf") | |
| 453 | ||
| 454 | Isabelle_System.copy_file( | |
| 455 |       doc_dir + Path.basic("CHANGES.txt"), doc_dir + Path.basic("jedit-changes"))
 | |
| 456 | ||
| 457 |     File.write(doc_dir + Path.basic("Contents"),
 | |
| 458 | """Original jEdit Documentation | |
| 459 | jedit-manual jEdit User's Guide | |
| 460 | jedit-changes jEdit Version History | |
| 461 | ||
| 462 | """) | |
| 463 | ||
| 73653 | 464 | |
| 75229 | 465 | /* make patch */ | 
| 73653 | 466 | |
| 75229 | 467 | File.write(component_dir + Path.basic(jedit).patch, | 
| 468 | Isabelle_System.make_patch(component_dir, Path.basic(jedit), Path.basic(jedit_patched))) | |
| 73653 | 469 | |
| 470 | if (!original) Isabelle_System.rm_tree(jedit_dir) | |
| 471 | ||
| 472 | ||
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 473 | /* settings */ | 
| 73653 | 474 | |
| 475 |     File.write(etc_dir + Path.explode("settings"),
 | |
| 476 | """# -*- shell-script -*- :mode=shellscript: | |
| 477 | ||
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 478 | JEDIT_HOME="$COMPONENT/""" + jedit_patched + """" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 479 | JEDIT_JARS=""" + quote(File.read_dir(jars_dir).map("$JEDIT_HOME/jars/" + _).mkString(":")) + """
 | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 480 | JEDIT_JAR="$JEDIT_HOME/jedit.jar" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 481 | classpath "$JEDIT_JAR" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 482 | |
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 483 | JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 484 | JEDIT_OPTIONS="-reuseview -nobackground -nosplash -log=9" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 485 | JEDIT_JAVA_OPTIONS="-Xms512m -Xmx4g -Xss16m" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 486 | JEDIT_JAVA_SYSTEM_OPTIONS="-Duser.language=en -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dapple.laf.useScreenMenuBar=true -Dapple.awt.application.name=Isabelle" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 487 | |
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 488 | ISABELLE_DOCS="$ISABELLE_DOCS:$JEDIT_HOME/doc" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 489 | """) | 
| 73653 | 490 | |
| 491 | ||
| 492 | /* README */ | |
| 493 | ||
| 494 |     File.write(component_dir + Path.basic("README"),
 | |
| 495 | """This is a slightly patched version of jEdit """ + version + """ from | |
| 496 | https://sourceforge.net/projects/jedit/files/jedit with some | |
| 497 | additional plugins jars from | |
| 498 | https://sourceforge.net/projects/jedit-plugins/files | |
| 499 | ||
| 500 | ||
| 501 | Makarius | |
| 502 | """ + Date.Format.date(Date.now()) + "\n") | |
| 503 | } | |
| 504 | ||
| 505 | ||
| 506 | ||
| 507 | /** Isabelle tool wrappers **/ | |
| 508 | ||
| 509 | val default_version = "5.6.0" | |
| 510 |   def default_java_home: Path = Path.explode("$JAVA_HOME").expand
 | |
| 511 | ||
| 512 | val isabelle_tool = | |
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 513 |     Isabelle_Tool("build_jedit", "build Isabelle component from the jEdit text-editor",
 | 
| 75394 | 514 | Scala_Project.here, | 
| 515 |       { args =>
 | |
| 516 | var target_dir = Path.current | |
| 517 | var java_home = default_java_home | |
| 518 | var original = false | |
| 519 | var version = default_version | |
| 73653 | 520 | |
| 75394 | 521 |         val getopts = Getopts("""
 | 
| 73653 | 522 | Usage: isabelle build_jedit [OPTIONS] | 
| 523 | ||
| 524 | Options are: | |
| 525 | -D DIR target directory (default ".") | |
| 526 | -J JAVA_HOME Java version for building jedit.jar (e.g. version 11) | |
| 527 | -O retain copy of original jEdit directory | |
| 528 | -V VERSION jEdit version (default: """ + quote(default_version) + """) | |
| 529 | ||
| 530 | Build auxiliary jEdit component from original sources, with some patches. | |
| 531 | """, | |
| 75394 | 532 | "D:" -> (arg => target_dir = Path.explode(arg)), | 
| 533 | "J:" -> (arg => java_home = Path.explode(arg)), | |
| 534 | "O" -> (_ => original = true), | |
| 535 | "V:" -> (arg => version = arg)) | |
| 73653 | 536 | |
| 75394 | 537 | val more_args = getopts(args) | 
| 538 | if (more_args.nonEmpty) getopts.usage() | |
| 73653 | 539 | |
| 75394 | 540 |         val component_dir = target_dir + Path.basic("jedit-" + Date.Format.alt_date(Date.now()))
 | 
| 541 | val progress = new Console_Progress() | |
| 73653 | 542 | |
| 75394 | 543 | build_jedit(component_dir, version, original = original, | 
| 544 | java_home = java_home, progress = progress) | |
| 545 | }) | |
| 73653 | 546 | } |