src/Pure/Admin/isabelle_cronjob.scala
changeset 64215 123e6dcd3852
parent 64199 f38d39c57959
child 64218 f318cb6ba511
equal deleted inserted replaced
64214:284e8ca54c21 64215:123e6dcd3852
    19   val main_state_file = main_dir + Path.explode("run/main.state")
    19   val main_state_file = main_dir + Path.explode("run/main.state")
    20   val main_log = main_dir + Path.explode("log/main.log")  // owned by log service
    20   val main_log = main_dir + Path.explode("log/main.log")  // owned by log service
    21 
    21 
    22   val isabelle_repos = main_dir + Path.explode("isabelle-build_history")
    22   val isabelle_repos = main_dir + Path.explode("isabelle-build_history")
    23   val afp_repos = main_dir + Path.explode("AFP-build_history")
    23   val afp_repos = main_dir + Path.explode("AFP-build_history")
       
    24 
       
    25   val release_snapshot = main_dir + Path.explode("release_snapshot")
    24 
    26 
    25 
    27 
    26 
    28 
    27   /** particular tasks **/
    29   /** particular tasks **/
    28 
    30 
    55         } {
    57         } {
    56           result.check
    58           result.check
    57           File.copy(log_path, logger.log_dir + log_path.base)
    59           File.copy(log_path, logger.log_dir + log_path.base)
    58         }
    60         }
    59       })
    61       })
       
    62 
       
    63 
       
    64   /* build release from repository snapshot */
       
    65 
       
    66   private val build_release =
       
    67     Logger_Task("build_release", logger =>
       
    68       Isabelle_System.with_tmp_dir("isadist")(tmp_dir =>
       
    69         {
       
    70           val base_dir = File.path(tmp_dir)
       
    71 
       
    72           val new_snapshot = release_snapshot.ext("new")
       
    73           val old_snapshot = release_snapshot.ext("old")
       
    74 
       
    75           Isabelle_System.rm_tree(new_snapshot)
       
    76           Isabelle_System.rm_tree(old_snapshot)
       
    77 
       
    78           Build_Release.build_release(base_dir, parallel_jobs = 4,
       
    79             remote_mac = "macbroy30", website = Some(new_snapshot))
       
    80 
       
    81           if (release_snapshot.is_dir) File.mv(release_snapshot, old_snapshot)
       
    82           File.mv(new_snapshot, release_snapshot)
       
    83           Isabelle_System.rm_tree(old_snapshot)
       
    84         }))
    60 
    85 
    61 
    86 
    62 
    87 
    63   /** task logging **/
    88   /** task logging **/
    64 
    89 
   189     val main_start_date = Date.now()
   214     val main_start_date = Date.now()
   190     File.write(main_state_file, main_start_date + " " + log_service.hostname)
   215     File.write(main_state_file, main_start_date + " " + log_service.hostname)
   191 
   216 
   192     run(main_start_date,
   217     run(main_start_date,
   193       Logger_Task("isabelle_cronjob", _ =>
   218       Logger_Task("isabelle_cronjob", _ =>
   194         run_now(SEQ(isabelle_identify, build_history_base))))
   219         run_now(SEQ(isabelle_identify, build_history_base, build_release))))
   195 
   220 
   196     log_service.shutdown()
   221     log_service.shutdown()
   197 
   222 
   198     main_state_file.file.delete
   223     main_state_file.file.delete
   199   }
   224   }