1 ! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs benchmark bootstrap.stage2 calendar
4 command-line compiler.errors continuations debugger help.html
5 help.lint io io.directories io.encodings.utf8 io.files io.styles
6 kernel mason.common math memory namespaces parser.notes
7 sequences sets sorting source-files.errors system threads
8 tools.errors tools.test tools.time vocabs
9 vocabs.hierarchy.private vocabs.loader vocabs.refresh ;
12 : vocab-heading. ( vocab -- )
15 [ vocab-name ] [ lookup-vocab write-object ] bi ":" print
18 : load-error. ( triple -- )
19 [ first vocab-heading. ] [ second print-error ] bi ;
21 : load-failures. ( failures -- ) [ load-error. nl ] each ;
23 : require-all-no-restarts ( vocabs -- failures )
27 [ swap vocab-name _ set-at ] recover
31 : load-from-root-no-restarts ( root prefix -- failures )
32 vocabs-to-load require-all-no-restarts ;
34 : load-no-restarts ( prefix -- failures )
35 [ vocab-roots get dup ] dip '[
36 _ swap 1 + head vocab-roots [
37 _ load-from-root-no-restarts
43 [ keys load-all-vocabs-file to-file ]
44 [ load-all-errors-file utf8 [ load-failures. ] with-file-writer ]
47 :: do-step ( errors summary-file details-file -- )
49 [ error-type +linkage-error+ eq? ] reject
50 [ path>> ] map members natural-sort summary-file to-file
51 errors details-file utf8 [ errors. ] with-file-writer ;
56 "resource:core" test-root
57 "resource:basis" test-root
68 ! Give the cleanup a chance to run before looking at the errors.
70 lint-failures get values
75 : do-benchmarks ( -- )
77 [ benchmarks-file to-file ] [
78 [ keys benchmark-error-vocabs-file to-file ]
79 [ benchmark-error-messages-file utf8 [ benchmark-errors. ] with-file-writer ] bi
82 : do-compile-errors ( -- )
83 compiler-errors get values
85 compiler-error-messages-file
88 : outdated-core-vocabs ( -- modified-sources modified-docs any? )
89 "" to-refresh drop 2dup [ empty? not ] either? ;
91 : outdated-boot-image. ( modified-sources modified-docs -- )
92 "Boot image is out of date. Changed vocabs:" print
96 : check-boot-image ( -- ? )
97 outdated-core-vocabs [ outdated-boot-image. t ] [ 2drop f ] if ;
101 "~/.factor-mason-rc" try-user-init
104 : check-user-init-errors ( -- ? )
105 user-init-errors get-global assoc-empty?
106 [ f ] [ :user-init-errors t ] if ;
109 f parser-quiet? set-global
110 f restartable-tests? set-global
112 run-mason-rc check-user-init-errors [ 1 exit ] when
113 bootstrap-time get boot-time-file to-file
114 check-boot-image [ 1 exit ] when
115 [ do-load ] benchmark load-time-file to-file
116 [ generate-help ] benchmark html-help-time-file to-file
117 [ do-tests ] benchmark test-time-file to-file
118 [ do-help-lint ] benchmark help-lint-time-file to-file
119 [ do-benchmarks ] benchmark benchmark-time-file to-file