| author | wenzelm | 
| Wed, 22 Jun 2022 17:07:00 +0200 | |
| changeset 75597 | e6e0a95f87f3 | 
| parent 75551 | 4103b945c7b5 | 
| child 77680 | bc8e2fec9650 | 
| permissions | -rw-r--r-- | 
| 65770 | 1 | /* Title: Pure/Admin/isabelle_devel.scala | 
| 2 | Author: Makarius | |
| 3 | ||
| 4 | Website for Isabelle development resources. | |
| 5 | */ | |
| 6 | ||
| 7 | package isabelle | |
| 8 | ||
| 9 | ||
| 75393 | 10 | object Isabelle_Devel {
 | 
| 65771 | 11 | val RELEASE_SNAPSHOT = "release_snapshot" | 
| 12 | val BUILD_LOG_DB = "build_log.db" | |
| 13 | val BUILD_STATUS = "build_status" | |
| 67854 
8374c80165e1
publish current log file, e.g. for easy error detection;
 wenzelm parents: 
66896diff
changeset | 14 | val CRONJOB_LOG = "cronjob-main.log" | 
| 
8374c80165e1
publish current log file, e.g. for easy error detection;
 wenzelm parents: 
66896diff
changeset | 15 | |
| 71601 | 16 |   val root: Path = Path.explode("~/html-data/devel")
 | 
| 17 | val cronjob_log: Path = root + Path.basic(CRONJOB_LOG) | |
| 65771 | 18 | |
| 19 | ||
| 20 | /* index */ | |
| 21 | ||
| 75393 | 22 |   def make_index(): Unit = {
 | 
| 71272 
1e7319957408
clarified website: redirect to isabelle-dev Phabricator Overview;
 wenzelm parents: 
70105diff
changeset | 23 | val redirect = "https://isabelle-dev.sketis.net/home/menu/view/20" | 
| 65770 | 24 | |
| 65838 | 25 | HTML.write_document(root, "index.html", | 
| 71272 
1e7319957408
clarified website: redirect to isabelle-dev Phabricator Overview;
 wenzelm parents: 
70105diff
changeset | 26 | List( | 
| 
1e7319957408
clarified website: redirect to isabelle-dev Phabricator Overview;
 wenzelm parents: 
70105diff
changeset | 27 |         XML.Elem(Markup("meta",
 | 
| 
1e7319957408
clarified website: redirect to isabelle-dev Phabricator Overview;
 wenzelm parents: 
70105diff
changeset | 28 |           List("http-equiv" -> "Refresh", "content" -> ("0; url=" + redirect))), Nil)),
 | 
| 
1e7319957408
clarified website: redirect to isabelle-dev Phabricator Overview;
 wenzelm parents: 
70105diff
changeset | 29 |       List(HTML.link(redirect, HTML.text("Isabelle Development Resources"))))
 | 
| 65771 | 30 | } | 
| 65770 | 31 | |
| 32 | ||
| 33 | /* release snapshot */ | |
| 34 | ||
| 75551 
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
 wenzelm parents: 
75394diff
changeset | 35 | def release_snapshot(options: Options, rev: String, afp_rev: String, | 
| 
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
 wenzelm parents: 
75394diff
changeset | 36 | progress: Progress = new Progress | 
| 
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
 wenzelm parents: 
75394diff
changeset | 37 |   ): Unit = {
 | 
| 75394 | 38 |     Isabelle_System.with_tmp_dir("isadist") { target_dir =>
 | 
| 39 | Isabelle_System.update_directory(root + Path.explode(RELEASE_SNAPSHOT), | |
| 40 |         { website_dir =>
 | |
| 75551 
4103b945c7b5
more informative release_snapshot, to see better where the cronjob fails;
 wenzelm parents: 
75394diff
changeset | 41 | val context = Build_Release.Release_Context(target_dir, progress = progress) | 
| 73629 | 42 | Build_Release.build_release_archive(context, rev) | 
| 43 | 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: 
73607diff
changeset | 44 |             build_sessions = List(Isabelle_System.getenv("ISABELLE_LOGIC")),
 | 
| 
f8f065e20837
misc tuning and clarification: more explicit types Release_Context, Release_Archive;
 wenzelm parents: 
73607diff
changeset | 45 | website = Some(website_dir)) | 
| 75394 | 46 | } | 
| 47 | ) | |
| 48 | } | |
| 65770 | 49 | } | 
| 50 | ||
| 51 | ||
| 52 | /* maintain build_log database */ | |
| 53 | ||
| 75393 | 54 |   def build_log_database(options: Options, log_dirs: List[Path]): Unit = {
 | 
| 65770 | 55 | val store = Build_Log.store(options) | 
| 75394 | 56 |     using(store.open_database()) { db =>
 | 
| 66047 
3e8a897042d9
more robust: store important meta info before potential failure;
 wenzelm parents: 
65854diff
changeset | 57 | store.update_database(db, log_dirs) | 
| 65770 | 58 | store.update_database(db, log_dirs, ml_statistics = true) | 
| 65771 | 59 | store.snapshot_database(db, root + Path.explode(BUILD_LOG_DB)) | 
| 75394 | 60 | } | 
| 65770 | 61 | } | 
| 65793 | 62 | |
| 63 | ||
| 64 | /* present build status */ | |
| 65 | ||
| 75393 | 66 |   def build_status(options: Options): Unit = {
 | 
| 65793 | 67 | Isabelle_System.update_directory(root + Path.explode(BUILD_STATUS), | 
| 65854 | 68 | dir => Build_Status.build_status(options, target_dir = dir, ml_statistics = true)) | 
| 65793 | 69 | } | 
| 65770 | 70 | } |