raco setup: add --doc-index; raco pkg: use --doc-index

This combination of changes moves the decision about rebuilding
"scribblings/main" and "scribblings/main/user" to `raco setup',
which is in a better position to know whether documentation should
be built at all.
This commit is contained in:
Matthew Flatt 2013-05-02 11:35:30 -06:00
parent a2dfe1ba46
commit 413ca68435
7 changed files with 45 additions and 17 deletions

View File

@ -14,14 +14,13 @@
(define installation? (eq? 'installation (current-pkg-scope)))
(setup:setup
#:make-user? (not installation?)
#:avoid-main? (not installation?)
#:collections (and setup-collects
(map (lambda (s)
(if (list? s) s (list s)))
(append setup-collects
(if installation? '("scribblings/main") null)
'("scribblings/main/user"))))
setup-collects))
#:tidy? #t
#:avoid-main? (not installation?))))
#:make-doc-index? #t)))
(define ((pkg-error cmd) . args)
(apply raise-user-error

View File

@ -112,6 +112,10 @@ flags:
documentation for non-existent collections (to clean up after removal)
even when setup actions are otherwise confined to specified collections.}
@item{@DFlag{doc-index} --- builds collections that implement
documentation indexes (when documentation building is enabled), in
addition to specified collections.}
@item{@DFlag{clean} or @Flag{c} --- delete existing @filepath{.zo}
files, thus ensuring a clean build from the source files. The exact
set of deleted files can be controlled by @filepath{info.rkt}; see
@ -529,10 +533,11 @@ Optional @filepath{info.rkt} fields trigger additional actions by
exact-nonnegative-integer?)))
#f]
[#:make-user? make-user? any/c #t]
[#:avoid-main? avoid-main? any/c #f]
[#:make-docs? make-docs? any/c #t]
[#:make-doc-index? make-doc-index? any/c #f]
[#:clean? clean? any/c #f]
[#:tidy? tidy? any/c #f]
[#:avoid-main? avoid-main? any/c #f]
[#:jobs jobs exact-nonnegative-integer? #f]
[#:get-target-dir get-target-dir (or/c #f (-> path-string?)) #f])
void?]{
@ -549,11 +554,18 @@ Runs @exec{raco setup} with various options:
@item{@racket[planet-spec] --- if not @racket[#f], constrains setup to
the named @|PLaneT| packages, along with @racket[collections], if any}
@item{@racket[make-user?] --- if @racket[#f], disables any
user-specific setup actions}
@item{@racket[avoid-main?] --- if true, avoids setup actions that affect
the main installation, as opposed to user directories}
@item{@racket[make-docs?] --- if @racket[#f], disables any
documentation-specific setup actions}
@item{@racket[make-user?] --- if @racket[#f], disables any
user-specific setup actions}
@item{@racket[make-doc-index?] --- if @racket[#t], builds
documentation index collections in addition to @racket[collections],
assuming that documentation is built}
@item{@racket[clean?] --- if true, enables cleaning mode instead of setup mode}
@ -561,9 +573,6 @@ Runs @exec{raco setup} with various options:
documentation and metadata indexes even when @racket[collections]
or @racket[planet-specs] is non-@racket[#f]}
@item{@racket[avoid-main?] --- if true, avoids setup actions that affect
the main installation, as opposed to user directories}
@item{@racket[jobs] --- if not @racket[#f], determines the maximum number of parallel
tasks used for setup}

View File

@ -20,6 +20,7 @@
make-planet
avoid-main-installation
make-tidy
make-doc-index
call-install
call-post-install
pause-on-errors

View File

@ -45,6 +45,7 @@
(define-flag-param make-planet #t)
(define-flag-param avoid-main-installation #f)
(define-flag-param make-tidy #f)
(define-flag-param make-doc-index #f)
(define-flag-param call-install #t)
(define-flag-param call-post-install #t)
(define-flag-param pause-on-errors #f)

View File

@ -45,6 +45,8 @@
#:once-each
[("--tidy") "Clear references to removed, even if not a specified <collection>"
(add-flags '((make-tidy #t)))]
[("--doc-index") "Rebuild documentation indexes, along with specified <collection>s"
(add-flags '((make-doc-index #t)))]
[("-c" "--clean") "Delete existing compiled files; implies -nxi"
(add-flags '((clean #t)
(make-zo #f)

View File

@ -146,9 +146,24 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Archive Unpacking ;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define make-docs?
(and (make-docs)
;; Double-check that "setup/scribble" is present.
(file-exists? (collection-file-path "scribble.rkt" "setup"))))
(define x-specific-collections
(append* (specific-collections)
(if (and (make-doc-index)
make-docs?)
(append
(if (not (avoid-main-installation))
'(("scribblings/main"))
null)
(if (make-user)
'(("scribblings/main/user"))
null))
null)
(for/list ([x (in-list (archives))])
(unpack x
(build-path main-collects-dir 'up)
@ -407,7 +422,7 @@
(define srcs
(append
(filter extract-base-filename/ss files)
(if (make-docs)
(if make-docs?
(filter (lambda (p) (not (member p omit)))
(map (lambda (s) (if (string? s) (string->path s) s))
(map car (call-info info 'scribblings
@ -790,7 +805,7 @@
#:omit-root (cc-omit-root cc)
#:managed-compile-zo caching-managed-compile-zo
#:skip-path (and (avoid-main-installation) (find-collects-dir))
#:skip-doc-sources? (not (make-docs)))))))
#:skip-doc-sources? (not make-docs?))))))
(if (eq? 0 gcs)
0
(begin (collect-garbage) (sub1 gcs))))
@ -1308,10 +1323,8 @@
(when (make-launchers) (make-launchers-step))
(when (make-docs)
;; Double-check that "setup/scribble" is present.
(when (file-exists? (collection-file-path "scribble.rkt" "setup"))
(make-docs-step)))
(when make-docs?
(make-docs-step))
(when (doc-pdf-dest) (doc-pdf-dest-step))
(do-install-part 'general)

View File

@ -20,6 +20,7 @@
#:planet-specs [planet-specs #f]
#:collections [collections #f]
#:make-docs? [make-docs? #t]
#:make-doc-index? [make-doc-index? #t]
#:make-user? [make-user? #t]
#:clean? [clean? #f]
#:tidy? [tidy? #f]
@ -53,6 +54,8 @@
(unless make-docs?
(make-docs #f))
(when make-doc-index?
(make-doc-index #t))
(when tidy?
(make-tidy #t))