From 413ca6843515dab5272d889e8a5f8df71fad9691 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 2 May 2013 11:35:30 -0600 Subject: [PATCH] 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. --- collects/pkg/main.rkt | 7 +++---- collects/scribblings/raco/setup.scrbl | 21 +++++++++++++++------ collects/setup/option-sig.rkt | 1 + collects/setup/option-unit.rkt | 1 + collects/setup/setup-cmdline.rkt | 2 ++ collects/setup/setup-unit.rkt | 27 ++++++++++++++++++++------- collects/setup/setup.rkt | 3 +++ 7 files changed, 45 insertions(+), 17 deletions(-) diff --git a/collects/pkg/main.rkt b/collects/pkg/main.rkt index 08743432c2..8c1526d312 100644 --- a/collects/pkg/main.rkt +++ b/collects/pkg/main.rkt @@ -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 diff --git a/collects/scribblings/raco/setup.scrbl b/collects/scribblings/raco/setup.scrbl index 49ae968c65..c8dfbd656c 100644 --- a/collects/scribblings/raco/setup.scrbl +++ b/collects/scribblings/raco/setup.scrbl @@ -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} diff --git a/collects/setup/option-sig.rkt b/collects/setup/option-sig.rkt index f545cca0b4..d97ad6a660 100644 --- a/collects/setup/option-sig.rkt +++ b/collects/setup/option-sig.rkt @@ -20,6 +20,7 @@ make-planet avoid-main-installation make-tidy + make-doc-index call-install call-post-install pause-on-errors diff --git a/collects/setup/option-unit.rkt b/collects/setup/option-unit.rkt index c934f92bbc..170fd918e9 100644 --- a/collects/setup/option-unit.rkt +++ b/collects/setup/option-unit.rkt @@ -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) diff --git a/collects/setup/setup-cmdline.rkt b/collects/setup/setup-cmdline.rkt index e4effe71c9..9e6cc328c3 100644 --- a/collects/setup/setup-cmdline.rkt +++ b/collects/setup/setup-cmdline.rkt @@ -45,6 +45,8 @@ #:once-each [("--tidy") "Clear references to removed, even if not a specified " (add-flags '((make-tidy #t)))] + [("--doc-index") "Rebuild documentation indexes, along with specified s" + (add-flags '((make-doc-index #t)))] [("-c" "--clean") "Delete existing compiled files; implies -nxi" (add-flags '((clean #t) (make-zo #f) diff --git a/collects/setup/setup-unit.rkt b/collects/setup/setup-unit.rkt index 1d3abc383e..9ec0ea2802 100644 --- a/collects/setup/setup-unit.rkt +++ b/collects/setup/setup-unit.rkt @@ -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) diff --git a/collects/setup/setup.rkt b/collects/setup/setup.rkt index 2420f3e679..02e75d57a9 100644 --- a/collects/setup/setup.rkt +++ b/collects/setup/setup.rkt @@ -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))