<commit_before>! Copyright (C) 2008, 2011 <NAME>, <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays calendar combinators continuations io.directories
io.pathnames kernel mason.child mason.cleanup mason.common
mason.config mason.docs mason.git mason.notify mason.platform
mason.release mason.updates namespaces sequences ;
IN: mason.build

: create-build-dir ( -- )
    now datestamp stamp set
    build-dir make-directory ;

: enter-build-dir  ( -- )
    "Building in directory " build-dir append print-timestamp
    build-dir set-current-directory ;

: clone-source ( -- )
    "Cloning GIT repository" print-timestamp
    "git" "clone" builds-dir get "factor" append-path 3array
    short-running-process ;

: copy-image ( -- )
    builds-dir get target-boot-image-name append-path
    [ "." copy-file-into ] [ "factor" copy-file-into ] bi ;

: save-git-id ( -- )
    "factor" [ git-id ] with-directory {
        [ "git-id" to-file ]
        [ "factor/git-id" to-file ]
        [ current-git-id set ]
        [ notify-begin-build ]
    } cleave ;

: begin-build ( -- )
    clone-source
    copy-image
    save-git-id ;

: do-build ( -- )
    create-build-dir
    enter-build-dir
    [
        begin-build
        build-child
        [ notify-report ] [
            status-clean eq?
            [ notify-upload upload-docs release ] when
        ] bi
        notify-finish
        finish-build
    ] [ cleanup-build ] [ ] cleanup
    notify-idle ;

MAIN: do-build
<commit_msg>mason.build: Can't resolve path ~/builds/factor, not sure how this ever works...<commit_after>! Copyright (C) 2008, 2011 <NAME>, <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays calendar combinators continuations io.directories
io.pathnames kernel mason.child mason.cleanup mason.common
mason.config mason.docs mason.git mason.notify mason.platform
mason.release mason.updates namespaces sequences ;
IN: mason.build

: create-build-dir ( -- )
    now datestamp stamp set
    build-dir make-directory ;

: enter-build-dir  ( -- )
    "Building in directory " build-dir append print-timestamp
    build-dir set-current-directory ;

: clone-source ( -- )
    "Cloning GIT repository" print-timestamp
    "git" "clone" builds-dir get "factor" append-path absolute-path 3array
    short-running-process ;

: copy-image ( -- )
    builds-dir get target-boot-image-name append-path
    [ "." copy-file-into ] [ "factor" copy-file-into ] bi ;

: save-git-id ( -- )
    "factor" [ git-id ] with-directory {
        [ "git-id" to-file ]
        [ "factor/git-id" to-file ]
        [ current-git-id set ]
        [ notify-begin-build ]
    } cleave ;

: begin-build ( -- )
    clone-source
    copy-image
    save-git-id ;

: do-build ( -- )
    create-build-dir
    enter-build-dir
    [
        begin-build
        build-child
        [ notify-report ] [
            status-clean eq?
            [ notify-upload upload-docs release ] when
        ] bi
        notify-finish
        finish-build
    ] [ cleanup-build ] [ ] cleanup
    notify-idle ;

MAIN: do-build

{'fraction_non_alphanumeric': 0.12714331931413783, 'fraction_numerical': 0.005823358136525397, 'mean_word_length': 2.2928647497337593, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7366351', 'n_tokens_mistral': 1007, 'n_tokens_neox': 987, 'n_words': 227}