author | Fabian Huch <huch@in.tum.de> |
Thu, 18 Jul 2024 13:08:11 +0200 | |
changeset 80574 | 90493e889dff |
parent 80224 | db92e0b6a11a |
child 81297 | 07f64697408e |
permissions | -rw-r--r-- |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
76548
diff
changeset
|
1 |
/* Title: Pure/Admin/component_jedit.scala |
73653 | 2 |
Author: Makarius |
3 |
||
73987
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
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 |
||
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
76548
diff
changeset
|
15 |
object Component_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( |
76518 | 106 |
component_path: Path, |
73653 | 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 |
||
76547 | 115 |
val component_dir = Components.Directory(component_path).create(progress = progress) |
74030
39e05601faeb
more accurate scala_project, based on build.props of components;
wenzelm
parents:
73987
diff
changeset
|
116 |
|
73653 | 117 |
|
118 |
/* jEdit directory */ |
|
119 |
||
120 |
val jedit = "jedit" + version |
|
121 |
val jedit_patched = jedit + "-patched" |
|
122 |
||
76518 | 123 |
val jedit_dir = Isabelle_System.make_directory(component_path + Path.basic(jedit)) |
124 |
val jedit_patched_dir = component_path + Path.basic(jedit_patched) |
|
73653 | 125 |
|
75393 | 126 |
def download_jedit(dir: Path, name: String, target_name: String = ""): Path = { |
73653 | 127 |
val jedit_name = jedit + name |
128 |
val url = |
|
129 |
"https://sourceforge.net/projects/jedit/files/jedit/" + |
|
130 |
version + "/" + jedit_name + "/download" |
|
73660 | 131 |
val path = dir + Path.basic(proper_string(target_name) getOrElse jedit_name) |
73653 | 132 |
Isabelle_System.download_file(url, path, progress = progress) |
133 |
path |
|
134 |
} |
|
135 |
||
75491 | 136 |
Isabelle_System.with_tmp_dir("build") { tmp_dir => |
73653 | 137 |
/* original version */ |
138 |
||
139 |
val install_path = download_jedit(tmp_dir, "install.jar") |
|
140 |
Isabelle_System.bash("""export CLASSPATH="" |
|
141 |
isabelle_java java -Duser.home=""" + File.bash_platform_path(tmp_dir) + |
|
142 |
" -jar " + File.bash_platform_path(install_path) + " auto " + |
|
143 |
File.bash_platform_path(jedit_dir) + " unix-script=off unix-man=off").check |
|
144 |
||
145 |
val source_path = download_jedit(tmp_dir, "source.tar.bz2") |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76530
diff
changeset
|
146 |
Isabelle_System.extract(source_path, jedit_dir) |
73653 | 147 |
|
148 |
||
149 |
/* patched version */ |
|
150 |
||
151 |
Isabelle_System.copy_dir(jedit_dir, jedit_patched_dir) |
|
152 |
||
153 |
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:
74548
diff
changeset
|
154 |
val org_source_dir = source_dir + Path.basic("org") |
73653 | 155 |
val tmp_source_dir = tmp_dir + Path.basic("jEdit") |
156 |
||
157 |
progress.echo("Patching jEdit sources ...") |
|
158 |
for { |
|
76527 | 159 |
file <- File.find_files(Path.explode("~~/src/Tools/jEdit/patches").file).sortBy(_.getName) |
73653 | 160 |
name = file.getName |
75906
2167b9e3157a
clarified signature: support for adhoc file types;
wenzelm
parents:
75491
diff
changeset
|
161 |
if !File.is_backup(name) |
73653 | 162 |
} { |
163 |
progress.bash("patch -p2 < " + File.bash_path(File.path(file)), |
|
80224
db92e0b6a11a
clarified signature: prefer symbolic isabelle.Path over physical java.io.File;
wenzelm
parents:
77566
diff
changeset
|
164 |
cwd = source_dir, echo = true).check |
73653 | 165 |
} |
166 |
||
73660 | 167 |
for { theme <- List("classic", "tango") } { |
168 |
val path = Path.explode("org/gjt/sp/jedit/icons/themes/" + theme + "/32x32/apps/isabelle.gif") |
|
169 |
Isabelle_System.copy_file(Path.explode("~~/lib/logo/isabelle_transparent-32.gif"), |
|
170 |
source_dir + path) |
|
171 |
} |
|
172 |
||
73653 | 173 |
progress.echo("Building jEdit ...") |
174 |
Isabelle_System.copy_dir(source_dir, tmp_source_dir) |
|
175 |
progress.bash("env JAVA_HOME=" + File.bash_platform_path(java_home) + " ant", |
|
80224
db92e0b6a11a
clarified signature: prefer symbolic isabelle.Path over physical java.io.File;
wenzelm
parents:
77566
diff
changeset
|
176 |
cwd = tmp_source_dir, echo = true).check |
73653 | 177 |
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:
73987
diff
changeset
|
178 |
|
39e05601faeb
more accurate scala_project, based on build.props of components;
wenzelm
parents:
73987
diff
changeset
|
179 |
val java_sources = |
76527 | 180 |
(for { |
75906
2167b9e3157a
clarified signature: support for adhoc file types;
wenzelm
parents:
75491
diff
changeset
|
181 |
file <- File.find_files(org_source_dir.file, file => File.is_java(file.getName)) |
74104 | 182 |
package_name <- Scala_Project.package_name(File.path(file)) |
183 |
if !exclude_package(package_name) |
|
76527 | 184 |
} yield File.path(component_path.java_path.relativize(file.toPath).toFile).implode).sorted |
74030
39e05601faeb
more accurate scala_project, based on build.props of components;
wenzelm
parents:
73987
diff
changeset
|
185 |
|
76518 | 186 |
File.write(component_dir.build_props, |
74057 | 187 |
"module = " + jedit_patched + "/jedit.jar\n" + |
188 |
"no_build = true\n" + |
|
74030
39e05601faeb
more accurate scala_project, based on build.props of components;
wenzelm
parents:
73987
diff
changeset
|
189 |
"requirements = env:JEDIT_JARS\n" + |
75221 | 190 |
("sources =" :: java_sources.sorted.map(" " + _)).mkString("", " \\\n", "\n")) |
75394 | 191 |
} |
73653 | 192 |
|
193 |
||
194 |
/* jars */ |
|
195 |
||
196 |
val jars_dir = Isabelle_System.make_directory(jedit_patched_dir + Path.basic("jars")) |
|
197 |
||
198 |
for { (url, name) <- download_jars } { |
|
199 |
Isabelle_System.download_file(url, jars_dir + Path.basic(name), progress = progress) |
|
200 |
} |
|
201 |
||
202 |
for { (name, vers) <- download_plugins } { |
|
75394 | 203 |
Isabelle_System.with_tmp_file("tmp", ext = "zip") { zip_path => |
73653 | 204 |
val url = |
205 |
"https://sourceforge.net/projects/jedit-plugins/files/" + name + "/" + vers + "/" + |
|
206 |
name + "-" + vers + "-bin.zip/download" |
|
207 |
Isabelle_System.download_file(url, zip_path, progress = progress) |
|
76530 | 208 |
Isabelle_System.extract(zip_path, jars_dir) |
75394 | 209 |
} |
73653 | 210 |
} |
211 |
||
212 |
||
73660 | 213 |
/* resources */ |
214 |
||
73983 | 215 |
val keep_encodings = List("ISO-8859-1", "ISO-8859-15", "US-ASCII", "UTF-8", "windows-1252") |
216 |
val drop_encodings = |
|
217 |
Charset.availableCharsets().keySet().asScala.toList.sorted.filterNot(keep_encodings.contains) |
|
218 |
||
73660 | 219 |
File.write(jedit_patched_dir + Path.explode("properties/jEdit.props"), |
220 |
"""#jEdit properties |
|
221 |
autoReloadDialog=false |
|
222 |
buffer.deepIndent=false |
|
223 |
buffer.encoding=UTF-8-Isabelle |
|
224 |
buffer.indentSize=2 |
|
225 |
buffer.lineSeparator=\n |
|
226 |
buffer.maxLineLen=100 |
|
227 |
buffer.noTabs=true |
|
228 |
buffer.sidekick.keystroke-parse=false |
|
229 |
buffer.tabSize=2 |
|
230 |
buffer.undoCount=1000 |
|
231 |
close-docking-area.shortcut2=C+e C+CIRCUMFLEX |
|
232 |
complete-word.shortcut= |
|
233 |
console.dock-position=floating |
|
234 |
console.encoding=UTF-8 |
|
235 |
console.font=Isabelle DejaVu Sans Mono |
|
236 |
console.fontsize=14 |
|
237 |
delete-line.shortcut=A+d |
|
238 |
delete.shortcut2=C+d |
|
73983 | 239 |
""" + drop_encodings.map(a => "encoding.opt-out." + a + "=true").mkString("\n") + """ |
73660 | 240 |
encodingDetectors=BOM XML-PI buffer-local-property |
241 |
end.shortcut= |
|
242 |
expand-abbrev.shortcut2=CA+SPACE |
|
243 |
expand-folds.shortcut= |
|
244 |
fallbackEncodings=UTF-8 ISO-8859-15 US-ASCII |
|
245 |
firstTime=false |
|
246 |
focus-buffer-switcher.shortcut2=A+CIRCUMFLEX |
|
247 |
foldPainter=Circle |
|
248 |
gatchan.highlight.overview=false |
|
249 |
helpviewer.font=Isabelle DejaVu Serif |
|
250 |
helpviewer.fontsize=12 |
|
251 |
home.shortcut= |
|
252 |
hypersearch-results.dock-position=right |
|
253 |
insert-newline-indent.shortcut= |
|
254 |
insert-newline.shortcut= |
|
255 |
isabelle-debugger.dock-position=floating |
|
256 |
isabelle-documentation.dock-position=left |
|
257 |
isabelle-export-browser.label=Browse theory exports |
|
258 |
isabelle-output.dock-position=bottom |
|
259 |
isabelle-output.height=174 |
|
260 |
isabelle-output.width=412 |
|
261 |
isabelle-query.dock-position=bottom |
|
262 |
isabelle-session-browser.label=Browse session information |
|
263 |
isabelle-simplifier-trace.dock-position=floating |
|
264 |
isabelle-sledgehammer.dock-position=bottom |
|
265 |
isabelle-state.dock-position=right |
|
266 |
isabelle-symbols.dock-position=bottom |
|
267 |
isabelle-theories.dock-position=right |
|
268 |
isabelle.antiquoted_cartouche.label=Make antiquoted cartouche |
|
269 |
isabelle.complete-word.label=Complete word |
|
270 |
isabelle.complete.label=Complete Isabelle text |
|
271 |
isabelle.complete.shortcut2=C+b |
|
272 |
isabelle.control-bold.label=Control bold |
|
273 |
isabelle.control-bold.shortcut=C+e RIGHT |
|
274 |
isabelle.control-emph.label=Control emphasized |
|
275 |
isabelle.control-emph.shortcut=C+e LEFT |
|
276 |
isabelle.control-reset.label=Control reset |
|
277 |
isabelle.control-reset.shortcut=C+e BACK_SPACE |
|
278 |
isabelle.control-sub.label=Control subscript |
|
279 |
isabelle.control-sub.shortcut=C+e DOWN |
|
280 |
isabelle.control-sup.label=Control superscript |
|
281 |
isabelle.control-sup.shortcut=C+e UP |
|
282 |
isabelle.decrease-font-size.label=Decrease font size |
|
283 |
isabelle.decrease-font-size.shortcut2=C+SUBTRACT |
|
284 |
isabelle.decrease-font-size.shortcut=C+MINUS |
|
285 |
isabelle.decrease-font-size2.label=Decrease font size (clone) |
|
286 |
isabelle.draft.label=Show draft in browser |
|
287 |
isabelle.exclude-word-permanently.label=Exclude word permanently |
|
288 |
isabelle.exclude-word.label=Exclude word |
|
289 |
isabelle.first-error.label=Go to first error |
|
290 |
isabelle.first-error.shortcut=CS+a |
|
291 |
isabelle.goto-entity.label=Go to definition of formal entity at caret |
|
292 |
isabelle.goto-entity.shortcut=CS+d |
|
293 |
isabelle.include-word-permanently.label=Include word permanently |
|
294 |
isabelle.include-word.label=Include word |
|
295 |
isabelle.increase-font-size.label=Increase font size |
|
296 |
isabelle.increase-font-size.shortcut2=C+ADD |
|
297 |
isabelle.increase-font-size.shortcut=C+PLUS |
|
298 |
isabelle.increase-font-size2.label=Increase font size (clone) |
|
299 |
isabelle.increase-font-size2.shortcut=C+EQUALS |
|
300 |
isabelle.java-monitor.label=Java/VM monitor |
|
301 |
isabelle.last-error.label=Go to last error |
|
302 |
isabelle.last-error.shortcut=CS+z |
|
303 |
isabelle.message.label=Show message |
|
304 |
isabelle.message.shortcut=CS+m |
|
305 |
isabelle.newline.label=Newline with indentation of Isabelle keywords |
|
306 |
isabelle.newline.shortcut=ENTER |
|
307 |
isabelle.next-error.label=Go to next error |
|
308 |
isabelle.next-error.shortcut=CS+n |
|
309 |
isabelle.options.label=Isabelle options |
|
310 |
isabelle.prev-error.label=Go to previous error |
|
311 |
isabelle.prev-error.shortcut=CS+p |
|
312 |
isabelle.preview.label=Show preview in browser |
|
313 |
isabelle.reset-continuous-checking.label=Reset continuous checking |
|
314 |
isabelle.reset-font-size.label=Reset font size |
|
315 |
isabelle.reset-node-required.label=Reset node required |
|
316 |
isabelle.reset-words.label=Reset non-permanent words |
|
317 |
isabelle.select-entity.label=Select all occurences of formal entity at caret |
|
318 |
isabelle.select-entity.shortcut=CS+ENTER |
|
319 |
isabelle.set-continuous-checking.label=Set continuous checking |
|
320 |
isabelle.set-node-required.label=Set node required |
|
321 |
isabelle.toggle-breakpoint.label=Toggle Breakpoint |
|
322 |
isabelle.toggle-continuous-checking.label=Toggle continuous checking |
|
323 |
isabelle.toggle-continuous-checking.shortcut=C+e ENTER |
|
324 |
isabelle.toggle-node-required.label=Toggle node required |
|
325 |
isabelle.toggle-node-required.shortcut=C+e SPACE |
|
326 |
isabelle.tooltip.label=Show tooltip |
|
327 |
isabelle.tooltip.shortcut=CS+b |
|
328 |
isabelle.update-state.label=Update state output |
|
329 |
isabelle.update-state.shortcut=S+ENTER |
|
330 |
lang.usedefaultlocale=false |
|
331 |
largefilemode=full |
|
332 |
line-end.shortcut=END |
|
333 |
line-home.shortcut=HOME |
|
334 |
logo.icon.medium=32x32/apps/isabelle.gif |
|
335 |
lookAndFeel=com.formdev.flatlaf.FlatLightLaf |
|
336 |
match-bracket.shortcut2=C+9 |
|
337 |
metal.primary.font=Isabelle DejaVu Sans |
|
338 |
metal.primary.fontsize=12 |
|
339 |
metal.secondary.font=Isabelle DejaVu Sans |
|
340 |
metal.secondary.fontsize=12 |
|
341 |
navigator.showOnToolbar=true |
|
342 |
new-file-in-mode.shortcut= |
|
343 |
next-bracket.shortcut2=C+e C+9 |
|
344 |
options.shortcuts.deletekeymap.label=Delete |
|
345 |
options.shortcuts.duplicatekeymap.dialog.title=Keymap name |
|
346 |
options.shortcuts.duplicatekeymap.label=Duplicate |
|
347 |
options.shortcuts.resetkeymap.dialog.title=Reset keymap |
|
348 |
options.shortcuts.resetkeymap.label=Reset |
|
349 |
options.textarea.lineSpacing=1 |
|
350 |
plugin-blacklist.MacOSX.jar=true |
|
351 |
plugin.MacOSXPlugin.altDispatcher=false |
|
352 |
plugin.MacOSXPlugin.disableOption=true |
|
353 |
prev-bracket.shortcut2=C+e C+8 |
|
354 |
print.font=Isabelle DejaVu Sans Mono |
|
355 |
print.glyphVector=true |
|
356 |
recent-buffer.shortcut2=C+CIRCUMFLEX |
|
357 |
restore.remote=false |
|
358 |
restore=false |
|
359 |
search.subdirs.toggle=true |
|
360 |
select-block.shortcut2=C+8 |
|
361 |
sidekick-tree.dock-position=right |
|
362 |
sidekick.auto-complete-popup-get-focus=true |
|
363 |
sidekick.buffer-save-parse=true |
|
364 |
sidekick.complete-delay=0 |
|
365 |
sidekick.complete-instant.toggle=false |
|
366 |
sidekick.complete-popup.accept-characters=\\t |
|
367 |
sidekick.complete-popup.insert-characters= |
|
368 |
sidekick.persistentFilter=true |
|
369 |
sidekick.showFilter=true |
|
370 |
sidekick.splitter.location=721 |
|
371 |
systrayicon=false |
|
372 |
tip.show=false |
|
373 |
toggle-full-screen.shortcut2=S+F11 |
|
374 |
toggle-multi-select.shortcut2=C+NUMBER_SIGN |
|
375 |
toggle-rect-select.shortcut2=A+NUMBER_SIGN |
|
376 |
twoStageSave=false |
|
377 |
vfs.browser.dock-position=left |
|
378 |
vfs.favorite.0.type=1 |
|
379 |
vfs.favorite.0=$ISABELLE_HOME |
|
380 |
vfs.favorite.1.type=1 |
|
381 |
vfs.favorite.1=$ISABELLE_HOME_USER |
|
382 |
vfs.favorite.2.type=1 |
|
383 |
vfs.favorite.2=$JEDIT_HOME |
|
384 |
vfs.favorite.3.type=1 |
|
385 |
vfs.favorite.3=$JEDIT_SETTINGS |
|
386 |
vfs.favorite.4.type=1 |
|
387 |
vfs.favorite.4=isabelle-export: |
|
388 |
vfs.favorite.5.type=1 |
|
389 |
vfs.favorite.5=isabelle-session: |
|
390 |
view.antiAlias=subpixel HRGB |
|
391 |
view.blockCaret=true |
|
392 |
view.caretBlink=false |
|
393 |
view.docking.framework=PIDE |
|
394 |
view.eolMarkers=false |
|
395 |
view.extendedState=0 |
|
396 |
view.font=Isabelle DejaVu Sans Mono |
|
397 |
view.fontsize=18 |
|
398 |
view.fracFontMetrics=false |
|
399 |
view.gutter.font=Isabelle DejaVu Sans Mono |
|
400 |
view.gutter.fontsize=12 |
|
401 |
view.gutter.lineNumbers=false |
|
402 |
view.gutter.selectionAreaWidth=18 |
|
403 |
view.height=850 |
|
404 |
view.middleMousePaste=true |
|
405 |
view.showToolbar=true |
|
406 |
view.status.memory.background=#666699 |
|
407 |
view.status=( mode , fold , encoding ) locked wrap multiSelect rectSelect overwrite lineSep buffersets task-monitor java-status ml-status errors clock |
|
408 |
view.thickCaret=true |
|
409 |
view.width=1200 |
|
410 |
xml-insert-closing-tag.shortcut= |
|
411 |
""") |
|
412 |
||
413 |
val modes_dir = jedit_patched_dir + Path.basic("modes") |
|
414 |
||
415 |
Mode.list.foreach(_.write(modes_dir)) |
|
416 |
||
75202 | 417 |
File.change_lines(modes_dir + Path.basic("catalog")) { _.flatMap(line => |
418 |
if (line.containsSlice("FILE=\"ml.xml\"") || |
|
419 |
line.containsSlice("FILE_NAME_GLOB=\"*.{sml,ml}\"") || |
|
420 |
line.containsSlice("FILE_NAME_GLOB=\"*.ftl\"")) Nil |
|
421 |
else if (line.containsSlice("NAME=\"jamon\"")) { |
|
422 |
List( |
|
423 |
"""<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="{*.thy,ROOT0.ML,ROOT.ML}"/>""", |
|
424 |
"", |
|
425 |
"""<MODE NAME="isabelle-ml" FILE="isabelle-ml.xml" FILE_NAME_GLOB="*.ML"/>""", |
|
426 |
"", |
|
427 |
"""<MODE NAME="isabelle-news" FILE="isabelle-news.xml"/>""", |
|
428 |
"", |
|
429 |
"""<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>""", |
|
430 |
"", |
|
431 |
"""<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>""", |
|
432 |
"", |
|
433 |
line) |
|
434 |
} |
|
435 |
else if (line.containsSlice("NAME=\"sqr\"")) { |
|
436 |
List( |
|
437 |
"""<MODE NAME="sml" FILE="sml.xml" FILE_NAME_GLOB="*.{sml,sig}"/>""", |
|
438 |
"", |
|
439 |
line) |
|
440 |
} |
|
441 |
else List(line)) |
|
442 |
} |
|
73660 | 443 |
|
444 |
||
445 |
/* doc */ |
|
446 |
||
447 |
val doc_dir = jedit_patched_dir + Path.basic("doc") |
|
448 |
||
449 |
download_jedit(doc_dir, "manual-a4.pdf", target_name = "jedit-manual.pdf") |
|
450 |
||
451 |
Isabelle_System.copy_file( |
|
452 |
doc_dir + Path.basic("CHANGES.txt"), doc_dir + Path.basic("jedit-changes")) |
|
453 |
||
454 |
File.write(doc_dir + Path.basic("Contents"), |
|
455 |
"""Original jEdit Documentation |
|
456 |
jedit-manual jEdit User's Guide |
|
457 |
jedit-changes jEdit Version History |
|
458 |
||
459 |
""") |
|
460 |
||
73653 | 461 |
|
75229 | 462 |
/* make patch */ |
73653 | 463 |
|
76518 | 464 |
File.write(component_path + Path.basic(jedit).patch, |
465 |
Isabelle_System.make_patch(component_path, Path.basic(jedit), Path.basic(jedit_patched))) |
|
73653 | 466 |
|
467 |
if (!original) Isabelle_System.rm_tree(jedit_dir) |
|
468 |
||
469 |
||
74030
39e05601faeb
more accurate scala_project, based on build.props of components;
wenzelm
parents:
73987
diff
changeset
|
470 |
/* settings */ |
73653 | 471 |
|
76548 | 472 |
component_dir.write_settings(""" |
73987
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
473 |
JEDIT_HOME="$COMPONENT/""" + jedit_patched + """" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
474 |
JEDIT_JARS=""" + quote(File.read_dir(jars_dir).map("$JEDIT_HOME/jars/" + _).mkString(":")) + """ |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
475 |
JEDIT_JAR="$JEDIT_HOME/jedit.jar" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
476 |
classpath "$JEDIT_JAR" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
477 |
|
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
478 |
JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
479 |
JEDIT_OPTIONS="-reuseview -nobackground -nosplash -log=9" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
480 |
JEDIT_JAVA_OPTIONS="-Xms512m -Xmx4g -Xss16m" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
481 |
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:
73983
diff
changeset
|
482 |
|
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
483 |
ISABELLE_DOCS="$ISABELLE_DOCS:$JEDIT_HOME/doc" |
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73983
diff
changeset
|
484 |
""") |
73653 | 485 |
|
486 |
||
487 |
/* README */ |
|
488 |
||
76518 | 489 |
File.write(component_dir.README, |
73653 | 490 |
"""This is a slightly patched version of jEdit """ + version + """ from |
491 |
https://sourceforge.net/projects/jedit/files/jedit with some |
|
492 |
additional plugins jars from |
|
493 |
https://sourceforge.net/projects/jedit-plugins/files |
|
494 |
||
495 |
||
496 |
Makarius |
|
497 |
""" + Date.Format.date(Date.now()) + "\n") |
|
498 |
} |
|
499 |
||
500 |
||
501 |
||
502 |
/** Isabelle tool wrappers **/ |
|
503 |
||
504 |
val default_version = "5.6.0" |
|
505 |
def default_java_home: Path = Path.explode("$JAVA_HOME").expand |
|
506 |
||
507 |
val isabelle_tool = |
|
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
76548
diff
changeset
|
508 |
Isabelle_Tool("component_jedit", "build Isabelle component from the jEdit text-editor", |
75394 | 509 |
Scala_Project.here, |
510 |
{ args => |
|
511 |
var target_dir = Path.current |
|
512 |
var java_home = default_java_home |
|
513 |
var original = false |
|
514 |
var version = default_version |
|
73653 | 515 |
|
75394 | 516 |
val getopts = Getopts(""" |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
76548
diff
changeset
|
517 |
Usage: isabelle component_jedit [OPTIONS] |
73653 | 518 |
|
519 |
Options are: |
|
520 |
-D DIR target directory (default ".") |
|
521 |
-J JAVA_HOME Java version for building jedit.jar (e.g. version 11) |
|
522 |
-O retain copy of original jEdit directory |
|
523 |
-V VERSION jEdit version (default: """ + quote(default_version) + """) |
|
524 |
||
525 |
Build auxiliary jEdit component from original sources, with some patches. |
|
526 |
""", |
|
75394 | 527 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
528 |
"J:" -> (arg => java_home = Path.explode(arg)), |
|
529 |
"O" -> (_ => original = true), |
|
530 |
"V:" -> (arg => version = arg)) |
|
73653 | 531 |
|
75394 | 532 |
val more_args = getopts(args) |
533 |
if (more_args.nonEmpty) getopts.usage() |
|
73653 | 534 |
|
75394 | 535 |
val component_dir = target_dir + Path.basic("jedit-" + Date.Format.alt_date(Date.now())) |
536 |
val progress = new Console_Progress() |
|
73653 | 537 |
|
75394 | 538 |
build_jedit(component_dir, version, original = original, |
539 |
java_home = java_home, progress = progress) |
|
540 |
}) |
|
73653 | 541 |
} |