USING: tools.deploy.config ;
H{
- { deploy-math? t }
- { deploy-reflection 1 }
+ { deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "Bunny" }
{ deploy-threads? t }
- { deploy-word-props? f }
- { "stop-after-last-window?" t }
- { deploy-ui? t }
- { deploy-io 3 }
{ deploy-compiler? t }
- { deploy-word-defs? f }
+ { deploy-math? t }
{ deploy-c-types? f }
+ { deploy-io 3 }
+ { deploy-reflection 1 }
+ { deploy-ui? t }
+ { "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
USING: tools.deploy.config ;
H{
- { deploy-io 1 }
- { deploy-compiler? t }
{ deploy-word-defs? f }
- { deploy-word-props? f }
- { deploy-math? t }
+ { deploy-random? t }
{ deploy-name "Hello world" }
- { deploy-c-types? f }
- { deploy-ui? t }
{ deploy-threads? t }
+ { deploy-compiler? t }
+ { deploy-math? t }
+ { deploy-c-types? f }
+ { deploy-io 1 }
{ deploy-reflection 1 }
+ { deploy-ui? t }
{ "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
USING: tools.deploy.config ;
H{
+ { deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "Hello world (console)" }
{ deploy-threads? f }
- { deploy-c-types? f }
{ deploy-compiler? f }
- { deploy-ui? f }
{ deploy-math? f }
- { deploy-reflection 1 }
- { deploy-word-defs? f }
+ { deploy-c-types? f }
{ deploy-io 2 }
- { deploy-word-props? f }
+ { deploy-reflection 1 }
+ { deploy-ui? f }
{ "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
USING: tools.deploy.config ;
H{
+ { deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "Sudoku" }
{ deploy-threads? f }
- { deploy-c-types? f }
{ deploy-compiler? t }
- { deploy-ui? f }
{ deploy-math? f }
- { deploy-reflection 1 }
- { deploy-word-defs? f }
+ { deploy-c-types? f }
{ deploy-io 2 }
- { deploy-word-props? f }
+ { deploy-reflection 1 }
+ { deploy-ui? f }
{ "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
"compiler" deploy-compiler? get ?,
"ui" deploy-ui? get ?,
"io" native-io? ?,
+ "random" deploy-random? get ?,
] { } make ;
-: staging-image-name ( -- name )
+: staging-image-name ( profile -- name )
"staging."
- bootstrap-profile strip-word-names? [ "strip" add ] when
- "-" join ".image" 3append ;
+ swap strip-word-names? [ "strip" add ] when
+ "-" join ".image" 3append temp-file ;
-: staging-command-line ( config -- flags )
+DEFER: ?make-staging-image
+
+: staging-command-line ( profile -- flags )
[
- [
+ dup empty? [
"-i=" my-boot-image-name append ,
+ ] [
+ dup 1 head* ?make-staging-image
- "-output-image=" staging-image-name append ,
+ "-resource-path=" "" resource-path append ,
- "-include=" bootstrap-profile " " join append ,
+ "-i=" over 1 head* staging-image-name append ,
- strip-word-names? [ "-no-stack-traces" , ] when
+ "-run=tools.deploy.restage" ,
+ ] if
- "-no-user-init" ,
- ] { } make
- ] bind ;
+ "-output-image=" over staging-image-name append ,
+
+ "-include=" swap " " join append ,
+
+ strip-word-names? [ "-no-stack-traces" , ] when
+
+ "-no-user-init" ,
+ ] { } make ;
: run-factor ( vm flags -- )
swap add* dup . run-with-output ; inline
-: make-staging-image ( config -- )
+: make-staging-image ( profile -- )
vm swap staging-command-line run-factor ;
-: ?make-staging-image ( config -- )
- dup [ staging-image-name ] bind exists?
+: ?make-staging-image ( profile -- )
+ dup staging-image-name exists?
[ drop ] [ make-staging-image ] if ;
: deploy-command-line ( image vocab config -- flags )
[
+ bootstrap-profile ?make-staging-image
+
[
- "-i=" staging-image-name append ,
+ "-i=" bootstrap-profile staging-image-name append ,
+
+ "-resource-path=" "" resource-path append ,
"-run=tools.deploy.shaker" ,
: make-deploy-image ( vm image vocab config -- )
make-boot-image
- dup ?make-staging-image
deploy-command-line run-factor ;
SYMBOL: deploy-implementation
"There are two sets of deployment flags. The first set controls the major subsystems which are to be included in the deployment image:"
{ $subsection deploy-math? }
{ $subsection deploy-compiler? }
+{ $subsection deploy-random? }
+{ $subsection deploy-threads? }
{ $subsection deploy-ui? }
"The second set of flags controls the level of stripping to be performed on the deployment image; there is a trade-off between image size, and retaining functionality which is required by the application:"
{ $subsection deploy-io }
$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." } ;
-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?
{ $description "Deploy flag. If set, words in the deployed image will be compiled with the optimizing compiler when possible."
$nl
"On by default. Most programs should be compiled, not only for performance but because features which depend on the C library interface only function after compilation." } ;
+HELP: deploy-random?
+{ $description "Deploy flag. If set, the random number generator protocol is included, together with two implementations: a native OS-specific random number generator, and the Mersenne Twister."
+$nl
+"On by default. If your program does not generate random numbers you can disable this to save some space." } ;
+
+HELP: deploy-threads?
+{ $description "Deploy flag. If set, thread support will be included in the final image."
+$nl
+"On by default. Most programs depend on libraries which use threads even if they don't use threads directly; for example, alarms, non-blocking I/O, and the UI are built on top of threads. If after testing your program still works without threads, you can disable this feature to save some space." } ;
+
HELP: deploy-ui?
{ $description "Deploy flag. If set, the Factor UI will be included in the deployed image."
$nl
SYMBOL: deploy-ui?
SYMBOL: deploy-compiler?
SYMBOL: deploy-math?
+SYMBOL: deploy-random?
SYMBOL: deploy-threads?
SYMBOL: deploy-io
{ deploy-reflection 1 }
{ deploy-compiler? t }
{ deploy-threads? t }
+ { deploy-random? t }
{ deploy-math? t }
{ deploy-word-props? f }
{ deploy-word-defs? f }
--- /dev/null
+IN: tools.deploy.restage
+USING: bootstrap.stage2 namespaces memory ;
+
+: restage ( -- )
+ load-components
+ "output-image" get save-image-and-exit ;
+
+MAIN: restage
QUALIFIED: libc.private
QUALIFIED: listener
QUALIFIED: prettyprint.config
-QUALIFIED: random
QUALIFIED: source-files
QUALIFIED: threads
QUALIFIED: vocabs
: stripped-globals ( -- seq )
[
- random:random-generator ,
-
{
bootstrap.stage2:bootstrap-time
continuations:error
vocabs:dictionary
lexer-factory
vocabs:load-vocab-hook
+ root-cache
layouts:num-tags
layouts:num-types
layouts:tag-mask
layouts:tag-numbers
layouts:type-numbers
classes:typemap
+ classes:class-map
vocab-roots
definitions:crossref
compiled-crossref
USING: tools.deploy.config ;
H{
- { deploy-c-types? f }
- { deploy-io 2 }
- { deploy-reflection 1 }
- { deploy-threads? t }
- { deploy-word-props? f }
{ deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "tools.deploy.test.1" }
- { deploy-math? t }
+ { deploy-threads? t }
{ deploy-compiler? t }
- { "stop-after-last-window?" t }
+ { deploy-math? t }
+ { deploy-c-types? f }
+ { deploy-io 2 }
+ { deploy-reflection 1 }
{ deploy-ui? f }
+ { "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
USING: tools.deploy.config ;
H{
- { deploy-c-types? f }
- { deploy-io 2 }
- { deploy-reflection 1 }
- { deploy-threads? t }
- { deploy-word-props? f }
{ deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "tools.deploy.test.2" }
- { deploy-math? t }
+ { deploy-threads? t }
{ deploy-compiler? t }
- { "stop-after-last-window?" t }
+ { deploy-math? t }
+ { deploy-c-types? f }
+ { deploy-io 2 }
+ { deploy-reflection 1 }
{ deploy-ui? f }
+ { "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
USING: tools.deploy.config ;
H{
- { deploy-math? t }
- { deploy-reflection 1 }
+ { deploy-word-defs? f }
+ { deploy-random? f }
{ deploy-name "tools.deploy.test.3" }
{ deploy-threads? t }
- { deploy-word-props? f }
- { "stop-after-last-window?" t }
- { deploy-ui? f }
- { deploy-io 3 }
{ deploy-compiler? t }
- { deploy-word-defs? f }
+ { deploy-math? t }
{ deploy-c-types? f }
+ { deploy-io 3 }
+ { deploy-reflection 1 }
+ { deploy-ui? f }
+ { "stop-after-last-window?" t }
+ { deploy-word-props? f }
}
deploy-compiler? get "Use optimizing compiler" <checkbox> gadget,
deploy-math? get "Rational and complex number support" <checkbox> gadget,
deploy-threads? get "Threading support" <checkbox> gadget,
+ deploy-random? get "Random number generator support" <checkbox> gadget,
deploy-word-props? get "Retain all word properties" <checkbox> gadget,
deploy-word-defs? get "Retain all word definitions" <checkbox> gadget,
deploy-c-types? get "Retain all C types" <checkbox> gadget, ;