diff --git a/collects/compiler/compiler-unit.rkt b/collects/compiler/compiler-unit.rkt index 3912d73b58..1c1d67fc03 100644 --- a/collects/compiler/compiler-unit.rkt +++ b/collects/compiler/compiler-unit.rkt @@ -201,9 +201,11 @@ (define (compile-directory dir info #:verbose [verbose? #t] #:skip-path [orig-skip-path #f] - #:skip-doc-sources? [skip-docs? #f]) + #:skip-doc-sources? [skip-docs? #f] + #:managed-compile-zo [managed-compile-zo + (make-caching-managed-compile-zo)]) (define (worker prev sses) - (for-each (make-caching-managed-compile-zo) sses)) + (for-each managed-compile-zo sses)) (compile-directory-visitor dir info worker #:verbose verbose? #:skip-path orig-skip-path @@ -212,21 +214,27 @@ (define (get-compile-directory-srcs dir info #:verbose [verbose? #t] #:skip-path [orig-skip-path #f] - #:skip-doc-sources? [skip-docs? #f]) + #:skip-doc-sources? [skip-docs? #f] + #:managed-compile-zo [managed-compile-zo + (make-caching-managed-compile-zo)]) (compile-directory-visitor dir info append #:verbose verbose? #:skip-path orig-skip-path - #:skip-doc-sources? skip-docs?)) + #:skip-doc-sources? skip-docs? + #:managed-compile-zo managed-compile-zo)) (define (compile-collection-zos collection #:skip-path [skip-path #f] #:skip-doc-sources? [skip-docs? #f] + #:managed-compile-zo [managed-compile-zo + (make-caching-managed-compile-zo)] . cp) (compile-directory (apply collection-path collection cp) (c-get-info (cons collection cp)) #:verbose #f #:skip-path skip-path - #:skip-doc-sources? skip-docs?)) + #:skip-doc-sources? skip-docs? + #:managed-compile-zo managed-compile-zo)) (define compile-directory-zos compile-directory) (define compile-directory-srcs get-compile-directory-srcs) diff --git a/collects/scribblings/raco/api.scrbl b/collects/scribblings/raco/api.scrbl index 064f136f98..f4ff5cc836 100644 --- a/collects/scribblings/raco/api.scrbl +++ b/collects/scribblings/raco/api.scrbl @@ -9,6 +9,7 @@ compiler/option compiler/option-unit compiler/comp-unit + compiler/cm dynext/compile-sig dynext/link-sig dynext/file-sig @@ -70,15 +71,21 @@ file is reported through the current output port.} @defproc[(compile-collection-zos [collection string?] ...+ [#:skip-path skip-path (or/c path-string? #f) #f] - [#:skip-doc-sources? skip-docs? any/c #f]) + [#:skip-doc-sources? skip-docs? any/c #f] + [#:managed-compile-zo managed-compile-zo + (path-string? . -> . void?) + (make-caching-managed-compile-zo)]) void?]{ -Compiles the specified collection's files to @filepath{.zo} files. +Compiles the specified collection's files to @filepath{.zo} files +by using @racket[managed-compile-zo] on each source file. The @filepath{.zo} files are placed into the collection's -@filepath{compiled} directory. By default, all files with the +@filepath{compiled} directory. + +By default, all files with the extension @filepath{.rkt}, @filepath{.ss}, or @filepath{.scm} in a collection are compiled, as are all such files within subdirectories, execept that -any file or directory whose path starts with @scheme[racket-path] is +any file or directory whose path starts with @scheme[skip-path] is skipped. (``Starts with'' means that the simplified path @scheme[_p]'s byte-string form after @scheme[(simplify-path _p #f)]starts with the byte-string form of @scheme[(simplify-path skip-path #f)].) @@ -118,17 +125,17 @@ collection. The following fields are used: unless the provided @scheme[skip-docs?] argument is a true value.} -] - -The compilation process for an individual file is driven by -@scheme[managed-compile-zo] from @schememodname[compiler/cm].} +]} @defproc[(compile-directory-zos [path path-string?] [info ()] [#:verbose verbose? any/c #f] [#:skip-path skip-path (or/c path-string? #f) #f] - [#:skip-doc-sources? skip-docs? any/c #f]) + [#:skip-doc-sources? skip-docs? any/c #f] + [#:managed-compile-zo managed-compile-zo + (path-string? . -> . void?) + (make-caching-managed-compile-zo)]) void?]{ Like @scheme[compile-collection-zos], but compiles the given directory diff --git a/collects/setup/setup-unit.rkt b/collects/setup/setup-unit.rkt index 988d567280..e8fef2f8d5 100644 --- a/collects/setup/setup-unit.rkt +++ b/collects/setup/setup-unit.rkt @@ -124,7 +124,6 @@ (when (not (zero? (string-length err))) (eprintf "STDERR:\n~a=====\n" err))))) (define (done) - (setup-printf #f "done") (unless (null? errors) (setup-printf #f "") (show-errors (current-error-port)) @@ -639,6 +638,11 @@ (thunk)))]) (thunk)))))) + ;; We keep timestamp information for all files that we try to compile. + ;; That's O(N) for an installation of size N, but the constant is small, + ;; and it makes a do-nothing setup complete much faster. + (define caching-managed-compile-zo (make-caching-managed-compile-zo)) + (define (compile-cc cc gcs) (parameterize ([current-namespace (make-base-empty-namespace)]) (begin-record-error cc "making" @@ -651,6 +655,7 @@ [info (cc-info cc)]) (clean-cc dir info) (compile-directory-zos dir info + #:managed-compile-zo caching-managed-compile-zo #:skip-path (and (avoid-main-installation) (find-collects-dir)) #:skip-doc-sources? (not (make-docs))))))) (match gcs