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