| author | wenzelm |
| Tue, 11 Apr 2023 10:45:04 +0200 | |
| changeset 77817 | a1bf8f706bc1 |
| parent 77509 | 3bc49507bae5 |
| child 78045 | bf4d535bbfcc |
| permissions | -rw-r--r-- |
| 64202 | 1 |
/* Title: Pure/Admin/build_release.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Build full Isabelle distribution from repository. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
| 75393 | 10 |
object Build_Release {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
11 |
/** release context **/ |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
12 |
|
| 73629 | 13 |
private def execute(dir: Path, script: String): Unit = |
14 |
Isabelle_System.bash(script, cwd = dir.file).check |
|
15 |
||
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76519
diff
changeset
|
16 |
private def execute_tar(dir: Path, args: String, strip: Boolean = false): Process_Result = |
| 73629 | 17 |
Isabelle_System.gnutar(args, dir = dir, strip = strip).check |
18 |
||
|
74857
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
19 |
private def bash_java_opens(args: String*): String = |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
20 |
Bash.strings(args.toList.flatMap(arg => List("--add-opens", arg + "=ALL-UNNAMED")))
|
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
21 |
|
| 75393 | 22 |
object Release_Context {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
23 |
def apply( |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
24 |
target_dir: Path, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
25 |
release_name: String = "", |
| 75393 | 26 |
progress: Progress = new Progress |
27 |
): Release_Context = {
|
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
28 |
val date = Date.now() |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
29 |
val dist_name = proper_string(release_name) getOrElse ("Isabelle_" + Date.Format.date(date))
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
30 |
val dist_dir = (target_dir + Path.explode("dist-" + dist_name)).absolute
|
|
77088
6e2c6ccc5dc0
clarified defaults: imitate "isabelle components -I" without further parameters;
wenzelm
parents:
77072
diff
changeset
|
31 |
new Release_Context(release_name, dist_name, dist_dir, progress) |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
32 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
33 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
34 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
35 |
class Release_Context private[Build_Release]( |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
36 |
val release_name: String, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
37 |
val dist_name: String, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
38 |
val dist_dir: Path, |
| 75393 | 39 |
val progress: Progress |
40 |
) {
|
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
41 |
override def toString: String = dist_name |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
42 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
43 |
val isabelle: Path = Path.explode(dist_name) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
44 |
val isabelle_dir: Path = dist_dir + isabelle |
| 73629 | 45 |
val isabelle_archive: Path = dist_dir + isabelle.tar.gz |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
46 |
val isabelle_library_archive: Path = dist_dir + Path.explode(dist_name + "_library.tar.gz") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
47 |
|
| 77045 | 48 |
def other_isabelle(dir: Path, suffix: String = "-build"): Other_Isabelle = |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
49 |
Other_Isabelle(dir + isabelle, |
| 77045 | 50 |
isabelle_identifier = dist_name + suffix, |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
51 |
progress = progress) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
52 |
|
| 75393 | 53 |
def make_announce(id: String): Unit = {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
54 |
if (release_name.isEmpty) {
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
55 |
File.write(isabelle_dir + Path.explode("ANNOUNCE"),
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
56 |
""" |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
57 |
IMPORTANT NOTE |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
58 |
============== |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
59 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
60 |
This is a snapshot of Isabelle/""" + id + """ from the repository. |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
61 |
""") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
62 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
63 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
64 |
|
| 75393 | 65 |
def make_contrib(): Unit = {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
66 |
Isabelle_System.make_directory(Components.contrib(isabelle_dir)) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
67 |
File.write(Components.contrib(isabelle_dir, name = "README"), |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
68 |
"""This directory contains add-on components that contribute to the main |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
69 |
Isabelle distribution. Separate licensing conditions apply, see each |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
70 |
directory individually. |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
71 |
""") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
72 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
73 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
74 |
def bundle_info(platform: Platform.Family.Value): Bundle_Info = |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
75 |
platform match {
|
| 73637 | 76 |
case Platform.Family.linux_arm => |
77 |
Bundle_Info(platform, "Linux (ARM)", dist_name + "_linux_arm.tar.gz") |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
78 |
case Platform.Family.linux => Bundle_Info(platform, "Linux", dist_name + "_linux.tar.gz") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
79 |
case Platform.Family.macos => Bundle_Info(platform, "macOS", dist_name + "_macos.tar.gz") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
80 |
case Platform.Family.windows => Bundle_Info(platform, "Windows", dist_name + ".exe") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
81 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
82 |
} |
| 69174 | 83 |
|
84 |
sealed case class Bundle_Info( |
|
| 69410 | 85 |
platform: Platform.Family.Value, |
| 69174 | 86 |
platform_description: String, |
| 75393 | 87 |
name: String |
88 |
) {
|
|
|
69432
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
wenzelm
parents:
69425
diff
changeset
|
89 |
def path: Path = Path.explode(name) |
| 69174 | 90 |
} |
91 |
||
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
92 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
93 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
94 |
/** release archive **/ |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
95 |
|
| 73629 | 96 |
val ISABELLE: Path = Path.basic("Isabelle")
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
97 |
val ISABELLE_ID: Path = Path.explode("etc/ISABELLE_ID")
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
98 |
val ISABELLE_TAGS: Path = Path.explode("etc/ISABELLE_TAGS")
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
99 |
val ISABELLE_IDENTIFIER: Path = Path.explode("etc/ISABELLE_IDENTIFIER")
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
100 |
|
| 75393 | 101 |
object Release_Archive {
|
102 |
def make(bytes: Bytes, rename: String = ""): Release_Archive = {
|
|
| 75491 | 103 |
Isabelle_System.with_tmp_dir("build_release")(dir =>
|
| 75394 | 104 |
Isabelle_System.with_tmp_file("archive", ext = "tar.gz") { archive_path =>
|
| 73629 | 105 |
val isabelle_dir = Isabelle_System.make_directory(dir + ISABELLE) |
106 |
||
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
107 |
Bytes.write(archive_path, bytes) |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76519
diff
changeset
|
108 |
execute_tar(isabelle_dir, "-xzf " + File.bash_path(archive_path), strip = true) |
| 73629 | 109 |
|
110 |
val id = File.read(isabelle_dir + ISABELLE_ID) |
|
111 |
val tags = File.read(isabelle_dir + ISABELLE_TAGS) |
|
112 |
val identifier = File.read(isabelle_dir + ISABELLE_IDENTIFIER) |
|
| 69174 | 113 |
|
| 73629 | 114 |
val (bytes1, identifier1) = |
115 |
if (rename.isEmpty || rename == identifier) (bytes, identifier) |
|
116 |
else {
|
|
117 |
File.write(isabelle_dir + ISABELLE_IDENTIFIER, rename) |
|
118 |
Isabelle_System.move_file(isabelle_dir, dir + Path.basic(rename)) |
|
119 |
execute_tar(dir, "-czf " + File.bash_path(archive_path) + " " + Bash.string(rename)) |
|
120 |
(Bytes.read(archive_path), rename) |
|
121 |
} |
|
122 |
new Release_Archive(bytes1, id, tags, identifier1) |
|
| 75394 | 123 |
} |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
124 |
) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
125 |
} |
| 69174 | 126 |
|
| 73629 | 127 |
def read(path: Path, rename: String = ""): Release_Archive = |
128 |
make(Bytes.read(path), rename = rename) |
|
129 |
||
| 75393 | 130 |
def get( |
131 |
url: String, |
|
132 |
rename: String = "", |
|
133 |
progress: Progress = new Progress |
|
134 |
): Release_Archive = {
|
|
| 73629 | 135 |
val bytes = |
136 |
if (Path.is_wellformed(url)) Bytes.read(Path.explode(url)) |
|
137 |
else Isabelle_System.download(url, progress = progress).bytes |
|
138 |
make(bytes, rename = rename) |
|
139 |
} |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
140 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
141 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
142 |
case class Release_Archive private[Build_Release]( |
| 75393 | 143 |
bytes: Bytes, id: String, tags: String, identifier: String) {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
144 |
override def toString: String = identifier |
| 69174 | 145 |
} |
146 |
||
147 |
||
148 |
||
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
149 |
/** generated content **/ |
|
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
150 |
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
151 |
/* bundled components */ |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
152 |
|
| 75393 | 153 |
class Bundled(platform: Option[Platform.Family.Value] = None) {
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
154 |
def detect(s: String): Boolean = |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
155 |
s.startsWith("#bundled") && !s.startsWith("#bundled ")
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
156 |
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
157 |
def apply(name: String): String = |
| 69410 | 158 |
"#bundled" + (platform match { case None => "" case Some(plat) => "-" + plat }) + ":" + name
|
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
159 |
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
160 |
private val Pattern1 = ("""^#bundled:(.*)$""").r
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
161 |
private val Pattern2 = ("""^#bundled-(.*):(.*)$""").r
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
162 |
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
163 |
def unapply(s: String): Option[String] = |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
164 |
s match {
|
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
165 |
case Pattern1(name) => Some(name) |
| 69410 | 166 |
case Pattern2(Platform.Family(plat), name) if platform == Some(plat) => Some(name) |
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
167 |
case _ => None |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
168 |
} |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
169 |
} |
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
170 |
|
| 75393 | 171 |
def record_bundled_components(dir: Path): Unit = {
|
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
172 |
val catalogs = |
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
173 |
List("main", "bundled").map((_, new Bundled())) :::
|
| 73637 | 174 |
Platform.Family.list.flatMap(platform => |
| 69410 | 175 |
List(platform.toString, "bundled-" + platform.toString). |
176 |
map((_, new Bundled(platform = Some(platform))))) |
|
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
177 |
|
| 76519 | 178 |
File.append(Components.Directory(dir).components, |
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
179 |
terminate_lines("#bundled components" ::
|
|
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
180 |
(for {
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
181 |
(catalog, bundled) <- catalogs.iterator |
| 71601 | 182 |
path = Components.admin(dir) + Path.basic(catalog) |
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
183 |
if path.is_file |
|
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
184 |
line <- split_lines(File.read(path)) |
|
73987
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73894
diff
changeset
|
185 |
if line.nonEmpty && !line.startsWith("#")
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
186 |
} yield bundled(line)).toList)) |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
187 |
} |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
188 |
|
| 75393 | 189 |
def get_bundled_components(dir: Path, platform: Platform.Family.Value): (List[String], String) = {
|
| 69410 | 190 |
val Bundled = new Bundled(platform = Some(platform)) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
191 |
val components = |
| 76519 | 192 |
for { Bundled(name) <- Components.Directory(dir).read_components() } yield name
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
193 |
val jdk_component = |
|
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
194 |
components.find(_.startsWith("jdk")) getOrElse error("Missing jdk component")
|
|
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
195 |
(components, jdk_component) |
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
196 |
} |
|
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
197 |
|
| 73340 | 198 |
def activate_components( |
| 75393 | 199 |
dir: Path, platform: Platform.Family.Value, more_names: List[String]): Unit = {
|
| 69413 | 200 |
def contrib_name(name: String): String = |
201 |
Components.contrib(name = name).implode |
|
202 |
||
| 69410 | 203 |
val Bundled = new Bundled(platform = Some(platform)) |
| 76519 | 204 |
val component_dir = Components.Directory(dir) |
205 |
component_dir.write_components( |
|
206 |
component_dir.read_components().flatMap(line => |
|
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
207 |
line match {
|
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
208 |
case Bundled(name) => |
| 76550 | 209 |
if (Components.Directory(Components.contrib(dir, name)).ok) Some(contrib_name(name)) |
|
69395
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
210 |
else None |
|
d1c4a1dee9e7
more explicit support for Isabelle system components;
wenzelm
parents:
69392
diff
changeset
|
211 |
case _ => if (Bundled.detect(line)) None else Some(line) |
| 71601 | 212 |
}) ::: more_names.map(contrib_name)) |
|
69391
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
wenzelm
parents:
69390
diff
changeset
|
213 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
214 |
|
|
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
215 |
|
|
70099
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
216 |
/** build release **/ |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
217 |
|
| 73634 | 218 |
/* build heaps */ |
|
70099
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
219 |
|
| 73634 | 220 |
private def build_heaps( |
| 70101 | 221 |
options: Options, |
222 |
platform: Platform.Family.Value, |
|
223 |
build_sessions: List[String], |
|
| 75796 | 224 |
local_dir: Path, |
225 |
progress: Progress = new Progress, |
|
| 75393 | 226 |
): Unit = {
|
| 72341 | 227 |
val server_option = "build_host_" + platform.toString |
| 75796 | 228 |
val server = options.string(server_option) |
| 76156 | 229 |
progress.echo("Building heaps for " + commas_quote(build_sessions) +
|
| 75796 | 230 |
" (" + server_option + " = " + quote(server) + ") ...")
|
231 |
||
| 73634 | 232 |
val ssh = |
|
76169
a3c694039fd6
discontinued pointless SSH.Target: OpenSSH client can handle user@host directly;
wenzelm
parents:
76160
diff
changeset
|
233 |
if (server.nonEmpty) SSH.open_session(options, server) |
|
a3c694039fd6
discontinued pointless SSH.Target: OpenSSH client can handle user@host directly;
wenzelm
parents:
76160
diff
changeset
|
234 |
else if (Platform.family == platform) SSH.Local |
|
a3c694039fd6
discontinued pointless SSH.Target: OpenSSH client can handle user@host directly;
wenzelm
parents:
76160
diff
changeset
|
235 |
else error("Undefined option " + server_option + ": cannot build heaps")
|
|
a3c694039fd6
discontinued pointless SSH.Target: OpenSSH client can handle user@host directly;
wenzelm
parents:
76160
diff
changeset
|
236 |
|
| 73634 | 237 |
try {
|
| 75394 | 238 |
Isabelle_System.with_tmp_file("tmp", ext = "tar") { local_tmp_tar =>
|
| 73634 | 239 |
execute_tar(local_dir, "-cf " + File.bash_path(local_tmp_tar) + " .") |
| 75394 | 240 |
ssh.with_tmp_dir { remote_dir =>
|
| 73634 | 241 |
val remote_tmp_tar = remote_dir + Path.basic("tmp.tar")
|
242 |
ssh.write_file(remote_tmp_tar, local_tmp_tar) |
|
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
243 |
|
|
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
244 |
val build_command = |
|
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
245 |
"bin/isabelle build -o system_heaps -b -- " + Bash.strings(build_sessions) |
|
76379
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
246 |
def system_apple(b: Boolean): String = |
|
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
247 |
"""{ echo "ML_system_apple = """ + b + """" > "$(bin/isabelle getenv -b ISABELLE_HOME_USER)/etc/preferences"; }"""
|
|
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
248 |
|
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
249 |
val build_script = |
| 73634 | 250 |
List( |
251 |
"cd " + File.bash_path(remote_dir), |
|
252 |
"tar -xf tmp.tar", |
|
|
76379
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
253 |
"""mkdir -p "$(bin/isabelle getenv -b ISABELLE_HOME_USER)/etc" """, |
|
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
254 |
system_apple(false), |
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
255 |
build_command, |
|
76379
e0f3fda92990
more robust etc/preferences: default value remains;
wenzelm
parents:
76275
diff
changeset
|
256 |
system_apple(true), |
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
257 |
build_command, |
| 73634 | 258 |
"tar -cf tmp.tar heaps") |
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
259 |
ssh.execute(build_script.mkString(" && "), settings = false).check
|
| 73634 | 260 |
ssh.read_file(remote_tmp_tar, local_tmp_tar) |
| 75394 | 261 |
} |
|
76158
0302bdf63a08
build both arm64-darwin and x86_64-darwin on Apple ARM hardware;
wenzelm
parents:
76156
diff
changeset
|
262 |
execute_tar(local_dir, "-xvf " + File.bash_path(local_tmp_tar)) |
|
77509
3bc49507bae5
clarified treatment of "verbose" messages, e.g. Progress.theory();
wenzelm
parents:
77100
diff
changeset
|
263 |
.out_lines.sorted.foreach(progress.echo(_)) |
| 75394 | 264 |
} |
|
70099
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
265 |
} |
| 73634 | 266 |
finally { ssh.close() }
|
|
70099
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
267 |
} |
|
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
268 |
|
|
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
269 |
|
| 73066 | 270 |
/* Isabelle application */ |
| 73060 | 271 |
|
| 75393 | 272 |
def make_isabelle_options(path: Path, options: List[String], line_ending: String = "\n"): Unit = {
|
|
73068
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
273 |
val title = "# Java runtime options" |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
274 |
File.write(path, (title :: options).map(_ + line_ending).mkString) |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
275 |
} |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
276 |
|
| 73065 | 277 |
def make_isabelle_app( |
| 73193 | 278 |
platform: Platform.Family.Value, |
279 |
isabelle_target: Path, |
|
280 |
isabelle_name: String, |
|
| 73065 | 281 |
jdk_component: String, |
| 73095 | 282 |
classpath: List[Path], |
| 75393 | 283 |
dock_icon: Boolean = false): Unit = {
|
| 73064 | 284 |
val script = """#!/usr/bin/env bash |
| 73060 | 285 |
# |
286 |
# Author: Makarius |
|
287 |
# |
|
288 |
# Main Isabelle application script. |
|
289 |
||
290 |
# minimal Isabelle environment |
|
291 |
||
| 73193 | 292 |
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)/../.."; pwd)" |
| 73060 | 293 |
source "$ISABELLE_HOME/lib/scripts/isabelle-platform" |
294 |
||
| 73063 | 295 |
#paranoia settings -- avoid intrusion of alien options |
296 |
unset "_JAVA_OPTIONS" |
|
297 |
unset "JAVA_TOOL_OPTIONS" |
|
298 |
||
299 |
#paranoia settings -- avoid problems of Java/Swing versus XIM/IBus etc. |
|
300 |
unset XMODIFIERS |
|
301 |
||
| 73062 | 302 |
COMPONENT="$ISABELLE_HOME/contrib/""" + jdk_component + """" |
303 |
source "$COMPONENT/etc/settings" |
|
304 |
||
| 73060 | 305 |
|
| 73063 | 306 |
# main |
| 73060 | 307 |
|
| 73703 | 308 |
declare -a JAVA_OPTIONS=($(grep -v '^#' "$ISABELLE_HOME/Isabelle.options")) |
| 73060 | 309 |
|
|
73197
d967f6643f5e
proper Isabelle environment (amending 31fbde3baa97);
wenzelm
parents:
73193
diff
changeset
|
310 |
"$ISABELLE_HOME/bin/isabelle" env "$ISABELLE_HOME/lib/scripts/java-gui-setup" |
|
73153
96d87b9c2b42
workaround for Big Sur fullscreen mode: better support for JDialog windows (e.g. Find on top of main View);
wenzelm
parents:
73152
diff
changeset
|
311 |
|
| 73062 | 312 |
exec "$ISABELLE_JDK_HOME/bin/java" \ |
| 73060 | 313 |
"-Disabelle.root=$ISABELLE_HOME" "${JAVA_OPTIONS[@]}" \
|
| 73061 | 314 |
-classpath """" + classpath.map(p => "$ISABELLE_HOME/" + p.implode).mkString(":") + """" \
|
| 73060 | 315 |
"-splash:$ISABELLE_HOME/lib/logo/isabelle.gif" \ |
| 73095 | 316 |
""" + (if (dock_icon) """"-Xdock:icon=$ISABELLE_HOME/lib/logo/isabelle_transparent-128.png" \ |
| 75291 | 317 |
""" else "") + """isabelle.jedit.JEdit_Main "$@" |
| 73060 | 318 |
""" |
| 73193 | 319 |
val script_path = isabelle_target + Path.explode("lib/scripts/Isabelle_app")
|
320 |
File.write(script_path, script) |
|
321 |
File.set_executable(script_path, true) |
|
322 |
||
323 |
val component_dir = isabelle_target + Path.explode("contrib/Isabelle_app")
|
|
| 73317 | 324 |
Isabelle_System.move_file( |
| 73637 | 325 |
component_dir + Path.explode(Platform.Family.standard(platform)) + Path.explode("Isabelle"),
|
| 73193 | 326 |
isabelle_target + Path.explode(isabelle_name)) |
327 |
Isabelle_System.rm_tree(component_dir) |
|
| 73064 | 328 |
} |
| 73060 | 329 |
|
330 |
||
| 75393 | 331 |
def make_isabelle_plist(path: Path, isabelle_name: String, isabelle_rev: String): Unit = {
|
| 73066 | 332 |
File.write(path, """<?xml version="1.0" ?> |
333 |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
334 |
<plist version="1.0"> |
|
335 |
<dict> |
|
336 |
<key>CFBundleDevelopmentRegion</key> |
|
337 |
<string>English</string> |
|
|
73075
893310d6d76d
recovered bundle icons (not application) from macos_app;
wenzelm
parents:
73074
diff
changeset
|
338 |
<key>CFBundleIconFile</key> |
|
893310d6d76d
recovered bundle icons (not application) from macos_app;
wenzelm
parents:
73074
diff
changeset
|
339 |
<string>isabelle.icns</string> |
| 73066 | 340 |
<key>CFBundleIdentifier</key> |
|
73152
5a954fd5f078
clarified app identification, potentially relevant for macOS "defaults";
wenzelm
parents:
73112
diff
changeset
|
341 |
<string>de.tum.in.isabelle</string> |
| 73066 | 342 |
<key>CFBundleDisplayName</key> |
343 |
<string>""" + isabelle_name + """</string> |
|
344 |
<key>CFBundleInfoDictionaryVersion</key> |
|
345 |
<string>6.0</string> |
|
346 |
<key>CFBundleName</key> |
|
347 |
<string>""" + isabelle_name + """</string> |
|
348 |
<key>CFBundlePackageType</key> |
|
349 |
<string>APPL</string> |
|
350 |
<key>CFBundleShortVersionString</key> |
|
|
73152
5a954fd5f078
clarified app identification, potentially relevant for macOS "defaults";
wenzelm
parents:
73112
diff
changeset
|
351 |
<string>""" + isabelle_name + """</string> |
| 73066 | 352 |
<key>CFBundleSignature</key> |
353 |
<string>????</string> |
|
354 |
<key>CFBundleVersion</key> |
|
|
73152
5a954fd5f078
clarified app identification, potentially relevant for macOS "defaults";
wenzelm
parents:
73112
diff
changeset
|
355 |
<string>""" + isabelle_rev + """</string> |
| 73066 | 356 |
<key>NSHumanReadableCopyright</key> |
357 |
<string></string> |
|
358 |
<key>LSMinimumSystemVersion</key> |
|
| 73085 | 359 |
<string>10.11</string> |
| 73066 | 360 |
<key>LSApplicationCategoryType</key> |
361 |
<string>public.app-category.developer-tools</string> |
|
362 |
<key>NSHighResolutionCapable</key> |
|
363 |
<string>true</string> |
|
364 |
<key>NSSupportsAutomaticGraphicsSwitching</key> |
|
365 |
<string>true</string> |
|
366 |
<key>CFBundleDocumentTypes</key> |
|
367 |
<array> |
|
368 |
<dict> |
|
369 |
<key>CFBundleTypeExtensions</key> |
|
370 |
<array> |
|
371 |
<string>thy</string> |
|
372 |
</array> |
|
| 73077 | 373 |
<key>CFBundleTypeIconFile</key> |
374 |
<string>theory.icns</string> |
|
| 73066 | 375 |
<key>CFBundleTypeName</key> |
376 |
<string>Isabelle theory file</string> |
|
377 |
<key>CFBundleTypeRole</key> |
|
378 |
<string>Editor</string> |
|
379 |
<key>LSTypeIsPackage</key> |
|
380 |
<false/> |
|
381 |
</dict> |
|
382 |
</array> |
|
383 |
</dict> |
|
384 |
</plist> |
|
385 |
""") |
|
386 |
} |
|
387 |
||
388 |
||
|
77040
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
389 |
/* NEWS */ |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
390 |
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
391 |
private def make_news(other_isabelle: Other_Isabelle): Unit = {
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
392 |
val news_file = other_isabelle.isabelle_home + Path.explode("NEWS")
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
393 |
val doc_dir = other_isabelle.isabelle_home + Path.explode("doc")
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
394 |
val fonts_dir = Isabelle_System.make_directory(doc_dir + Path.explode("fonts"))
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
395 |
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
396 |
Isabelle_Fonts.make_entries(getenv = other_isabelle.getenv, hidden = true). |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
397 |
foreach(entry => Isabelle_System.copy_file(entry.path, fonts_dir)) |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
398 |
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
399 |
HTML.write_document(doc_dir, "NEWS.html", |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
400 |
List(HTML.title("NEWS")),
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
401 |
List( |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
402 |
HTML.chapter("NEWS"),
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
403 |
HTML.source(Symbol.decode(File.read(news_file))))) |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
404 |
} |
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
405 |
|
|
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
406 |
|
| 73064 | 407 |
/* main */ |
|
70099
9b9c1192f972
support for platform-specific builds on remote server;
wenzelm
parents:
70098
diff
changeset
|
408 |
|
| 73629 | 409 |
def use_release_archive( |
410 |
context: Release_Context, |
|
411 |
archive: Release_Archive, |
|
| 75393 | 412 |
id: String = "" |
413 |
): Unit = {
|
|
| 73629 | 414 |
if (id.nonEmpty && id != archive.id) {
|
415 |
error("Mismatch of release identification " + id + " vs. archive " + archive.id)
|
|
416 |
} |
|
417 |
||
418 |
if (!context.isabelle_archive.is_file || Bytes.read(context.isabelle_archive) != archive.bytes) {
|
|
419 |
Bytes.write(context.isabelle_archive, archive.bytes) |
|
420 |
} |
|
421 |
} |
|
422 |
||
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
423 |
def build_release_archive( |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
424 |
context: Release_Context, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
425 |
version: String, |
| 75393 | 426 |
parallel_jobs: Int = 1 |
427 |
): Unit = {
|
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
428 |
val progress = context.progress |
| 69174 | 429 |
|
| 75506 | 430 |
val hg = Mercurial.self_repository() |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
431 |
val id = |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
432 |
try { hg.id(version) }
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
433 |
catch { case ERROR(msg) => cat_error("Bad repository version: " + version, msg) }
|
| 64202 | 434 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
435 |
if (context.isabelle_archive.is_file) {
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
436 |
progress.echo_warning("Found existing release archive: " + context.isabelle_archive)
|
| 73629 | 437 |
use_release_archive(context, Release_Archive.read(context.isabelle_archive), id = id) |
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
438 |
} |
|
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
439 |
else {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
440 |
progress.echo_warning("Preparing release " + context.dist_name + " ...")
|
| 64221 | 441 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
442 |
Isabelle_System.new_directory(context.dist_dir) |
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
443 |
|
| 76883 | 444 |
hg.archive(File.standard_path(context.isabelle_dir), rev = id) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
445 |
|
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
446 |
for (name <- List(".hg_archival.txt", ".hgtags", ".hgignore", "README_REPOSITORY")) {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
447 |
(context.isabelle_dir + Path.explode(name)).file.delete |
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
448 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
449 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
450 |
File.write(context.isabelle_dir + ISABELLE_ID, id) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
451 |
File.write(context.isabelle_dir + ISABELLE_TAGS, hg.tags(rev = id)) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
452 |
File.write(context.isabelle_dir + ISABELLE_IDENTIFIER, context.dist_name) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
453 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
454 |
context.make_announce(id) |
|
73520
4cba4e250c28
clarified ISABELLE_ID: distribution vs. hg archive vs. hg repos;
wenzelm
parents:
73519
diff
changeset
|
455 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
456 |
context.make_contrib() |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
457 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
458 |
execute(context.isabelle_dir, """find . -print | xargs chmod -f u+rw""") |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
459 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
460 |
record_bundled_components(context.isabelle_dir) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
461 |
|
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
462 |
|
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
463 |
/* build tools and documentation */ |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
464 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
465 |
val other_isabelle = context.other_isabelle(context.dist_dir) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
466 |
|
| 77095 | 467 |
other_isabelle.init(echo = true) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
468 |
|
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
469 |
try {
|
|
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
470 |
other_isabelle.bash( |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
471 |
"bin/isabelle build_doc -a -o system_heaps -j " + parallel_jobs, echo = true).check |
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
472 |
} |
| 71936 | 473 |
catch { case ERROR(msg) => cat_error("Failed to build documentation:", msg) }
|
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
474 |
|
|
77040
96879e303ea3
clarified modules (again, in contrast to f8f065e20837);
wenzelm
parents:
76883
diff
changeset
|
475 |
make_news(other_isabelle) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
476 |
|
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
477 |
for (name <- List("Admin", "browser_info", "heaps")) {
|
|
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
478 |
Isabelle_System.rm_tree(other_isabelle.isabelle_home + Path.explode(name)) |
|
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
479 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
480 |
|
|
69171
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
wenzelm
parents:
69170
diff
changeset
|
481 |
other_isabelle.cleanup() |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
482 |
|
|
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
483 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
484 |
progress.echo_warning("Creating release archive " + context.isabelle_archive + " ...")
|
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
485 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
486 |
execute(context.dist_dir, """chmod -R a+r . && chmod -R u+w . && chmod -R g=o .""") |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
487 |
execute(context.dist_dir, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
488 |
"""find . -type f "(" -name "*.thy" -o -name "*.ML" -o -name "*.scala" ")" -print | xargs chmod -f u-w""")
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
489 |
execute_tar(context.dist_dir, "-czf " + |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
490 |
File.bash_path(context.isabelle_archive) + " " + Bash.string(context.dist_name)) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
491 |
} |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
492 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
493 |
|
| 73642 | 494 |
def default_platform_families: List[Platform.Family.Value] = Platform.Family.list0 |
495 |
||
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
496 |
def build_release( |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
497 |
options: Options, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
498 |
context: Release_Context, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
499 |
afp_rev: String = "", |
| 73642 | 500 |
platform_families: List[Platform.Family.Value] = default_platform_families, |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
501 |
more_components: List[Path] = Nil, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
502 |
website: Option[Path] = None, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
503 |
build_sessions: List[String] = Nil, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
504 |
build_library: Boolean = false, |
| 75393 | 505 |
parallel_jobs: Int = 1 |
506 |
): Unit = {
|
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
507 |
val progress = context.progress |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
508 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
509 |
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
510 |
/* release directory */ |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
511 |
|
| 73629 | 512 |
val archive = Release_Archive.read(context.isabelle_archive) |
513 |
||
514 |
for (path <- List(context.isabelle, ISABELLE)) {
|
|
515 |
Isabelle_System.rm_tree(context.dist_dir + path) |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
516 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
517 |
|
| 75394 | 518 |
Isabelle_System.with_tmp_file("archive", ext = "tar.gz") { archive_path =>
|
| 73629 | 519 |
Bytes.write(archive_path, archive.bytes) |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
520 |
val extract = |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
521 |
List("README", "NEWS", "ANNOUNCE", "COPYRIGHT", "CONTRIBUTORS", "doc").
|
| 73631 | 522 |
map(name => context.dist_name + "/" + name) |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
523 |
execute_tar(context.dist_dir, |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
524 |
"-xzf " + File.bash_path(archive_path) + " " + Bash.strings(extract)) |
| 75394 | 525 |
} |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
526 |
|
| 73629 | 527 |
Isabelle_System.symlink(Path.explode(context.dist_name), context.dist_dir + ISABELLE) |
| 64202 | 528 |
|
529 |
||
530 |
/* make application bundles */ |
|
531 |
||
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
532 |
val bundle_infos = platform_families.map(context.bundle_info) |
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
533 |
|
| 66730 | 534 |
for (bundle_info <- bundle_infos) {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
535 |
val isabelle_name = context.dist_name |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
536 |
val platform = bundle_info.platform |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
537 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
538 |
progress.echo("\nApplication bundle for " + platform)
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
539 |
|
| 75394 | 540 |
Isabelle_System.with_tmp_dir("build_release") { tmp_dir =>
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
541 |
// release archive |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
542 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
543 |
execute_tar(tmp_dir, "-xzf " + File.bash_path(context.isabelle_archive)) |
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
544 |
val other_isabelle = context.other_isabelle(tmp_dir) |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
545 |
val isabelle_target = other_isabelle.isabelle_home |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
546 |
|
|
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
547 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
548 |
// bundled components |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
549 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
550 |
progress.echo("Bundled components:")
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
551 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
552 |
val contrib_dir = Components.contrib(isabelle_target) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
553 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
554 |
val (bundled_components, jdk_component) = |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
555 |
get_bundled_components(isabelle_target, platform) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
556 |
|
| 77067 | 557 |
for (name <- bundled_components) {
|
|
77088
6e2c6ccc5dc0
clarified defaults: imitate "isabelle components -I" without further parameters;
wenzelm
parents:
77072
diff
changeset
|
558 |
Components.resolve(Components.default_components_base, name, |
| 77067 | 559 |
target_dir = Some(contrib_dir), |
560 |
copy_dir = Some(context.dist_dir + Path.explode("contrib")),
|
|
561 |
progress = progress) |
|
562 |
} |
|
| 69413 | 563 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
564 |
val more_components_names = |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
565 |
more_components.map(Components.unpack(contrib_dir, _, progress = progress)) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
566 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
567 |
activate_components(isabelle_target, platform, more_components_names) |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
568 |
|
|
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
569 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
570 |
// Java parameters |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
571 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
572 |
val java_options: List[String] = |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
573 |
(for {
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
574 |
variable <- |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
575 |
List( |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
576 |
"ISABELLE_JAVA_SYSTEM_OPTIONS", |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
577 |
"JEDIT_JAVA_SYSTEM_OPTIONS", |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
578 |
"JEDIT_JAVA_OPTIONS") |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
579 |
opt <- Word.explode(other_isabelle.getenv(variable)) |
|
73068
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
580 |
} |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
581 |
yield {
|
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
582 |
val s = "-Dapple.awt.application.name=" |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
583 |
if (opt.startsWith(s)) s + isabelle_name else opt |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
584 |
}) ::: List("-Disabelle.jedit_server=" + isabelle_name)
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
585 |
|
| 75393 | 586 |
val classpath: List[Path] = {
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
587 |
val base = isabelle_target.absolute |
| 73988 | 588 |
val classpath1 = Path.split(other_isabelle.getenv("ISABELLE_CLASSPATH"))
|
589 |
val classpath2 = Path.split(other_isabelle.getenv("ISABELLE_SETUP_CLASSPATH"))
|
|
| 75394 | 590 |
(classpath1 ::: classpath2).map { path =>
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
591 |
val abs_path = path.absolute |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
592 |
File.relative_path(base, abs_path) match {
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
593 |
case Some(rel_path) => rel_path |
| 73988 | 594 |
case None => error("Bad classpath element: " + abs_path)
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
595 |
} |
| 75394 | 596 |
} |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
597 |
} |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
598 |
|
|
71542
e76692ec6e5a
more usable defaults for high resolution on Linux, where the desktop environment usually lacks automatic scaling;
wenzelm
parents:
71459
diff
changeset
|
599 |
val jedit_options = Path.explode("src/Tools/jEdit/etc/options")
|
|
73987
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73894
diff
changeset
|
600 |
val jedit_props = |
|
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
wenzelm
parents:
73894
diff
changeset
|
601 |
Path.explode(other_isabelle.getenv("JEDIT_HOME") + "/properties/jEdit.props")
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
602 |
|
|
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
603 |
|
| 70101 | 604 |
// build heaps |
605 |
||
606 |
if (build_sessions.nonEmpty) {
|
|
| 75796 | 607 |
build_heaps(options, platform, build_sessions, isabelle_target, progress = progress) |
| 70101 | 608 |
} |
609 |
||
610 |
||
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
611 |
// application bundling |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
612 |
|
| 77100 | 613 |
Components.clean_base(contrib_dir, platforms = List(platform)) |
|
73990
778ab9983f40
proper cross-platform build: jdk component is required for ISABELLE_SETUP_CLASSPATH in other_isabelle;
wenzelm
parents:
73988
diff
changeset
|
614 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
615 |
platform match {
|
| 73637 | 616 |
case Platform.Family.linux_arm | Platform.Family.linux => |
| 75202 | 617 |
File.change(isabelle_target + jedit_options) {
|
618 |
_.replaceAll("jedit_reset_font_size : int =.*", "jedit_reset_font_size : int = 24")
|
|
619 |
} |
|
|
71542
e76692ec6e5a
more usable defaults for high resolution on Linux, where the desktop environment usually lacks automatic scaling;
wenzelm
parents:
71459
diff
changeset
|
620 |
|
| 75202 | 621 |
File.change(isabelle_target + jedit_props) {
|
| 72378 | 622 |
_.replaceAll("console.fontsize=.*", "console.fontsize=18")
|
623 |
.replaceAll("helpviewer.fontsize=.*", "helpviewer.fontsize=18")
|
|
624 |
.replaceAll("metal.primary.fontsize=.*", "metal.primary.fontsize=18")
|
|
625 |
.replaceAll("metal.secondary.fontsize=.*", "metal.secondary.fontsize=18")
|
|
626 |
.replaceAll("view.fontsize=.*", "view.fontsize=24")
|
|
| 75202 | 627 |
.replaceAll("view.gutter.fontsize=.*", "view.gutter.fontsize=16")
|
628 |
} |
|
|
71542
e76692ec6e5a
more usable defaults for high resolution on Linux, where the desktop environment usually lacks automatic scaling;
wenzelm
parents:
71459
diff
changeset
|
629 |
|
|
73068
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
630 |
make_isabelle_options( |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
631 |
isabelle_target + Path.explode("Isabelle.options"), java_options)
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
632 |
|
| 73193 | 633 |
make_isabelle_app(platform, isabelle_target, isabelle_name, jdk_component, classpath) |
| 69417 | 634 |
|
| 73637 | 635 |
progress.echo("Packaging " + bundle_info.name + " ...")
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
636 |
execute_tar(tmp_dir, |
| 73637 | 637 |
"-czf " + File.bash_path(context.dist_dir + bundle_info.path) + " " + |
| 70242 | 638 |
Bash.string(isabelle_name)) |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
639 |
|
|
69432
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
wenzelm
parents:
69425
diff
changeset
|
640 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
641 |
case Platform.Family.macos => |
| 75202 | 642 |
File.change(isabelle_target + jedit_props) {
|
| 73112 | 643 |
_.replaceAll("delete-line.shortcut=.*", "delete-line.shortcut=C+d")
|
| 75202 | 644 |
.replaceAll("delete.shortcut2=.*", "delete.shortcut2=A+d")
|
645 |
} |
|
| 69417 | 646 |
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
647 |
|
| 73193 | 648 |
// macOS application bundle |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
649 |
|
| 73193 | 650 |
val app_contents = isabelle_target + Path.explode("Contents")
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
651 |
|
| 73077 | 652 |
for (icon <- List("lib/logo/isabelle.icns", "lib/logo/theory.icns")) {
|
| 73317 | 653 |
Isabelle_System.copy_file(isabelle_target + Path.explode(icon), |
| 73193 | 654 |
Isabelle_System.make_directory(app_contents + Path.explode("Resources")))
|
| 73077 | 655 |
} |
|
73075
893310d6d76d
recovered bundle icons (not application) from macos_app;
wenzelm
parents:
73074
diff
changeset
|
656 |
|
| 73083 | 657 |
make_isabelle_plist( |
| 73629 | 658 |
app_contents + Path.explode("Info.plist"), isabelle_name, archive.id)
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
659 |
|
| 73193 | 660 |
make_isabelle_app(platform, isabelle_target, isabelle_name, jdk_component, |
661 |
classpath, dock_icon = true) |
|
662 |
||
663 |
val isabelle_options = Path.explode("Isabelle.options")
|
|
664 |
make_isabelle_options( |
|
665 |
isabelle_target + isabelle_options, |
|
666 |
java_options ::: List("-Disabelle.app=true"))
|
|
667 |
||
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
668 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
669 |
// application archive |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
670 |
|
| 73637 | 671 |
progress.echo("Packaging " + bundle_info.name + " ...")
|
| 73193 | 672 |
|
673 |
val isabelle_app = Path.explode(isabelle_name + ".app") |
|
| 73317 | 674 |
Isabelle_System.move_file(tmp_dir + Path.explode(isabelle_name), |
675 |
tmp_dir + isabelle_app) |
|
| 73193 | 676 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
677 |
execute_tar(tmp_dir, |
| 73637 | 678 |
"-czf " + File.bash_path(context.dist_dir + bundle_info.path) + " " + |
| 70242 | 679 |
File.bash_path(isabelle_app)) |
|
69432
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
wenzelm
parents:
69425
diff
changeset
|
680 |
|
| 69417 | 681 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
682 |
case Platform.Family.windows => |
| 75202 | 683 |
File.change(isabelle_target + jedit_props) {
|
684 |
_.replaceAll("foldPainter=.*", "foldPainter=Square")
|
|
685 |
} |
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
686 |
|
|
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
687 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
688 |
// application launcher |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
689 |
|
| 73317 | 690 |
Isabelle_System.move_file(isabelle_target + Path.explode("contrib/windows_app"), tmp_dir)
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
691 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
692 |
val app_template = Path.explode("~~/Admin/Windows/launch4j")
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
693 |
|
|
73068
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
694 |
make_isabelle_options( |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
695 |
isabelle_target + Path.explode(isabelle_name + ".l4j.ini"), |
|
a95f5ae5a12a
discontinued macOS JavaAppLauncher: re-use plain shell script;
wenzelm
parents:
73067
diff
changeset
|
696 |
java_options, line_ending = "\r\n") |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
697 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
698 |
val isabelle_xml = Path.explode("isabelle.xml")
|
| 73637 | 699 |
val isabelle_exe = bundle_info.path |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
700 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
701 |
File.write(tmp_dir + isabelle_xml, |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
702 |
File.read(app_template + isabelle_xml) |
| 72387 | 703 |
.replace("{ISABELLE_NAME}", isabelle_name)
|
704 |
.replace("{OUTFILE}", File.platform_path(isabelle_target + isabelle_exe))
|
|
705 |
.replace("{ICON}",
|
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
706 |
File.platform_path(app_template + Path.explode("isabelle_transparent.ico")))
|
| 72387 | 707 |
.replace("{SPLASH}",
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
708 |
File.platform_path(app_template + Path.explode("isabelle.bmp")))
|
| 72387 | 709 |
.replace("{CLASSPATH}",
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
710 |
cat_lines(classpath.map(cp => |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
711 |
" <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
|
| 72387 | 712 |
.replace("\\jdk\\", "\\" + jdk_component + "\\"))
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
713 |
|
|
74857
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
714 |
val java_opts = |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
715 |
bash_java_opens( |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
716 |
"java.base/java.io", |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
717 |
"java.base/java.lang", |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
718 |
"java.base/java.lang.reflect", |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
719 |
"java.base/java.text", |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
720 |
"java.base/java.util", |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
721 |
"java.desktop/java.awt.font") |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
722 |
val launch4j_jar = |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
723 |
Path.explode("windows_app/launch4j-" + Platform.family + "/launch4j.jar")
|
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
724 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
725 |
execute(tmp_dir, |
|
74857
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
726 |
cat_lines(List( |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
727 |
"export LAUNCH4J=" + File.bash_platform_path(launch4j_jar), |
|
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
728 |
"isabelle java " + java_opts + " -jar \"$LAUNCH4J\" isabelle.xml"))) |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
729 |
|
| 73317 | 730 |
Isabelle_System.copy_file(app_template + Path.explode("manifest.xml"),
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
731 |
isabelle_target + isabelle_exe.ext("manifest"))
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
732 |
|
|
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
733 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
734 |
// Cygwin setup |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
735 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
736 |
val cygwin_template = Path.explode("~~/Admin/Windows/Cygwin")
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
737 |
|
| 73317 | 738 |
Isabelle_System.copy_file(cygwin_template + Path.explode("Cygwin-Terminal.bat"),
|
739 |
isabelle_target) |
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
740 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
741 |
val cygwin_mirror = |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
742 |
File.read(isabelle_target + Path.explode("contrib/cygwin/isabelle/cygwin_mirror"))
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
743 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
744 |
val cygwin_bat = Path.explode("Cygwin-Setup.bat")
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
745 |
File.write(isabelle_target + cygwin_bat, |
| 72387 | 746 |
File.read(cygwin_template + cygwin_bat).replace("{MIRROR}", cygwin_mirror))
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
747 |
File.set_executable(isabelle_target + cygwin_bat, true) |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
748 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
749 |
for (name <- List("isabelle/postinstall", "isabelle/rebaseall")) {
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
750 |
val path = Path.explode(name) |
| 73317 | 751 |
Isabelle_System.copy_file(cygwin_template + path, |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
752 |
isabelle_target + Path.explode("contrib/cygwin") + path)
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
753 |
} |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
754 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
755 |
execute(isabelle_target, |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
756 |
"""find . -type f -not -name "*.exe" -not -name "*.dll" """ + |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
757 |
(if (Platform.is_macos) "-perm +100" else "-executable") + |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
758 |
" -print0 > contrib/cygwin/isabelle/executables") |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
759 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
760 |
execute(isabelle_target, |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
761 |
"""find . -type l -exec echo "{}" ";" -exec readlink "{}" ";" """ +
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
762 |
"""> contrib/cygwin/isabelle/symlinks""") |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
763 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
764 |
execute(isabelle_target, """find . -type l -exec rm "{}" ";" """)
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
765 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
766 |
File.write(isabelle_target + Path.explode("contrib/cygwin/isabelle/uninitialized"), "")
|
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
767 |
|
|
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
768 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
769 |
// executable archive (self-extracting 7z) |
|
69424
840f0cadeba8
clarified application bundling: discontinued redundant archives;
wenzelm
parents:
69417
diff
changeset
|
770 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
771 |
val archive_name = isabelle_name + ".7z" |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
772 |
val exe_archive = tmp_dir + Path.explode(archive_name) |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
773 |
exe_archive.file.delete |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
774 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
775 |
progress.echo("Packaging " + archive_name + " ...")
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
776 |
execute(tmp_dir, |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
777 |
"7z -y -bd a " + File.bash_path(exe_archive) + " " + Bash.string(isabelle_name)) |
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
778 |
if (!exe_archive.is_file) error("Failed to create archive: " + exe_archive)
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
779 |
|
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
780 |
val sfx_exe = tmp_dir + Path.explode("windows_app/7zsd_All_x64.sfx")
|
|
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
781 |
val sfx_txt = |
| 72387 | 782 |
File.read(Path.explode("~~/Admin/Windows/Installer/sfx.txt"))
|
783 |
.replace("{ISABELLE_NAME}", isabelle_name)
|
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
784 |
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
785 |
Bytes.write(context.dist_dir + isabelle_exe, |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
786 |
Bytes.read(sfx_exe) + Bytes(sfx_txt) + Bytes.read(exe_archive)) |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
787 |
File.set_executable(context.dist_dir + isabelle_exe, true) |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
788 |
} |
| 77046 | 789 |
|
790 |
other_isabelle.cleanup() |
|
| 75394 | 791 |
} |
|
70098
956d2430cb29
more robust: always (re)build platform application bundles;
wenzelm
parents:
70046
diff
changeset
|
792 |
progress.echo("DONE")
|
| 64202 | 793 |
} |
794 |
||
795 |
||
796 |
/* minimal website */ |
|
797 |
||
| 64361 | 798 |
for (dir <- website) {
|
799 |
val website_platform_bundles = |
|
800 |
for {
|
|
| 66730 | 801 |
bundle_info <- bundle_infos |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
802 |
if (context.dist_dir + bundle_info.path).is_file |
|
69432
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
wenzelm
parents:
69425
diff
changeset
|
803 |
} yield (bundle_info.name, bundle_info) |
| 64206 | 804 |
|
| 71275 | 805 |
val isabelle_link = |
| 73629 | 806 |
HTML.link(Isabelle_System.isabelle_repository.changeset(archive.id), |
807 |
HTML.text("Isabelle/" + archive.id))
|
|
|
64405
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
wenzelm
parents:
64371
diff
changeset
|
808 |
val afp_link = |
| 73610 | 809 |
HTML.link(Isabelle_System.afp_repository.changeset(afp_rev), |
810 |
HTML.text("AFP/" + afp_rev))
|
|
|
64405
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
wenzelm
parents:
64371
diff
changeset
|
811 |
|
| 65838 | 812 |
HTML.write_document(dir, "index.html", |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
813 |
List(HTML.title(context.dist_name)), |
| 65838 | 814 |
List( |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
815 |
HTML.section(context.dist_name), |
| 73626 | 816 |
HTML.subsection("Downloads"),
|
| 65838 | 817 |
HTML.itemize( |
| 73626 | 818 |
List(HTML.link(context.dist_name + ".tar.gz", HTML.text("Source archive"))) ::
|
| 66730 | 819 |
website_platform_bundles.map({ case (bundle, bundle_info) =>
|
| 73626 | 820 |
List(HTML.link(bundle, HTML.text(bundle_info.platform_description + " bundle"))) })), |
| 71275 | 821 |
HTML.subsection("Repositories"),
|
822 |
HTML.itemize( |
|
823 |
List(List(isabelle_link)) ::: (if (afp_rev == "") Nil else List(List(afp_link)))))) |
|
| 64202 | 824 |
|
| 73626 | 825 |
Isabelle_System.copy_file(context.isabelle_archive, dir) |
826 |
||
827 |
for ((bundle, _) <- website_platform_bundles) {
|
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
828 |
Isabelle_System.copy_file(context.dist_dir + Path.explode(bundle), dir) |
| 73626 | 829 |
} |
| 64361 | 830 |
} |
| 64202 | 831 |
|
832 |
||
833 |
/* HTML library */ |
|
834 |
||
| 64203 | 835 |
if (build_library) {
|
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
836 |
if (context.isabelle_library_archive.is_file) {
|
|
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
837 |
progress.echo_warning("Library archive already exists: " + context.isabelle_library_archive)
|
|
69168
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
wenzelm
parents:
69167
diff
changeset
|
838 |
} |
| 64203 | 839 |
else {
|
| 75394 | 840 |
Isabelle_System.with_tmp_dir("build_release") { tmp_dir =>
|
841 |
val bundle = |
|
842 |
context.dist_dir + Path.explode(context.dist_name + "_" + Platform.family + ".tar.gz") |
|
843 |
execute_tar(tmp_dir, "-xzf " + File.bash_path(bundle)) |
|
| 64316 | 844 |
|
| 77045 | 845 |
val other_isabelle = context.other_isabelle(tmp_dir, suffix = "") |
| 64316 | 846 |
|
| 75394 | 847 |
Isabelle_System.make_directory(other_isabelle.etc) |
848 |
File.write(other_isabelle.etc_settings, "ML_OPTIONS=\"--minheap 1000 --maxheap 4000\"\n") |
|
| 74856 | 849 |
|
| 75394 | 850 |
other_isabelle.bash("bin/isabelle build -f -j " + parallel_jobs +
|
851 |
" -o browser_info -o document=pdf -o document_variants=document:outline=/proof,/ML" + |
|
852 |
" -o system_heaps -c -a -d '~~/src/Benchmarks'", echo = true).check |
|
853 |
other_isabelle.isabelle_home_user.file.delete |
|
| 64316 | 854 |
|
| 75394 | 855 |
execute(tmp_dir, "chmod -R a+r " + Bash.string(context.dist_name)) |
856 |
execute(tmp_dir, "chmod -R g=o " + Bash.string(context.dist_name)) |
|
857 |
execute_tar(tmp_dir, "-czf " + File.bash_path(context.isabelle_library_archive) + |
|
858 |
" " + Bash.string(context.dist_name + "/browser_info")) |
|
859 |
} |
|
| 64203 | 860 |
} |
861 |
} |
|
| 64202 | 862 |
} |
863 |
||
864 |
||
865 |
||
866 |
/** command line entry point **/ |
|
867 |
||
| 75393 | 868 |
def main(args: Array[String]): Unit = {
|
| 71632 | 869 |
Command_Line.tool {
|
|
64405
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
wenzelm
parents:
64371
diff
changeset
|
870 |
var afp_rev = "" |
|
73607
fc13738e1933
clarified command-line, following other build_XYZ tools;
wenzelm
parents:
73582
diff
changeset
|
871 |
var target_dir = Path.current |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
872 |
var release_name = "" |
| 73629 | 873 |
var source_archive = "" |
| 64211 | 874 |
var website: Option[Path] = None |
| 70101 | 875 |
var build_sessions: List[String] = Nil |
| 69413 | 876 |
var more_components: List[Path] = Nil |
| 64202 | 877 |
var parallel_jobs = 1 |
878 |
var build_library = false |
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
879 |
var options = Options.init() |
| 73642 | 880 |
var platform_families = default_platform_families |
| 64202 | 881 |
var rev = "" |
882 |
||
883 |
val getopts = Getopts("""
|
|
| 73894 | 884 |
Usage: Admin/build_release [OPTIONS] |
| 64202 | 885 |
|
886 |
Options are: |
|
|
64405
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
wenzelm
parents:
64371
diff
changeset
|
887 |
-A REV corresponding AFP changeset id |
|
73607
fc13738e1933
clarified command-line, following other build_XYZ tools;
wenzelm
parents:
73582
diff
changeset
|
888 |
-D DIR target directory (default ".") |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
889 |
-R RELEASE explicit release name |
| 73629 | 890 |
-S ARCHIVE use existing source archive (file or URL) |
| 64211 | 891 |
-W WEBSITE produce minimal website in given directory |
| 70101 | 892 |
-b SESSIONS build platform-specific session images (separated by commas) |
| 69413 | 893 |
-c ARCHIVE clean bundling with additional component .tar.gz archive |
| 64202 | 894 |
-j INT maximum number of parallel jobs (default 1) |
895 |
-l build library |
|
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
896 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
| 77043 | 897 |
-p NAMES platform families (default: """ + quote(default_platform_families.mkString(",")) + """)
|
| 73629 | 898 |
-r REV Mercurial changeset id (default: ARCHIVE or RELEASE or tip) |
| 64202 | 899 |
|
900 |
Build Isabelle release in base directory, using the local repository clone. |
|
901 |
""", |
|
|
64405
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
wenzelm
parents:
64371
diff
changeset
|
902 |
"A:" -> (arg => afp_rev = arg), |
|
73607
fc13738e1933
clarified command-line, following other build_XYZ tools;
wenzelm
parents:
73582
diff
changeset
|
903 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
904 |
"R:" -> (arg => release_name = arg), |
| 73629 | 905 |
"S:" -> (arg => source_archive = arg), |
| 64211 | 906 |
"W:" -> (arg => website = Some(Path.explode(arg))), |
| 70101 | 907 |
"b:" -> (arg => build_sessions = space_explode(',', arg)),
|
| 69413 | 908 |
"c:" -> (arg => |
909 |
{
|
|
910 |
val path = Path.explode(arg) |
|
911 |
Components.Archive.get_name(path.file_name) |
|
912 |
more_components = more_components ::: List(path) |
|
913 |
}), |
|
| 64202 | 914 |
"j:" -> (arg => parallel_jobs = Value.Int.parse(arg)), |
| 64316 | 915 |
"l" -> (_ => build_library = true), |
|
69401
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
wenzelm
parents:
69400
diff
changeset
|
916 |
"o:" -> (arg => options = options + arg), |
| 69410 | 917 |
"p:" -> (arg => platform_families = space_explode(',', arg).map(Platform.Family.parse)),
|
| 64204 | 918 |
"r:" -> (arg => rev = arg)) |
| 64202 | 919 |
|
920 |
val more_args = getopts(args) |
|
|
73607
fc13738e1933
clarified command-line, following other build_XYZ tools;
wenzelm
parents:
73582
diff
changeset
|
921 |
if (more_args.nonEmpty) getopts.usage() |
| 64202 | 922 |
|
| 73629 | 923 |
if (platform_families.contains(Platform.Family.windows) && !Isabelle_System.bash("7z i").ok)
|
924 |
error("Building for windows requires 7z")
|
|
925 |
||
| 73634 | 926 |
val progress = new Console_Progress() |
| 73629 | 927 |
def make_context(name: String): Release_Context = |
|
77088
6e2c6ccc5dc0
clarified defaults: imitate "isabelle components -I" without further parameters;
wenzelm
parents:
77072
diff
changeset
|
928 |
Release_Context(target_dir, release_name = name, progress = progress) |
| 64202 | 929 |
|
| 73629 | 930 |
val context = |
931 |
if (source_archive.isEmpty) {
|
|
932 |
val context = make_context(release_name) |
|
933 |
val version = proper_string(rev) orElse proper_string(release_name) getOrElse "tip" |
|
934 |
build_release_archive(context, version, parallel_jobs = parallel_jobs) |
|
935 |
context |
|
936 |
} |
|
937 |
else {
|
|
| 73634 | 938 |
val archive = |
939 |
Release_Archive.get(source_archive, rename = release_name, progress = progress) |
|
| 73632 | 940 |
val context = make_context(archive.identifier) |
| 73634 | 941 |
Isabelle_System.make_directory(context.dist_dir) |
| 73629 | 942 |
use_release_archive(context, archive, id = rev) |
943 |
context |
|
944 |
} |
|
| 69415 | 945 |
|
| 73630 | 946 |
build_release(options, context, afp_rev = afp_rev, platform_families = platform_families, |
|
74857
25e9e7088561
address problems with launch4j and jdk-17 (see also 41d009462d3c);
wenzelm
parents:
74856
diff
changeset
|
947 |
more_components = more_components, build_sessions = build_sessions, |
|
73625
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents:
73610
diff
changeset
|
948 |
build_library = build_library, parallel_jobs = parallel_jobs, website = website) |
| 64202 | 949 |
} |
950 |
} |
|
951 |
} |