Deployment fixes; add unit test which ensures deploy images are not too large
parent
e47a9cface
commit
609e6eaa5a
|
@ -66,6 +66,11 @@ HELP: deploy-math?
|
||||||
$nl
|
$nl
|
||||||
"On by default. Often the programmer will use rationals without realizing it. A small amount of space can be saved by stripping these features out, but some code may require changes to work properly." } ;
|
"On by default. Often the programmer will use rationals without realizing it. A small amount of space can be saved by stripping these features out, but some code may require changes to work properly." } ;
|
||||||
|
|
||||||
|
HELP: deploy-threads?
|
||||||
|
{ $description "Deploy flag. If set, the deployed image will contain support for threads."
|
||||||
|
$nl
|
||||||
|
"On by default. Often the programmer will use threads without realizing it. A small amount of space can be saved by stripping this feature out, but some code may require changes to work properly." } ;
|
||||||
|
|
||||||
HELP: deploy-compiler?
|
HELP: deploy-compiler?
|
||||||
{ $description "Deploy flag. If set, words in the deployed image will be compiled with the optimizing compiler when possible."
|
{ $description "Deploy flag. If set, words in the deployed image will be compiled with the optimizing compiler when possible."
|
||||||
$nl
|
$nl
|
||||||
|
|
|
@ -10,6 +10,7 @@ SYMBOL: deploy-name
|
||||||
SYMBOL: deploy-ui?
|
SYMBOL: deploy-ui?
|
||||||
SYMBOL: deploy-compiler?
|
SYMBOL: deploy-compiler?
|
||||||
SYMBOL: deploy-math?
|
SYMBOL: deploy-math?
|
||||||
|
SYMBOL: deploy-threads?
|
||||||
|
|
||||||
SYMBOL: deploy-io
|
SYMBOL: deploy-io
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ SYMBOL: deploy-image
|
||||||
{ deploy-io 2 }
|
{ deploy-io 2 }
|
||||||
{ deploy-reflection 1 }
|
{ deploy-reflection 1 }
|
||||||
{ deploy-compiler? t }
|
{ deploy-compiler? t }
|
||||||
|
{ deploy-threads? t }
|
||||||
{ deploy-math? t }
|
{ deploy-math? t }
|
||||||
{ deploy-word-props? f }
|
{ deploy-word-props? f }
|
||||||
{ deploy-word-defs? f }
|
{ deploy-word-defs? f }
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
IN: temporary
|
||||||
|
USING: tools.test system io.files kernel tools.deploy.config
|
||||||
|
tools.deploy.backend math ;
|
||||||
|
|
||||||
|
: shake-and-bake
|
||||||
|
"." resource-path [
|
||||||
|
vm
|
||||||
|
"hello.image" temp-file
|
||||||
|
rot dup deploy-config make-deploy-image
|
||||||
|
] with-directory ;
|
||||||
|
|
||||||
|
[ ] [ "hello-world" shake-and-bake ] unit-test
|
||||||
|
|
||||||
|
[ t ] [
|
||||||
|
"hello.image" temp-file file-length 500000 <=
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ ] [ "hello-ui" shake-and-bake ] unit-test
|
||||||
|
|
||||||
|
[ t ] [
|
||||||
|
"hello.image" temp-file file-length 2000000 <=
|
||||||
|
] unit-test
|
|
@ -11,8 +11,16 @@ IN: tools.deploy.shaker
|
||||||
: strip-init-hooks ( -- )
|
: strip-init-hooks ( -- )
|
||||||
"Stripping startup hooks" show
|
"Stripping startup hooks" show
|
||||||
"command-line" init-hooks get delete-at
|
"command-line" init-hooks get delete-at
|
||||||
"mallocs" init-hooks get delete-at
|
"libc" init-hooks get delete-at
|
||||||
strip-io? [ "io.backend" init-hooks get delete-at ] when ;
|
deploy-threads? get [
|
||||||
|
"threads" init-hooks get delete-at
|
||||||
|
] unless
|
||||||
|
native-io? [
|
||||||
|
"io.thread" init-hooks get delete-at
|
||||||
|
] unless
|
||||||
|
strip-io? [
|
||||||
|
"io.backend" init-hooks get delete-at
|
||||||
|
] when ;
|
||||||
|
|
||||||
: strip-debugger ( -- )
|
: strip-debugger ( -- )
|
||||||
strip-debugger? [
|
strip-debugger? [
|
||||||
|
@ -85,6 +93,7 @@ IN: tools.deploy.shaker
|
||||||
{ } set-retainstack
|
{ } set-retainstack
|
||||||
V{ } set-namestack
|
V{ } set-namestack
|
||||||
V{ } set-catchstack
|
V{ } set-catchstack
|
||||||
|
|
||||||
"Saving final image" show
|
"Saving final image" show
|
||||||
[ save-image-and-exit ] call-clear ;
|
[ save-image-and-exit ] call-clear ;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
USING: kernel ;
|
USING: kernel threads threads.private ;
|
||||||
IN: debugger
|
IN: debugger
|
||||||
|
|
||||||
: print-error die ;
|
: print-error die ;
|
||||||
|
|
||||||
: error. die ;
|
: error. die ;
|
||||||
|
|
||||||
|
M: thread error-in-thread ( error thread -- ) die 2drop ;
|
||||||
|
|
|
@ -10,10 +10,10 @@ IN: tools.deploy.windows
|
||||||
vm over copy-file ;
|
vm over copy-file ;
|
||||||
|
|
||||||
: copy-fonts ( bundle-name -- )
|
: copy-fonts ( bundle-name -- )
|
||||||
"fonts/" resource-path swap copy-tree ;
|
"fonts/" resource-path swap copy-tree-to ;
|
||||||
|
|
||||||
: copy-dlls ( bundle-name -- )
|
: copy-dlls ( bundle-name -- )
|
||||||
{ "freetype6.dll" "zlib1.dll" "factor-nt.dll" }
|
{ "freetype6.dll" "zlib1.dll" "factor.dll" }
|
||||||
[ resource-path ] map
|
[ resource-path ] map
|
||||||
swap copy-files-to ;
|
swap copy-files-to ;
|
||||||
|
|
||||||
|
@ -30,10 +30,11 @@ TUPLE: windows-deploy-implementation ;
|
||||||
T{ windows-deploy-implementation } deploy-implementation set-global
|
T{ windows-deploy-implementation } deploy-implementation set-global
|
||||||
|
|
||||||
M: windows-deploy-implementation deploy*
|
M: windows-deploy-implementation deploy*
|
||||||
"." resource-path cd
|
"." resource-path [
|
||||||
dup deploy-config [
|
dup deploy-config [
|
||||||
[ deploy-name get create-exe-dir ] keep
|
[ deploy-name get create-exe-dir ] keep
|
||||||
[ deploy-name get image-name ] keep
|
[ deploy-name get image-name ] keep
|
||||||
[ namespace make-deploy-image ] keep
|
[ namespace make-deploy-image ] keep
|
||||||
open-in-explorer
|
open-in-explorer
|
||||||
] bind ;
|
] bind
|
||||||
|
] with-directory ;
|
||||||
|
|
Loading…
Reference in New Issue