From f6a598a1164d3a29f979cb83099a4af7ed9f0207 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 31 Oct 2020 09:26:19 -0600 Subject: [PATCH] raco setup: add `--sync-docs-only` flag The `--sync-docs-only` flag is intended for contexts like pkg-build as a backstop against unintended and time-consuming activity when the intent is to assemble documentation. --- pkgs/racket-doc/scribblings/raco/setup.scrbl | 9 +++++++-- pkgs/racket-index/setup/scribble.rkt | 8 +++++--- racket/collects/setup/option.rkt | 1 + racket/collects/setup/setup-cmdline.rkt | 2 ++ racket/collects/setup/setup-core.rkt | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pkgs/racket-doc/scribblings/raco/setup.scrbl b/pkgs/racket-doc/scribblings/raco/setup.scrbl index ea804a7703..b8a13e7bc9 100644 --- a/pkgs/racket-doc/scribblings/raco/setup.scrbl +++ b/pkgs/racket-doc/scribblings/raco/setup.scrbl @@ -167,6 +167,10 @@ flags: recompiled from an existing @filepath{.zo} in machine-independent format (when compiling to a machine-dependent format).} + @item{@DFlag{sync-docs-only} --- synchronize or move documentation + into place to ``build'' it, but do not run or render documentation + sources.} + @item{@DFlag{no-launcher} or @Flag{x} --- refrain from creating executables or installing @tt{man} pages (as specified in @filepath{info.rkt}; see @secref["setup-info"]).} @@ -385,8 +389,9 @@ debugging: #:changed "7.0.0.19" @elem{Added @DFlag{places} and @DFlag{processes}.} #:changed "7.2.0.7" @elem{Added @DFlag{error-in} and @DFlag{error-out}.} #:changed "7.2.0.8" @elem{Added @DFlag{recompile-only}.} - #:changed "7.9.0.3" @elem{Added @envvar{PLT_SETUP_NO_FORCE_GC} and - @envvar{PLT_SETUP_SHOW_TIMESTAMPS}.}] + #:changed "7.9.0.3" @elem{Added @envvar{PLT_SETUP_NO_FORCE_GC}, + @envvar{PLT_SETUP_SHOW_TIMESTAMPS}, + and @DFlag{sync-docs-only}.}] @; ------------------------------------------------------------------------ diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt index c06a901d57..22c339bcc8 100644 --- a/pkgs/racket-index/setup/scribble.rkt +++ b/pkgs/racket-index/setup/scribble.rkt @@ -146,6 +146,7 @@ always-user? ; make user-specific even if otherwise unneeded tidy? ; clean up, even beyond `only-dirs' avoid-main? ; avoid main collection, even for `tidy?' + only-fast? ; move/sync docs, but don't run/render with-record-error ; catch & record exceptions setup-printf gc-after-each-sequential?) @@ -331,9 +332,10 @@ (and (ormap can-build**? docs) (filter values - (if ((min worker-count (length docs)) . < . 2) + (if (or ((min worker-count (length docs)) . < . 2) + only-fast?) ;; non-parallel version: - (map (make-sequential-get-info #f) docs) + (map (make-sequential-get-info only-fast?) docs) ;; maybe parallel... (or (let ([infos (map (make-sequential-get-info #t) @@ -629,7 +631,7 @@ (write-in/info latex-dest info no-lock main-doc-exists?) (set-info-need-in-write?! info #f))) ;; Iterate, if any need to run: - (when (and (ormap info-need-run? infos) (iter . < . 30)) + (when (and (ormap info-need-run? infos) (iter . < . 30) (not only-fast?)) (log-setup-info "building") ;; Build again, using dependencies (let ([need-rerun (sort (filter-map (lambda (i) diff --git a/racket/collects/setup/option.rkt b/racket/collects/setup/option.rkt index 815c2f6967..b3ac1a9edb 100644 --- a/racket/collects/setup/option.rkt +++ b/racket/collects/setup/option.rkt @@ -83,6 +83,7 @@ (define-flag-param fix-dependencies #f) (define-flag-param check-unused-dependencies #f) (define-flag-param recompile-only #f) +(define-flag-param sync-docs-only #f) (define-flag-param call-install #t) (define-flag-param call-post-install #t) (define-flag-param pause-on-errors #f) diff --git a/racket/collects/setup/setup-cmdline.rkt b/racket/collects/setup/setup-cmdline.rkt index 7753587eba..2d592f7504 100644 --- a/racket/collects/setup/setup-cmdline.rkt +++ b/racket/collects/setup/setup-cmdline.rkt @@ -82,6 +82,8 @@ (add-flags '((trust-existing-zos #t)))] [("--recompile-only") "Fail if compilation must start from source" (add-flags '((recompile-only #t)))] + [("--sync-docs-only") "Sync/move documentation, but do not run or render" + (add-flags '((sync-docs-only #t)))] [("-x" "--no-launcher") "Do not produce launcher programs" (add-flags '((make-launchers #f)))] [("-F" "--no-foreign-libs") "Do not install foreign libraries" diff --git a/racket/collects/setup/setup-core.rkt b/racket/collects/setup/setup-core.rkt index a480747691..d3011eac33 100755 --- a/racket/collects/setup/setup-core.rkt +++ b/racket/collects/setup/setup-core.rkt @@ -1432,7 +1432,7 @@ name-str (if no-specific-collections? #f (map cc-path ccs-to-compile)) latex-dest auto-start-doc? (make-user) (force-user-docs) - (make-tidy) (avoid-main-installation) + (make-tidy) (avoid-main-installation) (sync-docs-only) (lambda (what go alt) (record-error what "building docs" go alt)) setup-printf gc-after-each-sequential?))