add parameter to turn off reloading of project requires

pull/9/head
Matthew Butterick 10 years ago
parent d4281d826e
commit 2fcb99a508

@ -70,13 +70,14 @@
(define (project-requires-changed?) (define (project-requires-changed?)
(define changed? (ormap (λ(x) x) (map file-needed-rerequire? (get-project-require-files)))) ; make sure all files are rerequired before test (define rerequire-results (map file-needed-rerequire? (get-project-require-files)))
(when changed? (define requires-changed? (ormap (λ(x) x) rerequire-results))
(when requires-changed?
(begin (begin
(message "render: project requires have changed, resetting cache & file-modification table") (message "render: project requires have changed, resetting cache & file-modification table")
(reset-cache) (reset-cache) ; because stored data is obsolete
(reset-modification-dates))) ; mark existing files as obsolete (reset-modification-dates))) ; because rendered files are obsolete
changed?) requires-changed?)
(define/contract (render-needed? source-path template-path output-path) (define/contract (render-needed? source-path template-path output-path)
@ -84,7 +85,7 @@
(or (not (file-exists? output-path)) (or (not (file-exists? output-path))
(modification-date-expired? source-path template-path) (modification-date-expired? source-path template-path)
(and (not (null-source? source-path)) (file-needed-rerequire? source-path)) (and (not (null-source? source-path)) (file-needed-rerequire? source-path))
(project-requires-changed?))) (and (world:check-project-requires-in-render?) (project-requires-changed?))))
(define/contract+provide (render-to-file-if-needed source-or-output-path #:force [force #f]) (define/contract+provide (render-to-file-if-needed source-or-output-path #:force [force #f])

@ -60,4 +60,4 @@
(define current-module-root (make-parameter #f)) (define current-module-root (make-parameter #f))
(define current-server-extras-path (make-parameter #f)) (define current-server-extras-path (make-parameter #f))
(define check-project-requires-in-render? (make-parameter #t))

Loading…
Cancel
Save