src/Pure/Tools/dump.scala
changeset 68945 fa5d936daf1c
parent 68944 ce68b1488612
child 68946 6dd1460f6920
equal deleted inserted replaced
68944:ce68b1488612 68945:fa5d936daf1c
    73       error("Unknown aspect " + quote(name))
    73       error("Unknown aspect " + quote(name))
    74 
    74 
    75 
    75 
    76   /* dump */
    76   /* dump */
    77 
    77 
    78   val default_output_dir = Path.explode("dump")
    78   val default_output_dir: Path = Path.explode("dump")
    79   val default_commit_clean_delay = Time.seconds(-1.0)
    79   val default_commit_clean_delay: Time = Time.seconds(-1.0)
       
    80   val default_watchdog_timeout: Time = Time.seconds(600.0)
    80 
    81 
    81   def make_options(options: Options, aspects: List[Aspect]): Options =
    82   def make_options(options: Options, aspects: List[Aspect]): Options =
    82   {
    83   {
    83     val options1 = options + "completion_limit=0" + "ML_statistics=false" + "parallel_proofs=0"
    84     val options1 = options + "completion_limit=0" + "ML_statistics=false" + "parallel_proofs=0"
    84     (options1 /: aspects)({ case (opts, aspect) => (opts /: aspect.options)(_ + _) })
    85     (options1 /: aspects)({ case (opts, aspect) => (opts /: aspect.options)(_ + _) })
    91     dirs: List[Path] = Nil,
    92     dirs: List[Path] = Nil,
    92     select_dirs: List[Path] = Nil,
    93     select_dirs: List[Path] = Nil,
    93     output_dir: Path = default_output_dir,
    94     output_dir: Path = default_output_dir,
    94     verbose: Boolean = false,
    95     verbose: Boolean = false,
    95     commit_clean_delay: Time = default_commit_clean_delay,
    96     commit_clean_delay: Time = default_commit_clean_delay,
       
    97     watchdog_timeout: Time = default_watchdog_timeout,
    96     system_mode: Boolean = false,
    98     system_mode: Boolean = false,
    97     selection: Sessions.Selection = Sessions.Selection.empty): Process_Result =
    99     selection: Sessions.Selection = Sessions.Selection.empty): Process_Result =
    98   {
   100   {
    99     if (Build.build_logic(options, logic, build_heap = true, progress = progress,
   101     if (Build.build_logic(options, logic, build_heap = true, progress = progress,
   100       dirs = dirs ::: select_dirs, system_mode = system_mode) != 0) error(logic + " FAILED")
   102       dirs = dirs ::: select_dirs, system_mode = system_mode) != 0) error(logic + " FAILED")
   161 
   163 
   162     val theories_result =
   164     val theories_result =
   163       session.use_theories(use_theories,
   165       session.use_theories(use_theories,
   164         progress = progress,
   166         progress = progress,
   165         commit = Some(Consumer.apply _),
   167         commit = Some(Consumer.apply _),
   166         commit_clean_delay = commit_clean_delay)
   168         commit_clean_delay = commit_clean_delay,
       
   169         watchdog_timeout = watchdog_timeout)
   167 
   170 
   168     val session_result = session.stop()
   171     val session_result = session.stop()
   169 
   172 
   170     val consumer_ok = Consumer.shutdown()
   173     val consumer_ok = Consumer.shutdown()
   171 
   174 
   183       var base_sessions: List[String] = Nil
   186       var base_sessions: List[String] = Nil
   184       var commit_clean_delay = default_commit_clean_delay
   187       var commit_clean_delay = default_commit_clean_delay
   185       var select_dirs: List[Path] = Nil
   188       var select_dirs: List[Path] = Nil
   186       var output_dir = default_output_dir
   189       var output_dir = default_output_dir
   187       var requirements = false
   190       var requirements = false
       
   191       var watchdog_timeout = default_watchdog_timeout
   188       var exclude_session_groups: List[String] = Nil
   192       var exclude_session_groups: List[String] = Nil
   189       var all_sessions = false
   193       var all_sessions = false
   190       var dirs: List[Path] = Nil
   194       var dirs: List[Path] = Nil
   191       var session_groups: List[String] = Nil
   195       var session_groups: List[String] = Nil
   192       var logic = Isabelle_System.getenv("ISABELLE_LOGIC")
   196       var logic = Isabelle_System.getenv("ISABELLE_LOGIC")
   204     -C SECONDS   delay for cleaning of already dumped theories (disabled for < 0, default: """ +
   208     -C SECONDS   delay for cleaning of already dumped theories (disabled for < 0, default: """ +
   205       default_commit_clean_delay.seconds.toInt + """)
   209       default_commit_clean_delay.seconds.toInt + """)
   206     -D DIR       include session directory and select its sessions
   210     -D DIR       include session directory and select its sessions
   207     -O DIR       output directory for dumped files (default: """ + default_output_dir + """)
   211     -O DIR       output directory for dumped files (default: """ + default_output_dir + """)
   208     -R           operate on requirements of selected sessions
   212     -R           operate on requirements of selected sessions
       
   213     -W SECONDS   delay for cleaning of already dumped theories (disabled for < 0, default: """ +
       
   214       default_commit_clean_delay.seconds.toInt + """)
   209     -X NAME      exclude sessions from group NAME and all descendants
   215     -X NAME      exclude sessions from group NAME and all descendants
   210     -a           select all sessions
   216     -a           select all sessions
   211     -d DIR       include session directory
   217     -d DIR       include session directory
   212     -g NAME      select session group NAME
   218     -g NAME      select session group NAME
   213     -l NAME      logic session name (default ISABELLE_LOGIC=""" + quote(logic) + """)
   219     -l NAME      logic session name (default ISABELLE_LOGIC=""" + quote(logic) + """)
   223       "B:" -> (arg => base_sessions = base_sessions ::: List(arg)),
   229       "B:" -> (arg => base_sessions = base_sessions ::: List(arg)),
   224       "C:" -> (arg => commit_clean_delay = Value.Seconds.parse(arg)),
   230       "C:" -> (arg => commit_clean_delay = Value.Seconds.parse(arg)),
   225       "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))),
   231       "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))),
   226       "O:" -> (arg => output_dir = Path.explode(arg)),
   232       "O:" -> (arg => output_dir = Path.explode(arg)),
   227       "R" -> (_ => requirements = true),
   233       "R" -> (_ => requirements = true),
       
   234       "W:" -> (arg => watchdog_timeout = Value.Seconds.parse(arg)),
   228       "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)),
   235       "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)),
   229       "a" -> (_ => all_sessions = true),
   236       "a" -> (_ => all_sessions = true),
   230       "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
   237       "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
   231       "g:" -> (arg => session_groups = session_groups ::: List(arg)),
   238       "g:" -> (arg => session_groups = session_groups ::: List(arg)),
   232       "l:" -> (arg => logic = arg),
   239       "l:" -> (arg => logic = arg),
   252             progress = progress,
   259             progress = progress,
   253             dirs = dirs,
   260             dirs = dirs,
   254             select_dirs = select_dirs,
   261             select_dirs = select_dirs,
   255             output_dir = output_dir,
   262             output_dir = output_dir,
   256             commit_clean_delay = commit_clean_delay,
   263             commit_clean_delay = commit_clean_delay,
       
   264             watchdog_timeout = watchdog_timeout,
   257             verbose = verbose,
   265             verbose = verbose,
   258             selection = Sessions.Selection(
   266             selection = Sessions.Selection(
   259               requirements = requirements,
   267               requirements = requirements,
   260               all_sessions = all_sessions,
   268               all_sessions = all_sessions,
   261               base_sessions = base_sessions,
   269               base_sessions = base_sessions,