| author | traytel | 
| Sun, 07 Apr 2019 08:26:57 +0200 | |
| changeset 70078 | 3a1b2d8c89aa | 
| parent 70046 | c37525278ae2 | 
| child 70098 | 956d2430cb29 | 
| permissions | -rw-r--r-- | 
| 64202 | 1 | /* Title: Pure/Admin/build_release.scala | 
| 2 | Author: Makarius | |
| 3 | ||
| 4 | Build full Isabelle distribution from repository. | |
| 5 | */ | |
| 6 | ||
| 7 | package isabelle | |
| 8 | ||
| 9 | ||
| 10 | object Build_Release | |
| 11 | {
 | |
| 69174 | 12 | /** release info **/ | 
| 13 | ||
| 14 | sealed case class Bundle_Info( | |
| 69410 | 15 | platform: Platform.Family.Value, | 
| 69174 | 16 | platform_description: String, | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 17 | name: String) | 
| 69174 | 18 |   {
 | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 19 | def path: Path = Path.explode(name) | 
| 69174 | 20 | } | 
| 21 | ||
| 22 | class Release private[Build_Release]( | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 23 | progress: Progress, | 
| 69174 | 24 | val date: Date, | 
| 25 | val dist_name: String, | |
| 26 | val dist_dir: Path, | |
| 27 | val dist_version: String, | |
| 28 | val ident: String) | |
| 29 |   {
 | |
| 30 | val isabelle_dir: Path = dist_dir + Path.explode(dist_name) | |
| 31 | val isabelle_archive: Path = dist_dir + Path.explode(dist_name + ".tar.gz") | |
| 32 | val isabelle_library_archive: Path = dist_dir + Path.explode(dist_name + "_library.tar.gz") | |
| 33 | ||
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 34 | def other_isabelle(dir: Path): Other_Isabelle = | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 35 | Other_Isabelle(dir + Path.explode(dist_name), | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 36 | isabelle_identifier = dist_name + "-build", | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 37 | progress = progress) | 
| 69174 | 38 | |
| 69410 | 39 | def bundle_info(platform: Platform.Family.Value): Bundle_Info = | 
| 40 |       platform match {
 | |
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 41 | case Platform.Family.linux => Bundle_Info(platform, "Linux", dist_name + "_linux.tar.gz") | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 42 | case Platform.Family.macos => Bundle_Info(platform, "Mac OS X", dist_name + "_macos.tar.gz") | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 43 | case Platform.Family.windows => Bundle_Info(platform, "Windows", dist_name + ".exe") | 
| 69177 | 44 | } | 
| 69174 | 45 | } | 
| 46 | ||
| 47 | ||
| 48 | ||
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 49 | /** generated content **/ | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 50 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 51 | /* patch release */ | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 52 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 53 | private def change_file(dir: Path, name: String, f: String => String) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 54 |   {
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 55 | val file = dir + Path.explode(name) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 56 | File.write(file, f(File.read(file))) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 57 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 58 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 59 | private val getsettings_file: String = "lib/scripts/getsettings" | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 60 | |
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 61 | private val ISABELLE_ID = """ISABELLE_ID="(.+)"""".r | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 62 | |
| 69174 | 63 | def patch_release(release: Release, is_official: Boolean) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 64 |   {
 | 
| 69174 | 65 | val dir = release.isabelle_dir | 
| 66 | ||
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 67 |     for (name <- List("src/Pure/System/distribution.ML", "src/Pure/System/distribution.scala"))
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 68 |     {
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 69 | change_file(dir, name, | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 70 | s => | 
| 69392 | 71 |           s.replaceAllLiterally("val is_identified = false", "val is_identified = true")
 | 
| 72 |            .replaceAllLiterally("val is_official = false", "val is_official = " + is_official))
 | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 73 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 74 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 75 | change_file(dir, getsettings_file, | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 76 | s => | 
| 69392 | 77 |         s.replaceAllLiterally("ISABELLE_ID=\"\"", "ISABELLE_ID=" + quote(release.ident))
 | 
| 78 |          .replaceAllLiterally("ISABELLE_IDENTIFIER=\"\"",
 | |
| 79 | "ISABELLE_IDENTIFIER=" + quote(release.dist_name))) | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 80 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 81 | change_file(dir, "lib/html/library_index_header.template", | 
| 69392 | 82 |       s => s.replaceAllLiterally("{ISABELLE}", release.dist_name))
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 83 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 84 |     for {
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 85 | name <- | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 86 | List( | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 87 | "src/Pure/System/distribution.ML", | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 88 | "src/Pure/System/distribution.scala", | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 89 | "lib/Tools/version") } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 90 |     {
 | 
| 69392 | 91 | change_file(dir, name, | 
| 92 |         s => s.replaceAllLiterally("repository version", release.dist_version))
 | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 93 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 94 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 95 | change_file(dir, "README", | 
| 69392 | 96 |       s => s.replaceAllLiterally("some repository version of Isabelle", release.dist_version))
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 97 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 98 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 99 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 100 | /* ANNOUNCE */ | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 101 | |
| 69174 | 102 | def make_announce(release: Release) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 103 |   {
 | 
| 69174 | 104 |     File.write(release.isabelle_dir + Path.explode("ANNOUNCE"),
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 105 | """ | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 106 | IMPORTANT NOTE | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 107 | ============== | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 108 | |
| 69174 | 109 | This is a snapshot of Isabelle/""" + release.ident + """ from the repository. | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 110 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 111 | """) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 112 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 113 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 114 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 115 | /* NEWS */ | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 116 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 117 | def make_news(other_isabelle: Other_Isabelle, dist_version: String) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 118 |   {
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 119 |     val target = other_isabelle.isabelle_home + Path.explode("doc")
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 120 |     val target_fonts = target + Path.explode("fonts")
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 121 | Isabelle_System.mkdirs(target_fonts) | 
| 69360 | 122 | other_isabelle.copy_fonts(target_fonts) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 123 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 124 | HTML.write_document(target, "NEWS.html", | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 125 |       List(HTML.title("NEWS (" + dist_version + ")")),
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 126 | List( | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 127 |         HTML.chapter("NEWS"),
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 128 | HTML.source( | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 129 |           Symbol.decode(File.read(other_isabelle.isabelle_home + Path.explode("NEWS"))))))
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 130 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 131 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 132 | |
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 133 | /* bundled components */ | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 134 | |
| 69410 | 135 | class Bundled(platform: Option[Platform.Family.Value] = None) | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 136 |   {
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 137 | def detect(s: String): Boolean = | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 138 |       s.startsWith("#bundled") && !s.startsWith("#bundled ")
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 139 | |
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 140 | def apply(name: String): String = | 
| 69410 | 141 |       "#bundled" + (platform match { case None => "" case Some(plat) => "-" + plat }) + ":" + name
 | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 142 | |
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 143 |     private val Pattern1 = ("""^#bundled:(.*)$""").r
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 144 |     private val Pattern2 = ("""^#bundled-(.*):(.*)$""").r
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 145 | |
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 146 | def unapply(s: String): Option[String] = | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 147 |       s match {
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 148 | case Pattern1(name) => Some(name) | 
| 69410 | 149 | 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 | 150 | case _ => None | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 151 | } | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 152 | } | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 153 | |
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 154 | def record_bundled_components(dir: Path) | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 155 |   {
 | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 156 | val catalogs = | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 157 |       List("main", "bundled").map((_, new Bundled())) :::
 | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 158 | default_platform_families.flatMap(platform => | 
| 69410 | 159 | List(platform.toString, "bundled-" + platform.toString). | 
| 160 | map((_, new Bundled(platform = Some(platform))))) | |
| 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 | File.append(Components.components(dir), | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 163 |       terminate_lines("#bundled components" ::
 | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 164 |         (for {
 | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 165 | (catalog, bundled) <- catalogs.iterator | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 166 | val path = Components.admin(dir) + Path.basic(catalog) | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 167 | if path.is_file | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 168 | line <- split_lines(File.read(path)) | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 169 |           if line.nonEmpty && !line.startsWith("#") && !line.startsWith("jedit_build")
 | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 170 | } yield bundled(line)).toList)) | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 171 | } | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 172 | |
| 69410 | 173 | def get_bundled_components(dir: Path, platform: Platform.Family.Value): (List[String], String) = | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 174 |   {
 | 
| 69410 | 175 | 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 | 176 | val components = | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 177 |       for {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 178 | Bundled(name) <- Components.read_components(dir) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 179 |         if !name.startsWith("jedit_build")
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 180 | } yield name | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 181 | val jdk_component = | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 182 |       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 | 183 | (components, jdk_component) | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 184 | } | 
| 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 185 | |
| 69413 | 186 | def activate_components(dir: Path, platform: Platform.Family.Value, more_names: List[String]) | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 187 |   {
 | 
| 69413 | 188 | def contrib_name(name: String): String = | 
| 189 | Components.contrib(name = name).implode | |
| 190 | ||
| 69410 | 191 | val Bundled = new Bundled(platform = Some(platform)) | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 192 | Components.write_components(dir, | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 193 | Components.read_components(dir).flatMap(line => | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 194 |         line match {
 | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 195 | case Bundled(name) => | 
| 69413 | 196 | 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 | 197 | else None | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 198 | case _ => if (Bundled.detect(line)) None else Some(line) | 
| 69413 | 199 | }) ::: more_names.map(contrib_name(_))) | 
| 69391 
a3c776b9d3dd
manage components similar to makedist_bundle (still inactive);
 wenzelm parents: 
69390diff
changeset | 200 | } | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 201 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 202 | def make_contrib(dir: Path) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 203 |   {
 | 
| 69395 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 204 | Isabelle_System.mkdirs(Components.contrib(dir)) | 
| 
d1c4a1dee9e7
more explicit support for Isabelle system components;
 wenzelm parents: 
69392diff
changeset | 205 | File.write(Components.contrib(dir, "README"), | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 206 | """This directory contains add-on components that contribute to the main | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 207 | Isabelle distribution. Separate licensing conditions apply, see each | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 208 | directory individually. | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 209 | """) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 210 | } | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 211 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 212 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 213 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 214 | /** build_release **/ | 
| 
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 | private def execute(dir: Path, script: String): Unit = | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 217 | Isabelle_System.bash(script, cwd = dir.file).check | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 218 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 219 | private def execute_tar(dir: Path, args: String): Unit = | 
| 69425 | 220 | Isabelle_System.gnutar(args, dir = dir).check | 
| 69170 | 221 | |
| 69415 | 222 | private val default_platform_families: List[Platform.Family.Value] = | 
| 69410 | 223 | List(Platform.Family.linux, Platform.Family.windows, Platform.Family.macos) | 
| 64204 | 224 | |
| 64202 | 225 | def build_release(base_dir: Path, | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 226 | options: Options, | 
| 69434 | 227 | components_base: Path = Components.default_components_base, | 
| 64909 | 228 | progress: Progress = No_Progress, | 
| 64202 | 229 | rev: String = "", | 
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 230 | afp_rev: String = "", | 
| 64202 | 231 | official_release: Boolean = false, | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 232 | proper_release_name: Option[String] = None, | 
| 69410 | 233 | platform_families: List[Platform.Family.Value] = default_platform_families, | 
| 69413 | 234 | more_components: List[Path] = Nil, | 
| 64211 | 235 | website: Option[Path] = None, | 
| 64202 | 236 | build_library: Boolean = false, | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 237 | parallel_jobs: Int = 1): Release = | 
| 64202 | 238 |   {
 | 
| 69174 | 239 |     val hg = Mercurial.repository(Path.explode("$ISABELLE_HOME"))
 | 
| 240 | ||
| 69167 | 241 | val release = | 
| 64203 | 242 |     {
 | 
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 243 | val date = Date.now() | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 244 |       val dist_name = proper_release_name getOrElse ("Isabelle_" + Date.Format.date(date))
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 245 |       val dist_dir = (base_dir + Path.explode("dist-" + dist_name)).absolute
 | 
| 69174 | 246 | |
| 69414 
eab0d3108b46
clarified defaults: explicit "rev" takes precedence;
 wenzelm parents: 
69413diff
changeset | 247 | val version = proper_string(rev) orElse proper_release_name getOrElse "tip" | 
| 69174 | 248 | val ident = | 
| 249 |         try { hg.id(version) }
 | |
| 69176 | 250 |         catch { case ERROR(_) => error("Bad repository version: " + version) }
 | 
| 69174 | 251 | |
| 252 | val dist_version = | |
| 253 |         proper_release_name match {
 | |
| 254 |           case Some(name) => name + ": " + Date.Format("LLLL uuuu")(date)
 | |
| 255 | case None => "Isabelle repository snapshot " + ident + " " + Date.Format.date(date) | |
| 256 | } | |
| 257 | ||
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 258 | new Release(progress, date, dist_name, dist_dir, dist_version, ident) | 
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 259 | } | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 260 | |
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 261 | |
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 262 | /* make distribution */ | 
| 64202 | 263 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 264 |     if (release.isabelle_archive.is_file) {
 | 
| 69400 | 265 |       progress.echo_warning("Release archive already exists: " + release.isabelle_archive)
 | 
| 69175 | 266 | |
| 267 | val archive_ident = | |
| 268 |         Isabelle_System.with_tmp_dir("build_release")(tmp_dir =>
 | |
| 269 |           {
 | |
| 270 | val getsettings = Path.explode(release.dist_name + "/" + getsettings_file) | |
| 271 | execute_tar(tmp_dir, "-xzf " + | |
| 272 | File.bash_path(release.isabelle_archive) + " " + File.bash_path(getsettings)) | |
| 273 | split_lines(File.read(tmp_dir + getsettings)) | |
| 274 |               .collectFirst({ case ISABELLE_ID(ident) => ident })
 | |
| 275 |               .getOrElse(error("Failed to read ISABELLE_ID from " + release.isabelle_archive))
 | |
| 276 | }) | |
| 277 | ||
| 278 |       if (release.ident != archive_ident) {
 | |
| 279 |         error("Mismatch of release identification " + release.ident +
 | |
| 280 | " vs. archive " + archive_ident) | |
| 281 | } | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 282 | } | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 283 |     else {
 | 
| 69400 | 284 |       progress.echo_warning("Producing release archive " + release.isabelle_archive + " ...")
 | 
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 285 | |
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 286 | Isabelle_System.mkdirs(release.dist_dir) | 
| 64221 | 287 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 288 | if (release.isabelle_dir.is_dir) | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 289 |         error("Directory " + release.isabelle_dir + " already exists")
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 290 | |
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 291 | |
| 69400 | 292 |       progress.echo_warning("Retrieving Mercurial repository version " + release.ident)
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 293 | |
| 69174 | 294 | hg.archive(release.isabelle_dir.expand.implode, rev = release.ident, options = "--type files") | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 295 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 296 |       for (name <- List(".hg_archival.txt", ".hgtags", ".hgignore", "README_REPOSITORY")) {
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 297 | (release.isabelle_dir + Path.explode(name)).file.delete | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 298 | } | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 299 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 300 | |
| 69400 | 301 |       progress.echo_warning("Preparing distribution " + quote(release.dist_name))
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 302 | |
| 69174 | 303 | patch_release(release, proper_release_name.isDefined && official_release) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 304 | |
| 69174 | 305 | if (proper_release_name.isEmpty) make_announce(release) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 306 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 307 | make_contrib(release.isabelle_dir) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 308 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 309 | execute(release.isabelle_dir, """find . -print | xargs chmod -f u+rw""") | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 310 | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 311 | record_bundled_components(release.isabelle_dir) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 312 | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 313 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 314 | /* build tools and documentation */ | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 315 | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 316 | val other_isabelle = release.other_isabelle(release.dist_dir) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 317 | |
| 69388 | 318 | other_isabelle.init_settings( | 
| 69434 | 319 |         other_isabelle.init_components(components_base = components_base, catalogs = List("main")))
 | 
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 320 | other_isabelle.resolve_components(echo = true) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 321 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 322 |       try {
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 323 | val export_classpath = | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 324 |           "export CLASSPATH=" + Bash.string(other_isabelle.getenv("ISABELLE_CLASSPATH")) + "\n"
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 325 | other_isabelle.bash(export_classpath + "./Admin/build all", echo = true).check | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 326 | other_isabelle.bash(export_classpath + "./bin/isabelle jedit -b", echo = true).check | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 327 | } | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 328 |       catch { case ERROR(_) => error("Failed to build tools") }
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 329 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 330 |       try {
 | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 331 | other_isabelle.bash( | 
| 69873 | 332 | "./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 | 333 | } | 
| 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 334 |       catch { case ERROR(_) => error("Failed to build documentation") }
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 335 | |
| 69174 | 336 | make_news(other_isabelle, release.dist_version) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 337 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 338 |       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 | 339 | 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 | 340 | } | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 341 | |
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 342 | other_isabelle.cleanup() | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 343 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 344 | |
| 69400 | 345 |       progress.echo_warning("Creating distribution archive " + release.isabelle_archive)
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 346 | |
| 69174 | 347 | def execute_dist_name(script: String): Unit = | 
| 348 | Isabelle_System.bash(script, cwd = release.dist_dir.file, | |
| 349 |           env = Isabelle_System.settings() + ("DIST_NAME" -> release.dist_name)).check
 | |
| 350 | ||
| 351 |       execute_dist_name("""
 | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 352 | set -e | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 353 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 354 | chmod -R a+r "$DIST_NAME" | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 355 | chmod -R u+w "$DIST_NAME" | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 356 | chmod -R g=o "$DIST_NAME" | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 357 | find "$DIST_NAME" -type f "(" -name "*.thy" -o -name "*.ML" -o -name "*.scala" ")" -print | xargs chmod -f u-w
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 358 | """) | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 359 | |
| 69425 | 360 | execute_tar(release.dist_dir, "-czf " + | 
| 69171 
710845a85944
more robust release.read_ident: eliminated odd state files ISABELLE_IDENT, ISABELLE_DIST;
 wenzelm parents: 
69170diff
changeset | 361 | File.bash_path(release.isabelle_archive) + " " + Bash.string(release.dist_name)) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 362 | |
| 69174 | 363 |       execute_dist_name("""
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 364 | set -e | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 365 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 366 | mv "$DIST_NAME" "${DIST_NAME}-old"
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 367 | mkdir "$DIST_NAME" | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 368 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 369 | mv "${DIST_NAME}-old/README" "${DIST_NAME}-old/NEWS" "${DIST_NAME}-old/ANNOUNCE" \
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 370 |   "${DIST_NAME}-old/COPYRIGHT" "${DIST_NAME}-old/CONTRIBUTORS" "$DIST_NAME"
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 371 | mkdir "$DIST_NAME/doc" | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 372 | mv "${DIST_NAME}-old/doc/"*.pdf \
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 373 |   "${DIST_NAME}-old/doc/"*.html \
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 374 |   "${DIST_NAME}-old/doc/"*.css \
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 375 |   "${DIST_NAME}-old/doc/fonts" \
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 376 |   "${DIST_NAME}-old/doc/Contents" "$DIST_NAME/doc"
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 377 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 378 | rm -f Isabelle && ln -sf "$DIST_NAME" Isabelle | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 379 | |
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 380 | rm -rf "${DIST_NAME}-old"
 | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 381 | """) | 
| 64203 | 382 | } | 
| 64202 | 383 | |
| 384 | ||
| 385 | /* make application bundles */ | |
| 386 | ||
| 69177 | 387 | val bundle_infos = platform_families.map(release.bundle_info) | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 388 | |
| 66730 | 389 |     for (bundle_info <- bundle_infos) {
 | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 390 | val bundle_archive = release.dist_dir + bundle_info.path | 
| 69413 | 391 | if (bundle_archive.is_file && more_components.isEmpty) | 
| 69400 | 392 |         progress.echo_warning("Application bundle already exists: " + bundle_archive)
 | 
| 64203 | 393 |       else {
 | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 394 | val isabelle_name = release.dist_name | 
| 69410 | 395 | val platform = bundle_info.platform | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 396 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 397 |         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 | 398 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 399 |         Isabelle_System.with_tmp_dir("build_release")(tmp_dir =>
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 400 |         {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 401 | // release archive | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 402 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 403 | execute_tar(tmp_dir, "-xzf " + File.bash_path(release.isabelle_archive)) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 404 | val other_isabelle = release.other_isabelle(tmp_dir) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 405 | val isabelle_target = other_isabelle.isabelle_home | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 406 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 407 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 408 | // bundled components | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 409 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 410 |           progress.echo("Bundled components:")
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 411 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 412 | val contrib_dir = Components.contrib(isabelle_target) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 413 | |
| 69413 | 414 | val (bundled_components, jdk_component) = | 
| 415 | 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 | 416 | |
| 69434 | 417 | Components.resolve(components_base, bundled_components, | 
| 418 | target_dir = Some(contrib_dir), progress = progress) | |
| 69413 | 419 | |
| 420 | val more_components_names = | |
| 421 | 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 | 422 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 423 | Components.purge(contrib_dir, platform) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 424 | |
| 69413 | 425 | 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 | 426 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 427 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 428 | // Java parameters | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 429 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 430 | val java_options_title = "# Java runtime options" | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 431 | val java_options: List[String] = | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 432 |             (for {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 433 | variable <- | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 434 | List( | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 435 | "ISABELLE_JAVA_SYSTEM_OPTIONS", | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 436 | "JEDIT_JAVA_SYSTEM_OPTIONS", | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 437 | "JEDIT_JAVA_OPTIONS") | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 438 | opt <- Word.explode(other_isabelle.getenv(variable)) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 439 |             } yield opt) ::: List("-Disabelle.jedit_server=" + isabelle_name)
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 440 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 441 | val classpath: List[Path] = | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 442 |           {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 443 | val base = isabelle_target.absolute | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 444 |             Path.split(other_isabelle.getenv("ISABELLE_CLASSPATH")).map(path =>
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 445 |             {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 446 | val abs_path = path.absolute | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 447 |               File.relative_path(base, abs_path) match {
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 448 | case Some(rel_path) => rel_path | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 449 |                 case None => error("Bad ISABELLE_CLASSPATH element: " + abs_path)
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 450 | } | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 451 |             }) ::: List(Path.explode("src/Tools/jEdit/dist/jedit.jar"))
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 452 | } | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 453 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 454 |           val jedit_props = Path.explode("src/Tools/jEdit/dist/properties/jEdit.props")
 | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 455 | |
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 456 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 457 | // application bundling | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 458 | |
| 69417 | 459 |           platform match {
 | 
| 460 | case Platform.Family.linux => | |
| 461 | File.write(isabelle_target + Path.explode(isabelle_name + ".options"), | |
| 462 | terminate_lines(java_options_title :: java_options)) | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 463 | |
| 69417 | 464 | val isabelle_run = isabelle_target + Path.explode(isabelle_name + ".run") | 
| 465 | File.write(isabelle_run, | |
| 466 |                 File.read(Path.explode("~~/Admin/Linux/Isabelle.run"))
 | |
| 467 |                   .replaceAllLiterally("{CLASSPATH}",
 | |
| 468 |                     classpath.map("$ISABELLE_HOME/" + _).mkString(":"))
 | |
| 469 |                   .replaceAllLiterally("/jdk/", "/" + jdk_component + "/"))
 | |
| 69789 
2c3e5e58d93f
more thorough File.set_executable, notably for Windows;
 wenzelm parents: 
69501diff
changeset | 470 | File.set_executable(isabelle_run, true) | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 471 | |
| 69417 | 472 |               val linux_app = isabelle_target + Path.explode("contrib/linux_app")
 | 
| 473 |               File.move(linux_app + Path.explode("Isabelle"),
 | |
| 474 | isabelle_target + Path.explode(isabelle_name)) | |
| 475 | Isabelle_System.rm_tree(linux_app) | |
| 476 | ||
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 477 | val archive_name = isabelle_name + "_linux.tar.gz" | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 478 |               progress.echo("Packaging " + archive_name + " ...")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 479 | execute_tar(tmp_dir, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 480 | "-czf " + File.bash_path(release.dist_dir + Path.explode(archive_name)) + " " + | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 481 | Bash.string(isabelle_name)) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 482 | |
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 483 | |
| 69417 | 484 | case Platform.Family.macos => | 
| 485 | File.write(isabelle_target + jedit_props, | |
| 486 | File.read(isabelle_target + jedit_props) | |
| 487 |                   .replaceAll("lookAndFeel=.*", "lookAndFeel=com.apple.laf.AquaLookAndFeel")
 | |
| 488 |                   .replaceAll("delete-line.shortcut=.*", "delete-line.shortcut=C+d")
 | |
| 489 |                   .replaceAll("delete.shortcut2=.*", "delete.shortcut2=A+d")
 | |
| 490 |                   .replaceAll("plugin-blacklist.MacOSX.jar=true", "plugin-blacklist.MacOSX.jar="))
 | |
| 491 | ||
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 492 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 493 | // MacOS application bundle | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 494 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 495 |               File.move(isabelle_target + Path.explode("contrib/macos_app"), tmp_dir)
 | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 496 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 497 | val isabelle_app = Path.explode(isabelle_name + ".app") | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 498 | val app_dir = tmp_dir + isabelle_app | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 499 |               File.move(tmp_dir + Path.explode("macos_app/Isabelle.app"), app_dir)
 | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 500 | |
| 69417 | 501 |               val app_contents = app_dir + Path.explode("Contents")
 | 
| 502 |               val app_resources = app_contents + Path.explode("Resources")
 | |
| 503 | File.move(tmp_dir + Path.explode(isabelle_name), app_resources) | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 504 | |
| 69417 | 505 |               File.write(app_contents + Path.explode("Info.plist"),
 | 
| 506 |                 File.read(Path.explode("~~/Admin/MacOS/Info.plist"))
 | |
| 507 |                   .replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
 | |
| 508 |                   .replaceAllLiterally("{JAVA_OPTIONS}",
 | |
| 509 | terminate_lines(java_options.map(opt => "<string>" + opt + "</string>")))) | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 510 | |
| 69417 | 511 |               for (cp <- classpath) {
 | 
| 512 | File.link( | |
| 513 |                   Path.explode("../Resources/" + isabelle_name + "/") + cp,
 | |
| 514 |                   app_contents + Path.explode("Java"),
 | |
| 515 | force = true) | |
| 516 | } | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 517 | |
| 69417 | 518 | File.link( | 
| 519 |                 Path.explode("../Resources/" + isabelle_name + "/contrib/" +
 | |
| 520 | jdk_component + "/x86_64-darwin"), | |
| 521 |                 app_contents + Path.explode("PlugIns/bundled.jdk"),
 | |
| 522 | force = true) | |
| 69402 
61f4c406d727
more direct File.link operation: avoid external process;
 wenzelm parents: 
69401diff
changeset | 523 | |
| 69417 | 524 | File.link( | 
| 525 |                 Path.explode("../../Info.plist"),
 | |
| 526 | app_resources + Path.explode(isabelle_name + "/" + isabelle_name + ".plist"), | |
| 527 | force = true) | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 528 | |
| 69417 | 529 | File.link( | 
| 530 |                 Path.explode("Contents/Resources/" + isabelle_name),
 | |
| 531 |                 app_dir + Path.explode("Isabelle"),
 | |
| 532 | force = true) | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 533 | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 534 | |
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 535 | // application archive | 
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 536 | |
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 537 | val archive_name = isabelle_name + "_macos.tar.gz" | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 538 |               progress.echo("Packaging " + archive_name + " ...")
 | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 539 | execute_tar(tmp_dir, | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 540 | "-czf " + File.bash_path(release.dist_dir + Path.explode(archive_name)) + " " + | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 541 | File.bash_path(isabelle_app)) | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 542 | |
| 69417 | 543 | |
| 544 | case Platform.Family.windows => | |
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 545 | File.write(isabelle_target + jedit_props, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 546 | File.read(isabelle_target + jedit_props) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 547 |                   .replaceAll("lookAndFeel=.*",
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 548 | "lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel") | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 549 |                   .replaceAll("foldPainter=.*", "foldPainter=Square"))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 550 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 551 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 552 | // application launcher | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 553 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 554 |               File.move(isabelle_target + Path.explode("contrib/windows_app"), tmp_dir)
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 555 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 556 |               val app_template = Path.explode("~~/Admin/Windows/launch4j")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 557 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 558 | File.write(isabelle_target + Path.explode(isabelle_name + ".l4j.ini"), | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 559 | (java_options_title :: java_options).map(_ + "\r\n").mkString) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 560 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 561 |               val isabelle_xml = Path.explode("isabelle.xml")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 562 | val isabelle_exe = Path.explode(isabelle_name + ".exe") | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 563 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 564 | File.write(tmp_dir + isabelle_xml, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 565 | File.read(app_template + isabelle_xml) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 566 |                   .replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 567 |                   .replaceAllLiterally("{OUTFILE}",
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 568 | File.platform_path(isabelle_target + isabelle_exe)) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 569 |                   .replaceAllLiterally("{ICON}",
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 570 |                     File.platform_path(app_template + Path.explode("isabelle_transparent.ico")))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 571 |                   .replaceAllLiterally("{SPLASH}",
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 572 |                     File.platform_path(app_template + Path.explode("isabelle.bmp")))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 573 |                   .replaceAllLiterally("{CLASSPATH}",
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 574 | cat_lines(classpath.map(cp => | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 575 |                       "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 576 |                   .replaceAllLiterally("\\jdk\\", "\\" + jdk_component + "\\"))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 577 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 578 | execute(tmp_dir, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 579 |                 "\"windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j\" isabelle.xml")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 580 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 581 |               File.copy(app_template + Path.explode("manifest.xml"),
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 582 |                 isabelle_target + isabelle_exe.ext("manifest"))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 583 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 584 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 585 | // Cygwin setup | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 586 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 587 |               val cygwin_template = Path.explode("~~/Admin/Windows/Cygwin")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 588 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 589 |               File.copy(cygwin_template + Path.explode("Cygwin-Terminal.bat"), isabelle_target)
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 590 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 591 | val cygwin_mirror = | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 592 |                 File.read(isabelle_target + Path.explode("contrib/cygwin/isabelle/cygwin_mirror"))
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 593 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 594 |               val cygwin_bat = Path.explode("Cygwin-Setup.bat")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 595 | File.write(isabelle_target + cygwin_bat, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 596 | File.read(cygwin_template + cygwin_bat) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 597 |                   .replaceAllLiterally("{MIRROR}", cygwin_mirror))
 | 
| 69789 
2c3e5e58d93f
more thorough File.set_executable, notably for Windows;
 wenzelm parents: 
69501diff
changeset | 598 | File.set_executable(isabelle_target + cygwin_bat, true) | 
| 69424 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 599 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 600 |               for (name <- List("isabelle/postinstall", "isabelle/rebaseall")) {
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 601 | val path = Path.explode(name) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 602 | File.copy(cygwin_template + path, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 603 |                   isabelle_target + Path.explode("contrib/cygwin") + path)
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 604 | } | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 605 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 606 | execute(isabelle_target, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 607 | """find . -type f -not -name "*.exe" -not -name "*.dll" """ + | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 608 | (if (Platform.is_macos) "-perm +100" else "-executable") + | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 609 | " -print0 > contrib/cygwin/isabelle/executables") | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 610 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 611 | execute(isabelle_target, | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 612 |                 """find . -type l -exec echo "{}" ";" -exec readlink "{}" ";" """ +
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 613 | """> contrib/cygwin/isabelle/symlinks""") | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 614 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 615 |               execute(isabelle_target, """find . -type l -exec rm "{}" ";" """)
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 616 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 617 |               File.write(isabelle_target + Path.explode("contrib/cygwin/isabelle/uninitialized"), "")
 | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 618 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 619 | |
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 620 | // executable archive (self-extracting 7z) | 
| 
840f0cadeba8
clarified application bundling: discontinued redundant archives;
 wenzelm parents: 
69417diff
changeset | 621 | |
| 69501 | 622 | val archive_name = isabelle_name + ".7z" | 
| 623 | val exe_archive = tmp_dir + Path.explode(archive_name) | |
| 69417 | 624 | exe_archive.file.delete | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 625 | |
| 69501 | 626 |               progress.echo("Packaging " + archive_name + " ...")
 | 
| 69417 | 627 | execute(tmp_dir, | 
| 628 | "7z -y -bd a " + File.bash_path(exe_archive) + " " + Bash.string(isabelle_name)) | |
| 629 |               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 | 630 | |
| 69417 | 631 |               val sfx_exe = tmp_dir + Path.explode("windows_app/7zsd_All_x64.sfx")
 | 
| 632 | val sfx_txt = | |
| 633 |                 File.read(Path.explode("~~/Admin/Windows/Installer/sfx.txt")).
 | |
| 634 |                   replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
 | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 635 | |
| 69417 | 636 | Bytes.write(release.dist_dir + isabelle_exe, | 
| 637 | Bytes.read(sfx_exe) + Bytes(sfx_txt) + Bytes.read(exe_archive)) | |
| 69789 
2c3e5e58d93f
more thorough File.set_executable, notably for Windows;
 wenzelm parents: 
69501diff
changeset | 638 | File.set_executable(release.dist_dir + isabelle_exe, true) | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 639 | } | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 640 | }) | 
| 69403 | 641 |         progress.echo("DONE")
 | 
| 64203 | 642 | } | 
| 64202 | 643 | } | 
| 644 | ||
| 645 | ||
| 646 | /* minimal website */ | |
| 647 | ||
| 64361 | 648 |     for (dir <- website) {
 | 
| 649 | val website_platform_bundles = | |
| 650 |         for {
 | |
| 66730 | 651 | bundle_info <- bundle_infos | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 652 | if (release.dist_dir + bundle_info.path).is_file | 
| 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 653 | } yield (bundle_info.name, bundle_info) | 
| 64206 | 654 | |
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 655 | val afp_link = | 
| 70046 | 656 |         HTML.link(AFP.repos_source + "/rev/" + afp_rev, HTML.text("AFP/" + afp_rev))
 | 
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 657 | |
| 65838 | 658 | HTML.write_document(dir, "index.html", | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 659 | List(HTML.title(release.dist_name)), | 
| 65838 | 660 | List( | 
| 69175 | 661 |           HTML.chapter(release.dist_name + " (" + release.ident + ")"),
 | 
| 65838 | 662 | HTML.itemize( | 
| 66730 | 663 |             website_platform_bundles.map({ case (bundle, bundle_info) =>
 | 
| 664 | List(HTML.link(bundle, HTML.text(bundle_info.platform_description))) }))) ::: | |
| 65838 | 665 |         (if (afp_rev == "") Nil else List(HTML.par(HTML.text("See also ") ::: List(afp_link)))))
 | 
| 64202 | 666 | |
| 64361 | 667 | for ((bundle, _) <- website_platform_bundles) | 
| 69167 | 668 | File.copy(release.dist_dir + Path.explode(bundle), dir) | 
| 64361 | 669 | } | 
| 64202 | 670 | |
| 671 | ||
| 672 | /* HTML library */ | |
| 673 | ||
| 64203 | 674 |     if (build_library) {
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 675 |       if (release.isabelle_library_archive.is_file) {
 | 
| 69400 | 676 |         progress.echo_warning("Library archive already exists: " + release.isabelle_library_archive)
 | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 677 | } | 
| 64203 | 678 |       else {
 | 
| 64316 | 679 |         Isabelle_System.with_tmp_dir("build_release")(tmp_dir =>
 | 
| 680 |           {
 | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 681 | val bundle = | 
| 69410 | 682 | release.dist_dir + Path.explode(release.dist_name + "_" + Platform.family + ".tar.gz") | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 683 | execute_tar(tmp_dir, "-xzf " + File.bash_path(bundle)) | 
| 64316 | 684 | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 685 | val other_isabelle = release.other_isabelle(tmp_dir) | 
| 64316 | 686 | |
| 68755 
67d6f1708ea4
enforce ML_system_64: more robust as cold build, without command_timings;
 wenzelm parents: 
67045diff
changeset | 687 | Isabelle_System.mkdirs(other_isabelle.etc) | 
| 
67d6f1708ea4
enforce ML_system_64: more robust as cold build, without command_timings;
 wenzelm parents: 
67045diff
changeset | 688 | File.write(other_isabelle.etc_preferences, "ML_system_64 = true\n") | 
| 
67d6f1708ea4
enforce ML_system_64: more robust as cold build, without command_timings;
 wenzelm parents: 
67045diff
changeset | 689 | |
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 690 |             other_isabelle.bash("bin/isabelle build -j " + parallel_jobs +
 | 
| 69406 | 691 | " -o browser_info -o document=pdf -o document_variants=document:outline=/proof,/ML" + | 
| 69873 | 692 | " -o system_heaps -c -a -d '~~/src/Benchmarks'", echo = true).check | 
| 64316 | 693 | other_isabelle.isabelle_home_user.file.delete | 
| 694 | ||
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 695 | execute(tmp_dir, "chmod -R a+r " + Bash.string(release.dist_name)) | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 696 | execute(tmp_dir, "chmod -R g=o " + Bash.string(release.dist_name)) | 
| 69425 | 697 | execute_tar(tmp_dir, "-czf " + File.bash_path(release.isabelle_library_archive) + | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 698 | " " + Bash.string(release.dist_name + "/browser_info")) | 
| 64316 | 699 | }) | 
| 64203 | 700 | } | 
| 701 | } | |
| 702 | ||
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 703 | release | 
| 64202 | 704 | } | 
| 705 | ||
| 706 | ||
| 707 | ||
| 708 | /** command line entry point **/ | |
| 709 | ||
| 710 | def main(args: Array[String]) | |
| 711 |   {
 | |
| 712 |     Command_Line.tool0 {
 | |
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 713 | var afp_rev = "" | 
| 69434 | 714 | var components_base: Path = Components.default_components_base | 
| 64202 | 715 | var official_release = false | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 716 | var proper_release_name: Option[String] = None | 
| 64211 | 717 | var website: Option[Path] = None | 
| 69413 | 718 | var more_components: List[Path] = Nil | 
| 64202 | 719 | var parallel_jobs = 1 | 
| 720 | var build_library = false | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 721 | var options = Options.init() | 
| 64208 | 722 | var platform_families = default_platform_families | 
| 64202 | 723 | var rev = "" | 
| 724 | ||
| 725 |       val getopts = Getopts("""
 | |
| 726 | Usage: Admin/build_release [OPTIONS] BASE_DIR | |
| 727 | ||
| 728 | Options are: | |
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 729 | -A REV corresponding AFP changeset id | 
| 69434 | 730 | -C DIR base directory for Isabelle components (default: """ + | 
| 731 | Components.default_components_base + """) | |
| 64202 | 732 | -O official release (not release-candidate) | 
| 733 | -R RELEASE proper release with name | |
| 64211 | 734 | -W WEBSITE produce minimal website in given directory | 
| 69413 | 735 | -c ARCHIVE clean bundling with additional component .tar.gz archive | 
| 64202 | 736 | -j INT maximum number of parallel jobs (default 1) | 
| 737 | -l build library | |
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 738 | -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) | 
| 65067 | 739 |     -p NAMES     platform families (default: """ + default_platform_families.mkString(",") + """)
 | 
| 64202 | 740 | -r REV Mercurial changeset id (default: RELEASE or tip) | 
| 741 | ||
| 742 | Build Isabelle release in base directory, using the local repository clone. | |
| 743 | """, | |
| 64405 
81bac77929d9
just one task to identify Isabelle + AFP repository snapshots and build release;
 wenzelm parents: 
64371diff
changeset | 744 | "A:" -> (arg => afp_rev = arg), | 
| 69434 | 745 | "C:" -> (arg => components_base = Path.explode(arg)), | 
| 64202 | 746 | "O" -> (_ => official_release = true), | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 747 | "R:" -> (arg => proper_release_name = Some(arg)), | 
| 64211 | 748 | "W:" -> (arg => website = Some(Path.explode(arg))), | 
| 69413 | 749 | "c:" -> (arg => | 
| 750 |           {
 | |
| 751 | val path = Path.explode(arg) | |
| 752 | Components.Archive.get_name(path.file_name) | |
| 753 | more_components = more_components ::: List(path) | |
| 754 | }), | |
| 64202 | 755 | "j:" -> (arg => parallel_jobs = Value.Int.parse(arg)), | 
| 64316 | 756 | "l" -> (_ => build_library = true), | 
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 757 | "o:" -> (arg => options = options + arg), | 
| 69410 | 758 |         "p:" -> (arg => platform_families = space_explode(',', arg).map(Platform.Family.parse)),
 | 
| 64204 | 759 | "r:" -> (arg => rev = arg)) | 
| 64202 | 760 | |
| 761 | val more_args = getopts(args) | |
| 762 |       val base_dir = more_args match { case List(base_dir) => base_dir case _ => getopts.usage() }
 | |
| 763 | ||
| 764 | val progress = new Console_Progress() | |
| 765 | ||
| 69415 | 766 |       if (platform_families.contains(Platform.Family.windows) && !Isabelle_System.bash("7z i").ok)
 | 
| 767 |         error("Building for windows requires 7z")
 | |
| 768 | ||
| 69401 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 769 | build_release(Path.explode(base_dir), options, components_base = components_base, | 
| 
7a1b7b737c02
eliminated old makedist_bundle and remote_dmg: build_release does everything in Scala;
 wenzelm parents: 
69400diff
changeset | 770 | progress = progress, rev = rev, afp_rev = afp_rev, official_release = official_release, | 
| 69397 | 771 | proper_release_name = proper_release_name, website = website, | 
| 64204 | 772 | platform_families = | 
| 69168 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 773 | if (platform_families.isEmpty) default_platform_families | 
| 
68816d1c73a7
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
 wenzelm parents: 
69167diff
changeset | 774 | else platform_families, | 
| 69413 | 775 | more_components = more_components, build_library = build_library, | 
| 69432 
d072f3287ffa
discontinued somewhat point dmg: plain .tar.gz is smaller and more convenient to install;
 wenzelm parents: 
69425diff
changeset | 776 | parallel_jobs = parallel_jobs) | 
| 64202 | 777 | } | 
| 778 | } | |
| 779 | } |