factor/extra/builder/builder.factor

150 lines
3.6 KiB
Factor
Raw Normal View History

2008-01-31 01:25:06 -05:00
2008-02-07 19:30:20 -05:00
USING: kernel io io.files io.launcher hashtables
2008-02-04 22:26:59 -05:00
system continuations namespaces sequences splitting math.parser
2008-02-04 22:58:57 -05:00
prettyprint tools.time calendar bake vars http.client
2008-02-07 19:30:20 -05:00
combinators bootstrap.image ;
2008-01-31 01:25:06 -05:00
IN: builder
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-06 05:26:13 -05:00
: runtime ( quot -- time ) benchmark nip ;
: log-runtime ( quot file -- )
>r runtime r> <file-writer> [ . ] with-stream ;
: log-object ( object file -- ) <file-writer> [ . ] with-stream ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-01-31 01:25:06 -05:00
: datestamp ( -- string )
now `{ ,[ dup timestamp-year ]
,[ dup timestamp-month ]
,[ dup timestamp-day ]
,[ dup timestamp-hour ]
,[ timestamp-minute ] }
2008-02-05 00:48:18 -05:00
[ pad-00 ] map "-" join ;
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SYMBOL: builder-recipients
: email-file ( subject file -- )
`{
2008-02-04 22:26:59 -05:00
{ +stdin+ , }
{ +arguments+ { "mutt" "-s" , %[ builder-recipients get ] } }
}
>hashtable run-process drop ;
: email-string ( subject -- )
`{ "mutt" "-s" , %[ builder-recipients get ] }
2008-02-05 00:48:18 -05:00
[ ] with-process-stream drop ;
2008-02-04 22:26:59 -05:00
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-06 00:09:33 -05:00
: target ( -- target ) `{ ,[ os ] %[ cpu "." split ] } "-" join ;
2008-02-05 19:28:05 -05:00
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-02-04 22:58:57 -05:00
: factor-binary ( -- name )
os
{ { "macosx" [ "./Factor.app/Contents/MacOS/factor" ] }
2008-02-06 00:09:33 -05:00
{ "winnt" [ "./factor-nt.exe" ] }
2008-02-04 22:58:57 -05:00
[ drop "./factor" ] }
case ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-01-31 01:25:06 -05:00
VAR: stamp
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: build ( -- )
2008-02-04 22:26:59 -05:00
datestamp >stamp
"/builds/factor" cd
2008-02-06 00:09:33 -05:00
{
"git"
"pull"
"--no-summary"
2008-02-07 16:14:40 -05:00
"git://factorcode.org/git/factor.git"
! "http://dharmatech.onigirihouse.com/factor.git"
2008-02-06 00:09:33 -05:00
"master"
}
2008-02-04 22:26:59 -05:00
run-process process-status
0 =
[ ]
[
"builder: git pull" email-string
"builder: git pull" throw
]
if
2008-02-07 19:30:20 -05:00
{
"git" "pull" "--no-summary"
"http://dharmatech.onigirihouse.com/factor.git" "master"
} run-process process-status
2008-02-04 22:26:59 -05:00
"/builds/" stamp> append make-directory
"/builds/" stamp> append cd
2008-02-06 00:09:33 -05:00
{ "git" "clone" "../factor" } run-process drop
2008-02-04 22:26:59 -05:00
"factor" cd
2008-02-06 05:26:13 -05:00
{ "git" "show" } <process-stream> [ readln ] with-stream " " split second
"../git-id" log-object
2008-02-04 22:26:59 -05:00
{ "make" "clean" } run-process drop
`{
{ +arguments+ { "make" ,[ target ] } }
{ +stdout+ "../compile-log" }
{ +stderr+ +stdout+ }
}
>hashtable run-process process-status
0 =
[ ]
[
"builder: vm compile" "../compile-log" email-file
"builder: vm compile" throw
] if
[ "http://factorcode.org/images/latest/" boot-image-name append download ]
[ "builder: image download" email-string ]
recover
`{
{ +arguments+ {
2008-02-04 22:58:57 -05:00
,[ factor-binary ]
2008-02-04 22:26:59 -05:00
,[ "-i=" boot-image-name append ]
"-no-user-init"
} }
{ +stdout+ "../boot-log" }
{ +stderr+ +stdout+ }
}
2008-02-06 05:26:13 -05:00
>hashtable [ run-process ] "../boot-time" log-runtime process-status
2008-02-04 22:26:59 -05:00
0 =
[ ]
[
"builder: bootstrap" "../boot-log" email-file
"builder: bootstrap" throw
] if
2008-02-06 05:26:13 -05:00
`{ ,[ factor-binary ] "-run=builder.test" } run-process drop
2008-02-06 00:09:33 -05:00
"../load-everything-log" exists?
[ "builder: load-everything" "../load-everything-log" email-file ]
when
2008-02-06 05:26:13 -05:00
"../failing-tests" exists?
[ "builder: failing tests" "../failing-tests" email-file ]
when
2008-02-06 00:09:33 -05:00
;
2008-01-31 01:25:06 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MAIN: build