raco setup: run Reference sequentially before other documentation

Otherwise, the Reference and Guide run concurrently, so the
Guide's section titles do not converge until a second run, which
forces many documents to a third run.
This commit is contained in:
Matthew Flatt 2013-07-17 20:46:52 -06:00
parent 838a753e38
commit 9a42b8ae49
3 changed files with 67 additions and 60 deletions

View File

@ -430,9 +430,11 @@ Optional @filepath{info.rkt} fields trigger additional actions by
The @racket[_order-n] specification is a hint for ordering document
builds, since documentation references can be mutually recursive.
The order hint can be any real number. The main Racket reference
is given a value of @racket[10], the search page is given a
value of @racket[-10], and the default is @racket[0].}
The order hint can be any real number. A value of @racket[-10] or
less disables running the document in parallel to other documents.
The main Racket reference is given a value of @racket[-11], the
search page is given a value of @racket[10], and the default is
@racket[0].}
@item{@as-index{@racketidfont{release-note-files}} : @racket[(listof (cons/c string? (cons/c string? list?)))] ---
A list of release-notes text files to link from the main documentation pages.

View File

@ -1,3 +1,3 @@
#lang info
(define scribblings '(("reference.scrbl" (multi-page) (racket-core -12) "reference" 16 -10)))
(define scribblings '(("reference.scrbl" (multi-page) (racket-core -12) "reference" 16 -11)))

View File

@ -264,76 +264,81 @@
(loop)))))))
(log-setup-info "getting document information")
(define (make-sequential-get-info only-fast?)
(get-doc-info only-dirs latex-dest auto-main? auto-user?
with-record-error setup-printf #f
only-fast? force-out-of-date?
no-lock))
(define num-sequential (let loop ([docs docs])
(cond
[(null? docs) 0]
[((doc-order-hint (car docs)) . > . -10) 0]
[else
(add1 (loop (cdr docs)))])))
(define infos
(and (ormap can-build*? docs)
(filter
values
(if ((min worker-count (length docs)) . < . 2)
;; non-parallel version:
(map (get-doc-info only-dirs latex-dest auto-main? auto-user?
with-record-error setup-printf #f
#f force-out-of-date?
no-lock)
docs)
(map (make-sequential-get-info #f) docs)
;; maybe parallel...
(or
(let ([infos (map (get-doc-info only-dirs latex-dest auto-main? auto-user?
with-record-error setup-printf #f
;; only-fast:
#t
force-out-of-date?
no-lock)
(let ([infos (map (make-sequential-get-info #t)
docs)])
;; check fast result
(and (andmap values infos)
infos))
;; parallel:
(parallel-do
(min worker-count (length docs))
(lambda (workerid)
(init-lock-ch!)
(list workerid program-name (verbose) only-dirs latex-dest auto-main? auto-user?
force-out-of-date? lock-ch))
(list-queue
docs
(lambda (x workerid) (s-exp->fasl (serialize x)))
(lambda (work r outstr errstr)
(printf "~a" outstr)
(printf "~a" errstr)
(deserialize (fasl->s-exp r)))
(lambda (work errmsg outstr errstr)
(parallel-do-error-handler setup-printf work errmsg outstr errstr)))
(define-worker (get-doc-info-worker workerid program-name verbosev only-dirs latex-dest
auto-main? auto-user? force-out-of-date? lock-ch)
(define ((get-doc-info-local program-name only-dirs latex-dest auto-main? auto-user?
force-out-of-date? lock
(append
(map (make-sequential-get-info #f)
(take docs num-sequential))
(parallel-do
(min worker-count (length (list-tail docs num-sequential)))
(lambda (workerid)
(init-lock-ch!)
(list workerid program-name (verbose) only-dirs latex-dest auto-main? auto-user?
force-out-of-date? lock-ch))
(list-queue
(list-tail docs num-sequential)
(lambda (x workerid) (s-exp->fasl (serialize x)))
(lambda (work r outstr errstr)
(printf "~a" outstr)
(printf "~a" errstr)
(deserialize (fasl->s-exp r)))
(lambda (work errmsg outstr errstr)
(parallel-do-error-handler setup-printf work errmsg outstr errstr)))
(define-worker (get-doc-info-worker workerid program-name verbosev only-dirs latex-dest
auto-main? auto-user? force-out-of-date? lock-ch)
(define ((get-doc-info-local program-name only-dirs latex-dest auto-main? auto-user?
force-out-of-date? lock
send/report)
doc)
(define (setup-printf subpart formatstr . rest)
(let ([task (if subpart
(format "~a: " subpart)
"")])
(send/report
(format "~a: ~a~a\n" program-name task (apply format formatstr rest)))))
(define (with-record-error cc go fail-k)
(with-handlers ([exn:fail?
(lambda (exn)
((error-display-handler) (exn-message exn) exn)
(raise exn))])
(go)))
(s-exp->fasl (serialize
((get-doc-info only-dirs latex-dest auto-main? auto-user?
with-record-error setup-printf workerid
#f force-out-of-date? lock)
(deserialize (fasl->s-exp doc))))))
(verbose verbosev)
(match-message-loop
[doc (send/success
((get-doc-info-local program-name only-dirs latex-dest auto-main? auto-user?
force-out-of-date? (lock-via-channel lock-ch)
send/report)
doc)
(define (setup-printf subpart formatstr . rest)
(let ([task (if subpart
(format "~a: " subpart)
"")])
(send/report
(format "~a: ~a~a\n" program-name task (apply format formatstr rest)))))
(define (with-record-error cc go fail-k)
(with-handlers ([exn:fail?
(lambda (exn)
((error-display-handler) (exn-message exn) exn)
(raise exn))])
(go)))
(s-exp->fasl (serialize
((get-doc-info only-dirs latex-dest auto-main? auto-user?
with-record-error setup-printf workerid
#f force-out-of-date? lock)
(deserialize (fasl->s-exp doc))))))
(verbose verbosev)
(match-message-loop
[doc (send/success
((get-doc-info-local program-name only-dirs latex-dest auto-main? auto-user?
force-out-of-date? (lock-via-channel lock-ch)
send/report)
doc))]))))))))
doc))])))))))))
(define (out-path->info path infos out-path->info-cache)
(or (hash-ref out-path->info-cache path #f)