src/Pure/Admin/isabelle_devel.scala
author wenzelm
Fri, 01 Apr 2022 17:06:10 +0200
changeset 75393 87ebf5a50283
parent 74857 25e9e7088561
child 75394 42267c650205
permissions -rw-r--r--
clarified formatting, for the sake of scala3;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Admin/isabelle_devel.scala
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     3
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     4
Website for Isabelle development resources.
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     5
*/
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     6
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     7
package isabelle
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     8
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
     9
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    10
object Isabelle_Devel {
65771
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    11
  val RELEASE_SNAPSHOT = "release_snapshot"
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    12
  val BUILD_LOG_DB = "build_log.db"
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    13
  val BUILD_STATUS = "build_status"
67854
8374c80165e1 publish current log file, e.g. for easy error detection;
wenzelm
parents: 66896
diff changeset
    14
  val CRONJOB_LOG = "cronjob-main.log"
8374c80165e1 publish current log file, e.g. for easy error detection;
wenzelm
parents: 66896
diff changeset
    15
71601
97ccf48c2f0c misc tuning based on hints by IntelliJ IDEA;
wenzelm
parents: 71272
diff changeset
    16
  val root: Path = Path.explode("~/html-data/devel")
97ccf48c2f0c misc tuning based on hints by IntelliJ IDEA;
wenzelm
parents: 71272
diff changeset
    17
  val cronjob_log: Path = root + Path.basic(CRONJOB_LOG)
65771
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    18
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    19
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    20
  /* index */
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    21
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    22
  def make_index(): Unit = {
71272
1e7319957408 clarified website: redirect to isabelle-dev Phabricator Overview;
wenzelm
parents: 70105
diff changeset
    23
    val redirect = "https://isabelle-dev.sketis.net/home/menu/view/20"
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    24
65838
30c2d78b5d38 tuned signature;
wenzelm
parents: 65836
diff changeset
    25
    HTML.write_document(root, "index.html",
71272
1e7319957408 clarified website: redirect to isabelle-dev Phabricator Overview;
wenzelm
parents: 70105
diff changeset
    26
      List(
1e7319957408 clarified website: redirect to isabelle-dev Phabricator Overview;
wenzelm
parents: 70105
diff changeset
    27
        XML.Elem(Markup("meta",
1e7319957408 clarified website: redirect to isabelle-dev Phabricator Overview;
wenzelm
parents: 70105
diff changeset
    28
          List("http-equiv" -> "Refresh", "content" -> ("0; url=" + redirect))), Nil)),
1e7319957408 clarified website: redirect to isabelle-dev Phabricator Overview;
wenzelm
parents: 70105
diff changeset
    29
      List(HTML.link(redirect, HTML.text("Isabelle Development Resources"))))
65771
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    30
  }
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    31
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    32
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    33
  /* release snapshot */
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    34
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    35
  def release_snapshot(options: Options, rev: String, afp_rev: String): Unit = {
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    36
    Isabelle_System.with_tmp_dir("isadist")(target_dir => {
65793
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    37
        Isabelle_System.update_directory(root + Path.explode(RELEASE_SNAPSHOT),
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    38
          website_dir => {
73625
f8f065e20837 misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents: 73607
diff changeset
    39
          val context = Build_Release.Release_Context(target_dir)
73629
a771807df752 support for existing release archive;
wenzelm
parents: 73625
diff changeset
    40
          Build_Release.build_release_archive(context, rev)
a771807df752 support for existing release archive;
wenzelm
parents: 73625
diff changeset
    41
          Build_Release.build_release(options, context, afp_rev = afp_rev,
73625
f8f065e20837 misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents: 73607
diff changeset
    42
            build_sessions = List(Isabelle_System.getenv("ISABELLE_LOGIC")),
f8f065e20837 misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents: 73607
diff changeset
    43
            website = Some(website_dir))
f8f065e20837 misc tuning and clarification: more explicit types Release_Context, Release_Archive;
wenzelm
parents: 73607
diff changeset
    44
        })
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    45
      })
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    46
  }
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    47
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    48
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    49
  /* maintain build_log database */
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    50
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    51
  def build_log_database(options: Options, log_dirs: List[Path]): Unit = {
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    52
    val store = Build_Log.store(options)
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    53
    using(store.open_database())(db => {
66047
3e8a897042d9 more robust: store important meta info before potential failure;
wenzelm
parents: 65854
diff changeset
    54
      store.update_database(db, log_dirs)
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    55
      store.update_database(db, log_dirs, ml_statistics = true)
65771
688a7dd22cbb make index formally within Isabelle/Scala;
wenzelm
parents: 65770
diff changeset
    56
      store.snapshot_database(db, root + Path.explode(BUILD_LOG_DB))
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    57
    })
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    58
  }
65793
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    59
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    60
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    61
  /* present build status */
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    62
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 74857
diff changeset
    63
  def build_status(options: Options): Unit = {
65793
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    64
    Isabelle_System.update_directory(root + Path.explode(BUILD_STATUS),
65854
db070951dfee include full ML statistics: max heap size;
wenzelm
parents: 65838
diff changeset
    65
      dir => Build_Status.build_status(options, target_dir = dir, ml_statistics = true))
65793
96b4799a2e04 more robust update of generated directory;
wenzelm
parents: 65785
diff changeset
    66
  }
65770
fb8a7962f2ae clarified modules;
wenzelm
parents:
diff changeset
    67
}