1 ! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs benchmark bootstrap.stage2 command-line
4 compiler.errors continuations debugger fry generic help.html
5 help.lint io io.directories io.encodings.utf8 io.files io.styles
6 kernel locals mason.common namespaces parser.notes sequences
7 sets sorting source-files.errors system tools.errors tools.test
8 tools.time vocabs vocabs.hierarchy.private vocabs.loader
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 )
24 V{ } clone blacklist [
28 [ swap vocab-name _ set-at ] recover
33 : load-from-root-no-restarts ( root prefix -- failures )
34 vocabs-to-load require-all-no-restarts ;
36 : load-no-restarts ( prefix -- failures )
37 [ vocab-roots get ] dip
38 '[ _ load-from-root-no-restarts ] map concat ;
42 [ keys load-all-vocabs-file to-file ]
43 [ load-all-errors-file utf8 [ load-failures. ] with-file-writer ]
46 GENERIC: word-vocabulary ( word -- vocabulary )
48 M: word word-vocabulary vocabulary>> ;
50 M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
52 :: do-step ( errors summary-file details-file -- )
54 [ error-type +linkage-error+ eq? ] reject
55 [ file>> ] map members natural-sort summary-file to-file
56 errors details-file utf8 [ errors. ] with-file-writer ;
60 test-all test-failures get
66 help-lint-all lint-failures get values
71 : do-benchmarks ( -- )
73 [ benchmarks-file to-file ] [
74 [ keys benchmark-error-vocabs-file to-file ]
75 [ benchmark-error-messages-file utf8 [ benchmark-errors. ] with-file-writer ] bi
78 : do-compile-errors ( -- )
79 compiler-errors get values
81 compiler-error-messages-file
84 : outdated-core-vocabs ( -- modified-sources modified-docs any? )
85 "" to-refresh drop 2dup [ empty? not ] either? ;
87 : outdated-boot-image. ( modified-sources modified-docs -- )
88 "Boot image is out of date. Changed vocabs:" print
92 : check-boot-image ( -- ? )
93 outdated-core-vocabs [ outdated-boot-image. t ] [ 2drop f ] if ;
97 ".factor-mason-rc" rc-path try-user-init
100 : check-user-init-errors ( -- ? )
101 user-init-errors get-global assoc-empty?
102 [ f ] [ :user-init-errors t ] if ;
105 f parser-quiet? set-global
107 run-mason-rc check-user-init-errors [ 1 exit ] when
108 bootstrap-time get boot-time-file to-file
109 check-boot-image [ 1 exit ] when
110 [ do-load ] benchmark load-time-file to-file
111 [ generate-help ] benchmark html-help-time-file to-file
112 [ do-tests ] benchmark test-time-file to-file
113 [ do-help-lint ] benchmark help-lint-time-file to-file
114 [ do-benchmarks ] benchmark benchmark-time-file to-file