use template source for hash key, not template output

pull/102/head
Matthew Butterick 9 years ago
parent 1ed63e0932
commit a42acbf2e6

@ -72,7 +72,8 @@
(define (paths->key source-path [template-path #f])
;; key is list of file + mod-time pairs, use #f for missing
(define path-strings (append (list source-path)
(append (list template-path) ; is either path or #f
(append (list (and template-path (or (->source-path template-path) template-path))) ; if source-path exists, use that instead
(->list (get-directory-require-files source-path))))) ; is either list of files or (list #f)
;; can't use relative paths for cache keys because source files include `here-path` which is absolute.
;; problem is that cache could appear valid on another filesystem (based on relative pathnames & mod dates)

@ -142,9 +142,18 @@
(values (->complete-path (or (get-stem-source path) (->stem-source-path path)))
(->complete-path (->output-path path)))))))]))
(make-source-utility-functions preproc)
(define+provide/contract (->source+output-paths source-or-output-path)
(complete-path? . -> . (values complete-path? complete-path?))
;; file-proc returns two values, but ormap only wants one
(define file-proc (ormap (λ(test file-proc) (and (test source-or-output-path) file-proc))
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source? has/is-template-source?)
(list ->null-source+output-paths ->preproc-source+output-paths ->markup-source+output-paths ->scribble-source+output-paths ->markdown-source+output-paths ->template-source+output-paths)))
(file-proc source-or-output-path))
(module-test-external
(require sugar/coerce)
(check-true (preproc-source? "foo.pp"))
@ -242,7 +251,7 @@
(define+provide (cache-file? path)
(ormap (λ(cache-name) (ends-with? (path->string path) cache-name)) world:cache-names))
(require sugar/debug)
(define+provide (pollen-related-file? file)
(ormap (λ(proc) (proc file)) (list
preproc-source?

@ -90,15 +90,6 @@
(void))
(define/contract (->source+output-paths source-or-output-path)
(complete-path? . -> . (values complete-path? complete-path?))
;; file-proc returns two values, but ormap only wants one
(define file-proc (ormap (λ(test file-proc) (and (test source-or-output-path) file-proc))
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source? has/is-template-source?)
(list ->null-source+output-paths ->preproc-source+output-paths ->markup-source+output-paths ->scribble-source+output-paths ->markdown-source+output-paths ->template-source+output-paths)))
(file-proc source-or-output-path))
(define/contract (render-needed? source-path template-path output-path)
(complete-path? (or/c #f complete-path?) complete-path? . -> . (or/c #f symbol?))
;; return symbol rather than boolean for extra debugging information

Loading…
Cancel
Save