share a timestamp cache across all collections during `raco setup'

This commit is contained in:
Matthew Flatt 2011-04-27 17:22:56 -06:00
parent 5881005e18
commit 982503b083
3 changed files with 35 additions and 15 deletions

View File

@ -201,9 +201,11 @@
(define (compile-directory dir info (define (compile-directory dir info
#:verbose [verbose? #t] #:verbose [verbose? #t]
#:skip-path [orig-skip-path #f] #: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) (define (worker prev sses)
(for-each (make-caching-managed-compile-zo) sses)) (for-each managed-compile-zo sses))
(compile-directory-visitor dir info worker (compile-directory-visitor dir info worker
#:verbose verbose? #:verbose verbose?
#:skip-path orig-skip-path #:skip-path orig-skip-path
@ -212,21 +214,27 @@
(define (get-compile-directory-srcs dir info (define (get-compile-directory-srcs dir info
#:verbose [verbose? #t] #:verbose [verbose? #t]
#:skip-path [orig-skip-path #f] #: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 (compile-directory-visitor dir info append
#:verbose verbose? #:verbose verbose?
#:skip-path orig-skip-path #: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 (define (compile-collection-zos collection
#:skip-path [skip-path #f] #:skip-path [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)]
. cp) . cp)
(compile-directory (apply collection-path collection cp) (compile-directory (apply collection-path collection cp)
(c-get-info (cons collection cp)) (c-get-info (cons collection cp))
#:verbose #f #:verbose #f
#:skip-path skip-path #: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-zos compile-directory)
(define compile-directory-srcs get-compile-directory-srcs) (define compile-directory-srcs get-compile-directory-srcs)

View File

@ -9,6 +9,7 @@
compiler/option compiler/option
compiler/option-unit compiler/option-unit
compiler/comp-unit compiler/comp-unit
compiler/cm
dynext/compile-sig dynext/compile-sig
dynext/link-sig dynext/link-sig
dynext/file-sig dynext/file-sig
@ -70,15 +71,21 @@ file is reported through the current output port.}
@defproc[(compile-collection-zos [collection string?] ...+ @defproc[(compile-collection-zos [collection string?] ...+
[#:skip-path skip-path (or/c path-string? #f) #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?]{ 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 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 extension @filepath{.rkt}, @filepath{.ss}, or @filepath{.scm} in a collection are
compiled, as are all such files within subdirectories, execept that 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 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 after @scheme[(simplify-path _p #f)]starts with the
byte-string form of @scheme[(simplify-path skip-path #f)].) 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 unless the provided @scheme[skip-docs?] argument is a true
value.} 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?] @defproc[(compile-directory-zos [path path-string?]
[info ()] [info ()]
[#:verbose verbose? any/c #f] [#:verbose verbose? any/c #f]
[#:skip-path skip-path (or/c path-string? #f) #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?]{ void?]{
Like @scheme[compile-collection-zos], but compiles the given directory Like @scheme[compile-collection-zos], but compiles the given directory

View File

@ -124,7 +124,6 @@
(when (not (zero? (string-length err))) (eprintf "STDERR:\n~a=====\n" err))))) (when (not (zero? (string-length err))) (eprintf "STDERR:\n~a=====\n" err)))))
(define (done) (define (done)
(setup-printf #f "done")
(unless (null? errors) (unless (null? errors)
(setup-printf #f "") (setup-printf #f "")
(show-errors (current-error-port)) (show-errors (current-error-port))
@ -639,6 +638,11 @@
(thunk)))]) (thunk)))])
(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) (define (compile-cc cc gcs)
(parameterize ([current-namespace (make-base-empty-namespace)]) (parameterize ([current-namespace (make-base-empty-namespace)])
(begin-record-error cc "making" (begin-record-error cc "making"
@ -651,6 +655,7 @@
[info (cc-info cc)]) [info (cc-info cc)])
(clean-cc dir info) (clean-cc dir info)
(compile-directory-zos dir info (compile-directory-zos dir info
#:managed-compile-zo caching-managed-compile-zo
#:skip-path (and (avoid-main-installation) (find-collects-dir)) #:skip-path (and (avoid-main-installation) (find-collects-dir))
#:skip-doc-sources? (not (make-docs))))))) #:skip-doc-sources? (not (make-docs)))))))
(match gcs (match gcs