tools.deploy.*: refactoring to not use dynamic variables in make-deploy-image

locals-and-roots
Björn Lindqvist 2016-04-02 04:56:04 +02:00
parent 3ef33708ae
commit 047be9cd52
5 changed files with 36 additions and 37 deletions

View File

@ -1,4 +1,4 @@
USING: kernel pcre sequences tools.deploy.backend tools.test ; USING: pcre sequences tools.deploy.backend tools.test ;
IN: tools.deploy.backend.tests IN: tools.deploy.backend.tests
: complete-match? ( str regexp -- ? ) : complete-match? ( str regexp -- ? )

View File

@ -1,15 +1,10 @@
! Copyright (C) 2007, 2010 Slava Pestov. ! Copyright (C) 2007, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces make continuations.private kernel.private init USING: accessors assocs bootstrap.image hashtables io io.directories
assocs kernel vocabs words sequences memory io system arrays io.encodings.utf8 io.files io.files.temp io.launcher io.pathnames
continuations math definitions mirrors splitting parser classes kernel locals make namespaces prettyprint sequences splitting system
summary layouts vocabs.loader prettyprint.config prettyprint debugger tools.deploy.config tools.deploy.config.editor tools.deploy.embed
io.streams.c io.files io.files.temp io.pathnames io.directories tools.deploy.libraries vocabs.loader vocabs.metadata.resources ;
io.directories.hierarchy io.backend quotations io.launcher
tools.deploy.config tools.deploy.config.editor bootstrap.image
io.encodings.utf8 destructors accessors hashtables
tools.deploy.libraries vocabs.metadata.resources
tools.deploy.embed locals ;
IN: tools.deploy.backend IN: tools.deploy.backend
: copy-vm ( executable bundle-name -- vm-path ) : copy-vm ( executable bundle-name -- vm-path )
@ -49,18 +44,6 @@ ERROR: can't-deploy-library-file library ;
my-boot-image-name resource-path exists? my-boot-image-name resource-path exists?
[ make-my-image ] unless ; [ make-my-image ] unless ;
: bootstrap-profile ( -- profile )
[
deploy-math? get [ "math" , ] when
deploy-threads? get [ "threads" , ] when
"compiler" ,
deploy-help? get [ "help" , ] when
native-io? [ "io" , ] when
deploy-ui? get [ "ui" , ] when
deploy-unicode? get [ "unicode" , ] when
] { } make ;
: staging-image-name ( profile -- name ) : staging-image-name ( profile -- name )
"-" join "." my-arch-name 3append "-" join "." my-arch-name 3append
"staging." ".image" surround cache-file ; "staging." ".image" surround cache-file ;
@ -126,14 +109,14 @@ DEFER: ?make-staging-image
:: make-deploy-image ( vm image vocab config -- manifest ) :: make-deploy-image ( vm image vocab config -- manifest )
make-boot-image make-boot-image
config [
bootstrap-profile :> profile config config>profile :> profile
vocab "vocab-manifest-" prepend temp-file :> manifest-file vocab "vocab-manifest-" prepend temp-file :> manifest-file
image vocab manifest-file profile deploy-command-line :> flags image vocab manifest-file profile deploy-command-line :> flags
profile ?make-staging-image
vm flags run-factor profile ?make-staging-image
manifest-file parse-vocab-manifest-file vm flags run-factor
] with-variables ; manifest-file parse-vocab-manifest-file ;
:: make-deploy-image-executable ( vm image vocab config -- manifest ) :: make-deploy-image-executable ( vm image vocab config -- manifest )
vm image vocab config make-deploy-image vm image vocab config make-deploy-image

View File

@ -0,0 +1,6 @@
USING: tools.deploy.config tools.test ;
IN: tools.deploy.config.tests
{ { "math" "threads" "compiler" "io" } } [
"hello-ui" default-config config>profile
] unit-test

View File

@ -1,6 +1,7 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: assocs hashtables kernel math namespaces vocabs ; USING: assocs combinators.smart hashtables kernel math namespaces
sequences vocabs ;
IN: tools.deploy.config IN: tools.deploy.config
SYMBOL: deploy-name SYMBOL: deploy-name
@ -69,3 +70,14 @@ SYMBOL: deploy-image
SYMBOL: deploy-directory SYMBOL: deploy-directory
"resource:" deploy-directory set-global "resource:" deploy-directory set-global
: config>profile ( config -- profile )
{
[ deploy-math? of "math" f ? ]
[ deploy-threads? of "threads" f ? ]
[ drop "compiler" ]
[ deploy-help? of "help" f ? ]
[ deploy-io of 3 = "io" f ? ]
[ deploy-ui? of "ui" f ? ]
[ deploy-unicode? of "unicode" f ? ]
} cleave>array sift ;

View File

@ -37,10 +37,8 @@ delete-staging-images
{ } [ "hello-ui" shake-and-bake 2242000 small-enough? ] unit-test { } [ "hello-ui" shake-and-bake 2242000 small-enough? ] unit-test
{ "math-threads-compiler-io-ui" } [ { "math-threads-compiler-io-ui" } [
"hello-ui" deploy-config [ "hello-ui" deploy-config config>profile
bootstrap-profile staging-image-name file-name staging-image-name file-name "." split second
"." split second
] with-variables
] unit-test ] unit-test
! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] unit-test ! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] unit-test
@ -157,7 +155,7 @@ os macosx? [
{ t } [ { t } [
"tools.deploy.test.18" shake-and-bake "tools.deploy.test.18" shake-and-bake
deploy-test-command ascii [ readln ] with-process-reader deploy-test-command ascii [ readln ] with-process-reader
test-image temp-file = test-image-path =
] unit-test ] unit-test
{ } [ "resource:LICENSE.txt" "license.txt" temp-file copy-file ] unit-test { } [ "resource:LICENSE.txt" "license.txt" temp-file copy-file ] unit-test