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.
This commit is contained in:
Matthew Flatt 2020-10-31 09:26:19 -06:00
parent 741048eebb
commit f6a598a116
5 changed files with 16 additions and 6 deletions

View File

@ -167,6 +167,10 @@ flags:
recompiled from an existing @filepath{.zo} in machine-independent recompiled from an existing @filepath{.zo} in machine-independent
format (when compiling to a machine-dependent format).} 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 @item{@DFlag{no-launcher} or @Flag{x} --- refrain from creating
executables or installing @tt{man} pages (as specified in executables or installing @tt{man} pages (as specified in
@filepath{info.rkt}; see @secref["setup-info"]).} @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.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.7" @elem{Added @DFlag{error-in} and @DFlag{error-out}.}
#:changed "7.2.0.8" @elem{Added @DFlag{recompile-only}.} #:changed "7.2.0.8" @elem{Added @DFlag{recompile-only}.}
#:changed "7.9.0.3" @elem{Added @envvar{PLT_SETUP_NO_FORCE_GC} and #:changed "7.9.0.3" @elem{Added @envvar{PLT_SETUP_NO_FORCE_GC},
@envvar{PLT_SETUP_SHOW_TIMESTAMPS}.}] @envvar{PLT_SETUP_SHOW_TIMESTAMPS},
and @DFlag{sync-docs-only}.}]
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------

View File

@ -146,6 +146,7 @@
always-user? ; make user-specific even if otherwise unneeded always-user? ; make user-specific even if otherwise unneeded
tidy? ; clean up, even beyond `only-dirs' tidy? ; clean up, even beyond `only-dirs'
avoid-main? ; avoid main collection, even for `tidy?' avoid-main? ; avoid main collection, even for `tidy?'
only-fast? ; move/sync docs, but don't run/render
with-record-error ; catch & record exceptions with-record-error ; catch & record exceptions
setup-printf setup-printf
gc-after-each-sequential?) gc-after-each-sequential?)
@ -331,9 +332,10 @@
(and (ormap can-build**? docs) (and (ormap can-build**? docs)
(filter (filter
values values
(if ((min worker-count (length docs)) . < . 2) (if (or ((min worker-count (length docs)) . < . 2)
only-fast?)
;; non-parallel version: ;; non-parallel version:
(map (make-sequential-get-info #f) docs) (map (make-sequential-get-info only-fast?) docs)
;; maybe parallel... ;; maybe parallel...
(or (or
(let ([infos (map (make-sequential-get-info #t) (let ([infos (map (make-sequential-get-info #t)
@ -629,7 +631,7 @@
(write-in/info latex-dest info no-lock main-doc-exists?) (write-in/info latex-dest info no-lock main-doc-exists?)
(set-info-need-in-write?! info #f))) (set-info-need-in-write?! info #f)))
;; Iterate, if any need to run: ;; 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") (log-setup-info "building")
;; Build again, using dependencies ;; Build again, using dependencies
(let ([need-rerun (sort (filter-map (lambda (i) (let ([need-rerun (sort (filter-map (lambda (i)

View File

@ -83,6 +83,7 @@
(define-flag-param fix-dependencies #f) (define-flag-param fix-dependencies #f)
(define-flag-param check-unused-dependencies #f) (define-flag-param check-unused-dependencies #f)
(define-flag-param recompile-only #f) (define-flag-param recompile-only #f)
(define-flag-param sync-docs-only #f)
(define-flag-param call-install #t) (define-flag-param call-install #t)
(define-flag-param call-post-install #t) (define-flag-param call-post-install #t)
(define-flag-param pause-on-errors #f) (define-flag-param pause-on-errors #f)

View File

@ -82,6 +82,8 @@
(add-flags '((trust-existing-zos #t)))] (add-flags '((trust-existing-zos #t)))]
[("--recompile-only") "Fail if compilation must start from source" [("--recompile-only") "Fail if compilation must start from source"
(add-flags '((recompile-only #t)))] (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" [("-x" "--no-launcher") "Do not produce launcher programs"
(add-flags '((make-launchers #f)))] (add-flags '((make-launchers #f)))]
[("-F" "--no-foreign-libs") "Do not install foreign libraries" [("-F" "--no-foreign-libs") "Do not install foreign libraries"

View File

@ -1432,7 +1432,7 @@
name-str name-str
(if no-specific-collections? #f (map cc-path ccs-to-compile)) (if no-specific-collections? #f (map cc-path ccs-to-compile))
latex-dest auto-start-doc? (make-user) (force-user-docs) 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)) (lambda (what go alt) (record-error what "building docs" go alt))
setup-printf setup-printf
gc-after-each-sequential?)) gc-after-each-sequential?))