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