bootstrap.*: fix for #1512, load docs after everything else

By making it so the help component is loaded almost last, all vocabs are loaded without docs and only then are they loaded. It should make it so you don't get cyclic dependency problems in doc files during bootstrapping.
db4
Björn Lindqvist 2015-12-04 13:29:29 +01:00
parent fc9eb0d5ac
commit bf8fe25271
5 changed files with 55 additions and 58 deletions

View File

@ -1,22 +1,20 @@
USING: accessors assocs kernel namespaces sequences vocabs USING: accessors assocs namespaces sequences vocabs vocabs.loader
vocabs.loader vocabs.loader.private ; vocabs.loader.private ;
IN: bootstrap.help IN: bootstrap.help
: load-help ( -- ) : load-help ( -- )
"help" require {
"help.topics" require "help"
"help.syntax" require "help.topics"
"help.crossref" require "help.syntax"
"help.definitions" require "help.crossref"
"help.lint" require "help.definitions"
"help.vocabs" require "help.lint"
"help.vocabs"
} [ require ] each
t load-help? set-global t load-help? set-global
[ dup lookup-vocab [ drop ] [ no-vocab ] if ] require-hook [ dictionary get values [ docs-loaded?>> ] reject [ load-docs ] each ;
dictionary get values
[ docs-loaded?>> ] reject
[ load-docs ] each
] with-variable ;
load-help load-help

View File

@ -56,7 +56,7 @@ SYMBOL: bootstrap-time
error set-global ; inline error set-global ; inline
CONSTANT: default-components CONSTANT: default-components
"math compiler threads help io tools ui ui.tools unicode handbook" "math compiler threads io tools ui ui.tools unicode help handbook"
[ [
! We time bootstrap ! We time bootstrap

View File

@ -1,10 +1,8 @@
USING: kernel vocabs sequences system vocabs.loader ; USING: vocabs vocabs.loader ;
IN: bootstrap.ui.tools
{ "ui" "help" "tools" } "ui.tools" require
[ "bootstrap." prepend lookup-vocab ] all? [
"ui.tools" require
{ "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when { "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
"ui.tools.walker" require "ui.tools.walker" require
] when

View File

@ -3,35 +3,6 @@ hashtables quotations words classes sequences namespaces make
arrays assocs ; arrays assocs ;
IN: ui.commands IN: ui.commands
: command-map-row ( gesture command -- seq )
[
[ gesture>string , ]
[
[ command-name , ]
[ command-word <$link> , ]
[ command-description , ]
tri
] bi*
] { } make ;
: command-map. ( alist -- )
[ command-map-row ] { } assoc>map
{ "Shortcut" "Command" "Word" "Notes" }
[ \ $strong swap ] { } map>assoc prefix
$table ;
: $command-map ( element -- )
[ second (command-name) " commands" append $heading ]
[
first2 swap get-command-at
[ blurb>> print-element ] [ commands>> command-map. ] bi
] bi ;
: $command ( element -- )
reverse first3 get-command-at
commands>> value-at gesture>string
$snippet ;
HELP: +nullary+ HELP: +nullary+
{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, the command does not take any inputs, and the value passed to " { $link invoke-command } " will be ignored. Otherwise, it takes one input." } ; { $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, the command does not take any inputs, and the value passed to " { $link invoke-command } " will be ignored. Otherwise, it takes one input." } ;

View File

@ -1,7 +1,8 @@
! Copyright (C) 2006, 2008 Slava Pestov. ! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs fry kernel make quotations sequences USING: accessors assocs fry help.markup kernel make quotations
splitting tr ui.gestures unicode.case unicode.categories words ; sequences splitting tr ui.gestures unicode.case unicode.categories
words ;
IN: ui.commands IN: ui.commands
SYMBOL: +nullary+ SYMBOL: +nullary+
@ -28,9 +29,43 @@ GENERIC: command-word ( command -- word )
H{ } clone [ "commands" set-word-prop ] keep H{ } clone [ "commands" set-word-prop ] keep
] ?if ; ] ?if ;
TR: convert-command-name "-" " " ;
: (command-name) ( string -- newstring )
convert-command-name >title ;
: get-command-at ( group class -- command-map ) : get-command-at ( group class -- command-map )
commands at ; commands at ;
: command-map-row ( gesture command -- seq )
[
[ gesture>string , ]
[
[ command-name , ]
[ command-word <$link> , ]
[ command-description , ]
tri
] bi*
] { } make ;
: command-map. ( alist -- )
[ command-map-row ] { } assoc>map
{ "Shortcut" "Command" "Word" "Notes" }
[ \ $strong swap ] { } map>assoc prefix
$table ;
: $command-map ( element -- )
[ second (command-name) " commands" append $heading ]
[
first2 swap get-command-at
[ blurb>> print-element ] [ commands>> command-map. ] bi
] bi ;
: $command ( element -- )
reverse first3 get-command-at
commands>> value-at gesture>string
$snippet ;
: command-gestures ( class -- hash ) : command-gestures ( class -- hash )
commands values [ commands values [
[ [
@ -48,11 +83,6 @@ GENERIC: command-word ( command -- word )
swap pick commands set-at swap pick commands set-at
update-gestures ; update-gestures ;
TR: convert-command-name "-" " " ;
: (command-name) ( string -- newstring )
convert-command-name >title ;
M: word command-name ( word -- str ) M: word command-name ( word -- str )
name>> name>>
"com-" ?head drop "." ?tail drop "com-" ?head drop "." ?tail drop