From 86df33bc5d0c8969af1418ebf6d111cae83e280e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 9 Oct 2007 02:07:59 -0400 Subject: [PATCH] Improved deployment --- extra/tools/deploy/config/config.factor | 2 ++ extra/tools/deploy/deploy.factor | 1 + extra/tools/deploy/shaker/shaker.factor | 15 ++++++++++----- .../tools/deploy/{ => shaker}/strip-cocoa.factor | 0 .../deploy/{ => shaker}/strip-debugger.factor | 2 ++ 5 files changed, 15 insertions(+), 5 deletions(-) rename extra/tools/deploy/{ => shaker}/strip-cocoa.factor (100%) rename extra/tools/deploy/{ => shaker}/strip-debugger.factor (68%) diff --git a/extra/tools/deploy/config/config.factor b/extra/tools/deploy/config/config.factor index 832f9f4a1a..2b7353ad03 100644 --- a/extra/tools/deploy/config/config.factor +++ b/extra/tools/deploy/config/config.factor @@ -4,6 +4,7 @@ USING: vocabs.loader io.files io kernel sequences assocs splitting parser prettyprint ; IN: tools.deploy.config +SYMBOL: strip-io? SYMBOL: strip-globals? SYMBOL: strip-word-props? SYMBOL: strip-word-names? @@ -22,6 +23,7 @@ SYMBOL: deploy-image : default-config ( -- assoc ) V{ + { strip-io? f } { strip-prettyprint? t } { strip-globals? t } { strip-word-props? t } diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index 9a7f99a99d..5701d0fa1b 100644 --- a/extra/tools/deploy/deploy.factor +++ b/extra/tools/deploy/deploy.factor @@ -57,4 +57,5 @@ PRIVATE> deploy-command-line stage2 ; : deploy ( vocab -- ) + "" resource-path cd vm over ".image" append rot dup deploy-config deploy* ; diff --git a/extra/tools/deploy/shaker/shaker.factor b/extra/tools/deploy/shaker/shaker.factor index 9eabf1a67e..d19c8f4a2b 100644 --- a/extra/tools/deploy/shaker/shaker.factor +++ b/extra/tools/deploy/shaker/shaker.factor @@ -15,19 +15,20 @@ IN: tools.deploy.shaker : strip-init-hooks ( -- ) "Stripping startup hooks" show - "command-line" init-hooks get delete-at ; + "command-line" init-hooks get delete-at + strip-io? get [ "io.backend" init-hooks get delete-at ] when ; : strip-debugger ( -- ) strip-debugger? get [ "Stripping debugger" show - "resource:extra/tools/deploy/strip-debugger.factor" + "resource:extra/tools/deploy/shaker/strip-debugger.factor" run-file ] when ; : strip-cocoa ( -- ) "cocoa" vocab [ "Stripping unused Cocoa methods" show - "resource:extra/tools/deploy/strip-cocoa.factor" + "resource:extra/tools/deploy/shaker/strip-cocoa.factor" run-file ] when ; @@ -90,6 +91,8 @@ USING: bit-arrays byte-arrays io.streams.nested ; { } set-retainstack V{ } set-namestack V{ } set-catchstack + "Stripping compiled quotations" show + strip-compiled-quotations "Saving final image" show [ save-image-and-exit ] call-clear ; @@ -100,14 +103,14 @@ SYMBOL: deploy-vocab \ boot , init-hooks get values concat % , - "io.backend" init-hooks get at [ \ flush , ] when + strip-io? get [ \ flush , ] unless ] [ ] make "Boot quotation: " write dup . flush set-boot-quot ; : retained-globals ( -- seq ) [ builtins , - io-backend , + strip-io? get [ io-backend , ] unless strip-dictionary? get [ { @@ -178,6 +181,8 @@ SYMBOL: deploy-vocab deploy-vocab get require r> [ call ] when* strip + "Compressing image" show + compress-image finish-deploy ] [ print-error flush 1 exit diff --git a/extra/tools/deploy/strip-cocoa.factor b/extra/tools/deploy/shaker/strip-cocoa.factor similarity index 100% rename from extra/tools/deploy/strip-cocoa.factor rename to extra/tools/deploy/shaker/strip-cocoa.factor diff --git a/extra/tools/deploy/strip-debugger.factor b/extra/tools/deploy/shaker/strip-debugger.factor similarity index 68% rename from extra/tools/deploy/strip-debugger.factor rename to extra/tools/deploy/shaker/strip-debugger.factor index a1aea339b2..38f5268c80 100644 --- a/extra/tools/deploy/strip-debugger.factor +++ b/extra/tools/deploy/shaker/strip-debugger.factor @@ -1,4 +1,6 @@ USING: kernel ; IN: debugger +: print-error die ; + : error. die ;