tools.deploy.*: refactoring to not use dynamic variables in make-deploy-image
							parent
							
								
									3ef33708ae
								
							
						
					
					
						commit
						047be9cd52
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
: complete-match? ( str regexp -- ? )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,10 @@
 | 
			
		|||
! Copyright (C) 2007, 2010 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: namespaces make continuations.private kernel.private init
 | 
			
		||||
assocs kernel vocabs words sequences memory io system arrays
 | 
			
		||||
continuations math definitions mirrors splitting parser classes
 | 
			
		||||
summary layouts vocabs.loader prettyprint.config prettyprint debugger
 | 
			
		||||
io.streams.c io.files io.files.temp io.pathnames io.directories
 | 
			
		||||
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 ;
 | 
			
		||||
USING: accessors assocs bootstrap.image hashtables io io.directories
 | 
			
		||||
io.encodings.utf8 io.files io.files.temp io.launcher io.pathnames
 | 
			
		||||
kernel locals make namespaces prettyprint sequences splitting system
 | 
			
		||||
tools.deploy.config tools.deploy.config.editor tools.deploy.embed
 | 
			
		||||
tools.deploy.libraries vocabs.loader vocabs.metadata.resources ;
 | 
			
		||||
IN: tools.deploy.backend
 | 
			
		||||
 | 
			
		||||
: 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?
 | 
			
		||||
    [ 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 )
 | 
			
		||||
    "-" join "." my-arch-name 3append
 | 
			
		||||
    "staging." ".image" surround cache-file ;
 | 
			
		||||
| 
						 | 
				
			
			@ -126,14 +109,14 @@ DEFER: ?make-staging-image
 | 
			
		|||
 | 
			
		||||
:: make-deploy-image ( vm image vocab config -- manifest )
 | 
			
		||||
    make-boot-image
 | 
			
		||||
    config [
 | 
			
		||||
        bootstrap-profile :> profile
 | 
			
		||||
 | 
			
		||||
    config config>profile :> profile
 | 
			
		||||
    vocab "vocab-manifest-" prepend temp-file :> manifest-file
 | 
			
		||||
    image vocab manifest-file profile deploy-command-line :> flags
 | 
			
		||||
 | 
			
		||||
    profile ?make-staging-image
 | 
			
		||||
    vm flags run-factor
 | 
			
		||||
        manifest-file parse-vocab-manifest-file
 | 
			
		||||
    ] with-variables ;
 | 
			
		||||
    manifest-file parse-vocab-manifest-file ;
 | 
			
		||||
 | 
			
		||||
:: make-deploy-image-executable ( vm image vocab config -- manifest )
 | 
			
		||||
    vm image vocab config make-deploy-image
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
! Copyright (C) 2007, 2008 Slava Pestov.
 | 
			
		||||
! 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
 | 
			
		||||
 | 
			
		||||
SYMBOL: deploy-name
 | 
			
		||||
| 
						 | 
				
			
			@ -69,3 +70,14 @@ SYMBOL: deploy-image
 | 
			
		|||
 | 
			
		||||
SYMBOL: deploy-directory
 | 
			
		||||
"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 ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,10 +37,8 @@ delete-staging-images
 | 
			
		|||
{ } [ "hello-ui" shake-and-bake 2242000 small-enough? ] unit-test
 | 
			
		||||
 | 
			
		||||
{ "math-threads-compiler-io-ui" } [
 | 
			
		||||
    "hello-ui" deploy-config [
 | 
			
		||||
        bootstrap-profile staging-image-name file-name
 | 
			
		||||
        "." split second
 | 
			
		||||
    ] with-variables
 | 
			
		||||
    "hello-ui" deploy-config config>profile
 | 
			
		||||
    staging-image-name file-name "." split second
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
! [ ] [ "maze" shake-and-bake 1520000 small-enough? ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +155,7 @@ os macosx? [
 | 
			
		|||
{ t } [
 | 
			
		||||
    "tools.deploy.test.18" shake-and-bake
 | 
			
		||||
    deploy-test-command ascii [ readln ] with-process-reader
 | 
			
		||||
    test-image temp-file =
 | 
			
		||||
    test-image-path =
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
{ } [ "resource:LICENSE.txt" "license.txt" temp-file copy-file ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue