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