src/Pure/Admin/build_scala.scala
author wenzelm
Fri, 01 Jul 2022 20:27:56 +0200
changeset 75645 6cb76a8adc06
parent 75421 3c710067b178
child 76176 d6bd84eb94a3
permissions -rw-r--r--
updated download version;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Admin/build_scala.scala
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     3
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     4
Build Isabelle Scala component from official downloads.
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     5
*/
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     6
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     7
package isabelle
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     8
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
     9
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    10
object Build_Scala {
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    11
  /* downloads */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    12
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    13
  sealed case class Download(
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    14
    name: String,
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    15
    version: String,
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    16
    url: String,
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    17
    physical_url: String = "",
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    18
    base_version: String = "3"
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    19
  ) {
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    20
    def make_url(template: String): String =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    21
      template.replace("{V}", version).replace("{B}", base_version)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    22
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    23
    def proper_url: String = make_url(proper_string(physical_url).getOrElse(url))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    24
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    25
    def artifact: String =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    26
      Library.take_suffix[Char](_ != '/', proper_url.toList)._2.mkString
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    27
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    28
    def get(path: Path, progress: Progress = new Progress): Unit =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    29
      Isabelle_System.download_file(proper_url, path, progress = progress)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    30
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    31
    def get_unpacked(dir: Path, strip: Int = 0, progress: Progress = new Progress): Unit =
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
    32
      Isabelle_System.with_tmp_file("archive"){ archive_path =>
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    33
        get(archive_path, progress = progress)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    34
        progress.echo("Unpacking " + artifact)
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
    35
        Isabelle_System.gnutar(
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
    36
          "-xzf " + File.bash_path(archive_path), dir = dir, strip = strip).check
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
    37
      }
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    38
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    39
    def print: String =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    40
      "  * " + name + " " + version +
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    41
        (if (base_version.nonEmpty) " for Scala " + base_version else "") +
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    42
        ":\n    " + make_url(url)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    43
  }
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    44
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    45
  val main_download: Download =
75645
6cb76a8adc06 updated download version;
wenzelm
parents: 75421
diff changeset
    46
    Download("scala", "3.1.3", base_version = "",
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    47
      url = "https://github.com/lampepfl/dotty/releases/download/{V}/scala3-{V}.tar.gz")
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    48
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    49
  val lib_downloads: List[Download] = List(
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    50
    Download("scala-parallel-collections", "1.0.4",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    51
      "https://mvnrepository.com/artifact/org.scala-lang.modules/scala-parallel-collections_{B}/{V}",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    52
      physical_url = "https://repo1.maven.org/maven2/org/scala-lang/modules/scala-parallel-collections_{B}/{V}/scala-parallel-collections_{B}-{V}.jar"),
75421
3c710067b178 back to more ambitious scala-3.1.1 (see 8b7497992301);
wenzelm
parents: 75394
diff changeset
    53
    Download("scala-parser-combinators", "2.1.1",
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    54
      "https://mvnrepository.com/artifact/org.scala-lang.modules/scala-parser-combinators_{B}/{V}",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    55
      physical_url = "https://repo1.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_{B}/{V}/scala-parser-combinators_{B}-{V}.jar"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    56
    Download("scala-swing", "3.0.0",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    57
      "https://mvnrepository.com/artifact/org.scala-lang.modules/scala-swing_{B}/{V}",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    58
      physical_url = "https://repo1.maven.org/maven2/org/scala-lang/modules/scala-swing_{B}/{V}/scala-swing_{B}-{V}.jar"),
75421
3c710067b178 back to more ambitious scala-3.1.1 (see 8b7497992301);
wenzelm
parents: 75394
diff changeset
    59
    Download("scala-xml", "2.1.0",
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    60
      "https://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_{B}/{V}",
75421
3c710067b178 back to more ambitious scala-3.1.1 (see 8b7497992301);
wenzelm
parents: 75394
diff changeset
    61
      physical_url = "https://repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_{B}/{V}/scala-xml_{B}-{V}.jar")
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    62
  )
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    63
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    64
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    65
  /* build Scala component */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    66
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    67
  def build_scala(
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    68
    target_dir: Path = Path.current,
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    69
    progress: Progress = new Progress
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    70
  ): Unit = {
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    71
    /* component */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    72
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    73
    val component_name = main_download.name + "-" + main_download.version
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    74
    val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    75
    progress.echo("Component " + component_dir)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    76
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    77
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    78
    /* download */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    79
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    80
    main_download.get_unpacked(component_dir, strip = 1, progress = progress)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    81
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    82
    val lib_dir = component_dir + Path.explode("lib")
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    83
    lib_downloads.foreach(download =>
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    84
      download.get(lib_dir + Path.basic(download.artifact), progress = progress))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    85
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    86
    File.write(component_dir + Path.basic("LICENSE"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    87
      Url.read(Url("https://www.apache.org/licenses/LICENSE-2.0.txt")))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    88
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    89
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    90
    /* classpath */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    91
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 75381
diff changeset
    92
    val classpath: List[String] = {
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    93
      def no_function(name: String): String = "function " + name + "() {\n:\n}"
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    94
      val script =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    95
        cat_lines(List(
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    96
          no_function("stty"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    97
          no_function("tput"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    98
          "PROG_HOME=" + File.bash_path(component_dir),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
    99
          File.read(component_dir + Path.explode("bin/common"))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   100
            .replace("scala_exit_status=127", "scala_exit_status=0"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   101
          "compilerJavaClasspathArgs",
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   102
          "echo \"$jvm_cp_args\""))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   103
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   104
      val main_classpath = Path.split(Isabelle_System.bash(script).check.out).map(_.file_name)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   105
      val lib_classpath = lib_downloads.map(_.artifact)
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   106
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   107
      main_classpath ::: lib_classpath
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   108
    }
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   109
75378
14154ac511ba provide SCALA_INTERFACES for isabelle_setup;
wenzelm
parents: 75377
diff changeset
   110
    val interfaces =
14154ac511ba provide SCALA_INTERFACES for isabelle_setup;
wenzelm
parents: 75377
diff changeset
   111
      classpath.find(_.startsWith("scala3-interfaces"))
14154ac511ba provide SCALA_INTERFACES for isabelle_setup;
wenzelm
parents: 75377
diff changeset
   112
        .getOrElse(error("Missing jar for scala3-interfaces"))
14154ac511ba provide SCALA_INTERFACES for isabelle_setup;
wenzelm
parents: 75377
diff changeset
   113
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   114
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   115
    /* settings */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   116
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   117
    val etc_dir = Isabelle_System.make_directory(component_dir + Path.basic("etc"))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   118
    File.write(etc_dir + Path.basic("settings"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   119
      """# -*- shell-script -*- :mode=shellscript:
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   120
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   121
SCALA_HOME="$COMPONENT"
75378
14154ac511ba provide SCALA_INTERFACES for isabelle_setup;
wenzelm
parents: 75377
diff changeset
   122
SCALA_INTERFACES="$SCALA_HOME/lib/""" + interfaces + """"
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   123
""" + terminate_lines(classpath.map(jar => "classpath \"$SCALA_HOME/lib/" + jar + "\"")))
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   124
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   125
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   126
    /* README */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   127
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   128
    File.write(component_dir + Path.basic("README"),
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   129
      "This distribution of Scala integrates the following parts:\n\n" +
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   130
      (main_download :: lib_downloads).map(_.print).mkString("\n\n") + """
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   131
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   132
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   133
        Makarius
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   134
        """ + Date.Format.date(Date.now()) + "\n")
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   135
  }
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   136
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   137
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   138
  /* Isabelle tool wrapper */
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   139
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   140
  val isabelle_tool =
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   141
    Isabelle_Tool("build_scala", "build Isabelle Scala component from official downloads",
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   142
      Scala_Project.here,
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   143
      { args =>
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   144
        var target_dir = Path.current
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   145
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   146
        val getopts = Getopts("""
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   147
Usage: isabelle build_scala [OPTIONS]
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   148
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   149
  Options are:
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   150
    -D DIR       target directory (default ".")
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   151
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   152
  Build Isabelle Scala component from official downloads.
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   153
""",
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   154
          "D:" -> (arg => target_dir = Path.explode(arg)))
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   155
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   156
        val more_args = getopts(args)
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   157
        if (more_args.nonEmpty) getopts.usage()
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   158
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   159
        val progress = new Console_Progress()
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   160
75394
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   161
        build_scala(target_dir = target_dir, progress = progress)
42267c650205 tuned formatting;
wenzelm
parents: 75393
diff changeset
   162
      })
75377
4ce7d95612cb build Isabelle Scala component from official downloads (for scala-3.1.1);
wenzelm
parents:
diff changeset
   163
}