1 ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays calendar combinators
4 combinators.short-circuit continuations fry io.directories
5 io.launcher io.pathnames kernel macros make mason.config
6 mason.notify mason.platform mason.report namespaces quotations
7 sequences splitting system ;
10 ! Make sure we call the build directory's factor.cmd
11 : nmake-cmd ( -- args )
12 "./build-support/factor.cmd" absolute-path
14 target-cpu get name>> "." split "-" join 3array ;
16 : gnu-make-cmd ( -- args )
18 target-os get name>> target-cpu get name>> (platform)
21 : mason-child-make-cmd ( -- args )
23 { [ target-os get windows = ] [ nmake-cmd ] }
27 : make-mason-child-vm ( -- )
30 mason-child-make-cmd >>command
31 "../compile-log" >>stdout
37 ! On windows, process launches relative to current process, ignoring
38 ! current-directory variables. Must pass absolute-path of factor.com
39 : mason-child-vm ( -- string )
40 target-os get windows = [
41 "./factor.com" absolute-path
46 : mason-child-boot-cmd ( -- cmd )
49 "-i=" target-boot-image-name append ,
54 : bootstrap-mason-child ( -- )
57 mason-child-boot-cmd >>command
59 "../boot-log" >>stdout
66 : mason-child-test-cmd ( -- cmd ) mason-child-vm "-run=mason.test" 2array ;
68 : test-mason-child ( -- )
71 mason-child-test-cmd >>command
73 "../test-log" >>stdout
80 : recover-else ( try catch else -- )
81 [ [ '[ @ f t ] ] [ '[ @ f ] ] bi* recover ] dip '[ drop @ ] when ; inline
83 MACRO: recover-cond ( alist -- quot )
84 dup { [ length 1 = ] [ first callable? ] } 1&&
86 [ first first2 ] [ rest ] bi
87 '[ _ _ [ _ recover-cond ] recover-else ]
90 : build-child ( -- status )
92 { [ notify-make-vm make-mason-child-vm ] [ compile-failed ] }
93 { [ notify-boot bootstrap-mason-child ] [ boot-failed ] }
94 { [ notify-test test-mason-child ] [ test-failed ] }