393 list_files: Boolean = false, |
393 list_files: Boolean = false, |
394 check_keywords: Set[String] = Set.empty, |
394 check_keywords: Set[String] = Set.empty, |
395 fresh_build: Boolean = false, |
395 fresh_build: Boolean = false, |
396 no_build: Boolean = false, |
396 no_build: Boolean = false, |
397 soft_build: Boolean = false, |
397 soft_build: Boolean = false, |
398 system_mode: Boolean = false, |
|
399 verbose: Boolean = false, |
398 verbose: Boolean = false, |
400 export_files: Boolean = false, |
399 export_files: Boolean = false, |
401 pide: Boolean = false, |
400 pide: Boolean = false, |
402 requirements: Boolean = false, |
401 requirements: Boolean = false, |
403 all_sessions: Boolean = false, |
402 all_sessions: Boolean = false, |
408 sessions: List[String] = Nil, |
407 sessions: List[String] = Nil, |
409 selection: Sessions.Selection = Sessions.Selection.empty): Results = |
408 selection: Sessions.Selection = Sessions.Selection.empty): Results = |
410 { |
409 { |
411 val build_options = options.int.update("completion_limit", 0).bool.update("ML_statistics", true) |
410 val build_options = options.int.update("completion_limit", 0).bool.update("ML_statistics", true) |
412 |
411 |
413 val store = Sessions.store(build_options, system_mode) |
412 val store = Sessions.store(build_options) |
414 |
413 |
415 Isabelle_Fonts.init() |
414 Isabelle_Fonts.init() |
416 |
415 |
417 |
416 |
418 /* session selection and dependencies */ |
417 /* session selection and dependencies */ |
735 var max_jobs = 1 |
734 var max_jobs = 1 |
736 var check_keywords: Set[String] = Set.empty |
735 var check_keywords: Set[String] = Set.empty |
737 var list_files = false |
736 var list_files = false |
738 var no_build = false |
737 var no_build = false |
739 var options = Options.init(opts = build_options) |
738 var options = Options.init(opts = build_options) |
740 var system_mode = false |
|
741 var verbose = false |
739 var verbose = false |
742 var exclude_sessions: List[String] = Nil |
740 var exclude_sessions: List[String] = Nil |
743 |
741 |
744 val getopts = Getopts(""" |
742 val getopts = Getopts(""" |
745 Usage: isabelle build [OPTIONS] [SESSIONS ...] |
743 Usage: isabelle build [OPTIONS] [SESSIONS ...] |
762 -j INT maximum number of parallel jobs (default 1) |
760 -j INT maximum number of parallel jobs (default 1) |
763 -k KEYWORD check theory sources for conflicts with proposed keywords |
761 -k KEYWORD check theory sources for conflicts with proposed keywords |
764 -l list session source files |
762 -l list session source files |
765 -n no build -- test dependencies only |
763 -n no build -- test dependencies only |
766 -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
764 -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
767 -s system build mode: produce output in ISABELLE_HOME |
|
768 -v verbose |
765 -v verbose |
769 -x NAME exclude session NAME and all descendants |
766 -x NAME exclude session NAME and all descendants |
770 |
767 |
771 Build and manage Isabelle sessions, depending on implicit settings: |
768 Build and manage Isabelle sessions, depending on implicit settings: |
772 |
769 |
788 "j:" -> (arg => max_jobs = Value.Int.parse(arg)), |
785 "j:" -> (arg => max_jobs = Value.Int.parse(arg)), |
789 "k:" -> (arg => check_keywords = check_keywords + arg), |
786 "k:" -> (arg => check_keywords = check_keywords + arg), |
790 "l" -> (_ => list_files = true), |
787 "l" -> (_ => list_files = true), |
791 "n" -> (_ => no_build = true), |
788 "n" -> (_ => no_build = true), |
792 "o:" -> (arg => options = options + arg), |
789 "o:" -> (arg => options = options + arg), |
793 "s" -> (_ => system_mode = true), |
|
794 "v" -> (_ => verbose = true), |
790 "v" -> (_ => verbose = true), |
795 "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg))) |
791 "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg))) |
796 |
792 |
797 val sessions = getopts(args) |
793 val sessions = getopts(args) |
798 |
794 |
821 list_files = list_files, |
817 list_files = list_files, |
822 check_keywords = check_keywords, |
818 check_keywords = check_keywords, |
823 fresh_build = fresh_build, |
819 fresh_build = fresh_build, |
824 no_build = no_build, |
820 no_build = no_build, |
825 soft_build = soft_build, |
821 soft_build = soft_build, |
826 system_mode = system_mode, |
|
827 verbose = verbose, |
822 verbose = verbose, |
828 export_files = export_files, |
823 export_files = export_files, |
829 pide = pide, |
824 pide = pide, |
830 requirements = requirements, |
825 requirements = requirements, |
831 all_sessions = all_sessions, |
826 all_sessions = all_sessions, |
855 |
850 |
856 def build_logic(options: Options, logic: String, |
851 def build_logic(options: Options, logic: String, |
857 progress: Progress = No_Progress, |
852 progress: Progress = No_Progress, |
858 build_heap: Boolean = false, |
853 build_heap: Boolean = false, |
859 dirs: List[Path] = Nil, |
854 dirs: List[Path] = Nil, |
860 system_mode: Boolean = false, |
|
861 strict: Boolean = false): Int = |
855 strict: Boolean = false): Int = |
862 { |
856 { |
863 val rc = |
857 val rc = |
864 if (build(options, build_heap = build_heap, no_build = true, dirs = dirs, |
858 if (build(options, build_heap = build_heap, no_build = true, dirs = dirs, |
865 system_mode = system_mode, sessions = List(logic)).ok) 0 |
859 sessions = List(logic)).ok) 0 |
866 else { |
860 else { |
867 progress.echo("Build started for Isabelle/" + logic + " ...") |
861 progress.echo("Build started for Isabelle/" + logic + " ...") |
868 Build.build(options, progress = progress, build_heap = build_heap, dirs = dirs, |
862 Build.build(options, progress = progress, build_heap = build_heap, dirs = dirs, |
869 system_mode = system_mode, sessions = List(logic)).rc |
863 sessions = List(logic)).rc |
870 } |
864 } |
871 |
865 |
872 if (strict && rc != 0) error("Failed to build Isabelle/" + logic) else rc |
866 if (strict && rc != 0) error("Failed to build Isabelle/" + logic) else rc |
873 } |
867 } |
874 } |
868 } |