src/Pure/Admin/build_history.scala
changeset 66861 f6676691ef8a
parent 66860 54ae2cc05325
child 66862 136793b73c7c
equal deleted inserted replaced
66860:54ae2cc05325 66861:f6676691ef8a
   100   private val default_multicore = (1, 1)
   100   private val default_multicore = (1, 1)
   101   private val default_heap = 1500
   101   private val default_heap = 1500
   102   private val default_isabelle_identifier = "build_history"
   102   private val default_isabelle_identifier = "build_history"
   103 
   103 
   104   def build_history(
   104   def build_history(
       
   105     options: Options,
   105     root: Path,
   106     root: Path,
   106     progress: Progress = No_Progress,
   107     progress: Progress = No_Progress,
   107     rev: String = default_rev,
   108     rev: String = default_rev,
   108     afp_rev: Option[String] = None,
   109     afp_rev: Option[String] = None,
       
   110     afp_partition: Int = 0,
   109     isabelle_identifier: String = default_isabelle_identifier,
   111     isabelle_identifier: String = default_isabelle_identifier,
   110     components_base: String = "",
   112     components_base: String = "",
   111     fresh: Boolean = false,
   113     fresh: Boolean = false,
   112     nonfree: Boolean = false,
   114     nonfree: Boolean = false,
   113     multicore_base: Boolean = false,
   115     multicore_base: Boolean = false,
   151       progress.echo_if(verbose, hg.log(version, options = "-l1"))
   153       progress.echo_if(verbose, hg.log(version, options = "-l1"))
   152       hg.id(rev)
   154       hg.id(rev)
   153     }
   155     }
   154 
   156 
   155     val isabelle_version = checkout(root, rev)
   157     val isabelle_version = checkout(root, rev)
   156     val afp_version = afp_rev.map(checkout(root + Path.explode("AFP"), _))
   158 
       
   159     val afp_repos = root + Path.explode("AFP")
       
   160     val afp_version = afp_rev.map(checkout(afp_repos, _))
       
   161 
       
   162     val (afp_build_options, afp_build_args) =
       
   163       if (afp_rev.isEmpty) (Nil, Nil)
       
   164       else {
       
   165         val afp = AFP.init(options, afp_repos)
       
   166         (List("-d", "~~/AFP/thys"), afp.partition(afp_partition))
       
   167       }
   157 
   168 
   158 
   169 
   159     /* main */
   170     /* main */
   160 
   171 
   161     val other_isabelle = new Other_Isabelle(progress, root, isabelle_identifier)
   172     val other_isabelle = new Other_Isabelle(progress, root, isabelle_identifier)
   162 
       
   163     val afp_build_args = if (afp_rev.isDefined) List("-d", "~~/AFP/thys") else Nil
       
   164 
   173 
   165     val build_host = Isabelle_System.hostname()
   174     val build_host = Isabelle_System.hostname()
   166     val build_history_date = Date.now()
   175     val build_history_date = Date.now()
   167     val build_group_id = build_host + ":" + build_history_date.time.ms
   176     val build_group_id = build_host + ":" + build_history_date.time.ms
   168 
   177 
   212 
   221 
   213       if (multicore_base && !first_build && isabelle_base_log.is_dir)
   222       if (multicore_base && !first_build && isabelle_base_log.is_dir)
   214         Isabelle_System.copy_dir(isabelle_base_log, isabelle_output_log)
   223         Isabelle_System.copy_dir(isabelle_base_log, isabelle_output_log)
   215 
   224 
   216       val build_start = Date.now()
   225       val build_start = Date.now()
   217       val build_args1 = List("-v", "-j" + processes) ::: afp_build_args ::: build_args
   226       val build_args1 =
       
   227         List("-v", "-j" + processes) ::: afp_build_options ::: build_args ::: afp_build_args
   218       val build_result =
   228       val build_result =
   219         (new Other_Isabelle(build_out_progress, root, isabelle_identifier))(
   229         (new Other_Isabelle(build_out_progress, root, isabelle_identifier))(
   220           "build " + Bash.strings(build_args1), redirect = true, echo = true, strict = false)
   230           "build " + Bash.strings(build_args1), redirect = true, echo = true, strict = false)
   221       val build_end = Date.now()
   231       val build_end = Date.now()
   222 
   232 
   333       var components_base = ""
   343       var components_base = ""
   334       var heap: Option[Int] = None
   344       var heap: Option[Int] = None
   335       var max_heap: Option[Int] = None
   345       var max_heap: Option[Int] = None
   336       var multicore_list = List(default_multicore)
   346       var multicore_list = List(default_multicore)
   337       var isabelle_identifier = default_isabelle_identifier
   347       var isabelle_identifier = default_isabelle_identifier
       
   348       var afp_partition = 0
   338       var more_settings: List[String] = Nil
   349       var more_settings: List[String] = Nil
   339       var fresh = false
   350       var fresh = false
   340       var init_settings: List[String] = Nil
   351       var init_settings: List[String] = Nil
   341       var arch_64 = false
   352       var arch_64 = false
   342       var nonfree = false
   353       var nonfree = false
   355     -C DIR       base directory for Isabelle components (default: $ISABELLE_HOME_USER/../contrib)
   366     -C DIR       base directory for Isabelle components (default: $ISABELLE_HOME_USER/../contrib)
   356     -H SIZE      minimal ML heap in MB (default: """ + default_heap + """ for x86, """ +
   367     -H SIZE      minimal ML heap in MB (default: """ + default_heap + """ for x86, """ +
   357       default_heap * 2 + """ for x86_64)
   368       default_heap * 2 + """ for x86_64)
   358     -M MULTICORE multicore configurations (see below)
   369     -M MULTICORE multicore configurations (see below)
   359     -N NAME      alternative ISABELLE_IDENTIFIER (default: """ + default_isabelle_identifier + """)
   370     -N NAME      alternative ISABELLE_IDENTIFIER (default: """ + default_isabelle_identifier + """)
       
   371     -P NUMBER    AFP partition number (0, 1, 2, default: 0=unrestricted)
   360     -U SIZE      maximal ML heap in MB (default: unbounded)
   372     -U SIZE      maximal ML heap in MB (default: unbounded)
   361     -e TEXT      additional text for generated etc/settings
   373     -e TEXT      additional text for generated etc/settings
   362     -f           fresh build of Isabelle/Scala components (recommended)
   374     -f           fresh build of Isabelle/Scala components (recommended)
   363     -i TEXT      initial text for generated etc/settings
   375     -i TEXT      initial text for generated etc/settings
   364     -m ARCH      processor architecture (32=x86, 64=x86_64, default: x86)
   376     -m ARCH      processor architecture (32=x86, 64=x86_64, default: x86)
   379         "B" -> (_ => multicore_base = true),
   391         "B" -> (_ => multicore_base = true),
   380         "C:" -> (arg => components_base = arg),
   392         "C:" -> (arg => components_base = arg),
   381         "H:" -> (arg => heap = Some(Value.Int.parse(arg))),
   393         "H:" -> (arg => heap = Some(Value.Int.parse(arg))),
   382         "M:" -> (arg => multicore_list = space_explode(',', arg).map(Multicore.parse(_))),
   394         "M:" -> (arg => multicore_list = space_explode(',', arg).map(Multicore.parse(_))),
   383         "N:" -> (arg => isabelle_identifier = arg),
   395         "N:" -> (arg => isabelle_identifier = arg),
       
   396         "P:" -> (arg => afp_partition = Value.Int.parse(arg)),
   384         "U:" -> (arg => max_heap = Some(Value.Int.parse(arg))),
   397         "U:" -> (arg => max_heap = Some(Value.Int.parse(arg))),
   385         "e:" -> (arg => more_settings = more_settings ::: List(arg)),
   398         "e:" -> (arg => more_settings = more_settings ::: List(arg)),
   386         "f" -> (_ => fresh = true),
   399         "f" -> (_ => fresh = true),
   387         "i:" -> (arg => init_settings = init_settings ::: List(arg)),
   400         "i:" -> (arg => init_settings = init_settings ::: List(arg)),
   388         "m:" ->
   401         "m:" ->
   406         }
   419         }
   407 
   420 
   408       val progress = new Console_Progress(stderr = true)
   421       val progress = new Console_Progress(stderr = true)
   409 
   422 
   410       val results =
   423       val results =
   411         build_history(root, progress = progress, rev = rev, afp_rev = afp_rev,
   424         build_history(Options.init(), root, progress = progress, rev = rev, afp_rev = afp_rev,
   412           isabelle_identifier = isabelle_identifier, components_base = components_base,
   425           afp_partition = afp_partition, isabelle_identifier = isabelle_identifier,
   413           fresh = fresh, nonfree = nonfree, multicore_base = multicore_base,
   426           components_base = components_base, fresh = fresh, nonfree = nonfree,
   414           multicore_list = multicore_list, arch_64 = arch_64,
   427           multicore_base = multicore_base, multicore_list = multicore_list, arch_64 = arch_64,
   415           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   428           heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap),
   416           max_heap = max_heap, init_settings = init_settings, more_settings = more_settings,
   429           max_heap = max_heap, init_settings = init_settings, more_settings = more_settings,
   417           verbose = verbose, build_tags = build_tags, build_args = build_args)
   430           verbose = verbose, build_tags = build_tags, build_args = build_args)
   418 
   431 
   419       if (output_file == "") {
   432       if (output_file == "") {