]> gitweb.factorcode.org Git - factor.git/blob - extra/mason/build/build.factor
567075498bf0834d1721a82bd66aa00e85903222
[factor.git] / extra / mason / build / build.factor
1 ! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays calendar combinators continuations io.directories
4 io.pathnames kernel mason.child mason.cleanup mason.common
5 mason.config mason.docs mason.git mason.notify mason.platform
6 mason.release mason.updates namespaces sequences ;
7 IN: mason.build
8
9 : create-build-dir ( -- )
10     now datestamp stamp set
11     build-dir make-directory ;
12
13 : enter-build-dir  ( -- )
14     "Building in directory " build-dir append print-timestamp
15     build-dir set-current-directory ;
16
17 : clone-source ( -- )
18     "Cloning GIT repository" print-timestamp
19     "git" "clone" builds-dir get "factor" append-path 3array
20     short-running-process ;
21
22 : copy-image ( -- )
23     builds-dir get target-boot-image-name append-path
24     [ "." copy-file-into ] [ "factor" copy-file-into ] bi ;
25
26 : save-git-id ( -- )
27     "factor" [ git-id ] with-directory {
28         [ "git-id" to-file ]
29         [ "factor/git-id" to-file ]
30         [ current-git-id set ]
31         [ notify-begin-build ]
32     } cleave ;
33
34 : begin-build ( -- )
35     clone-source
36     copy-image
37     save-git-id ;
38
39 : do-build ( -- )
40     create-build-dir
41     enter-build-dir
42     [
43         begin-build
44         build-child
45         [ notify-report ] [
46             status-clean eq?
47             [ notify-upload upload-docs release ] when
48         ] bi
49         notify-finish
50         finish-build
51     ] [ cleanup-build ] [ ] cleanup
52     notify-idle ;
53
54 MAIN: do-build