add `compile-cache-watchlist` (fixes #168)

pull/169/head
Matthew Butterick 7 years ago
parent d546a972d9
commit 1cb16c0440

@ -24,7 +24,9 @@
;; if template has a source file, track that instead ;; if template has a source file, track that instead
(and template-path (or (get-source template-path) template-path)) (and template-path (or (get-source template-path) template-path))
;; is either list of files or (list #f) ;; is either list of files or (list #f)
(->list (get-directory-require-files source-path)))) (append (->list (get-directory-require-files source-path))
;; user-designated files to track
(map ->string (setup:compile-cache-watchlist source-path)))))
(define pollen-env (getenv default-env-name)) (define pollen-env (getenv default-env-name))
(define poly-flag (and (has-inner-poly-ext? source-path) (current-poly-target))) (define poly-flag (and (has-inner-poly-ext? source-path) (current-poly-target)))
(define path+mod-time-pairs (define path+mod-time-pairs

@ -1 +1 @@
1516080512 1516488850

@ -1,6 +1,6 @@
#lang scribble/manual #lang scribble/manual
@(require "mb-tools.rkt") @(require "mb-tools.rkt")
@(require scribble/eval pollen/setup racket/string (for-label racket (except-in pollen #%module-begin) pollen/setup)) @(require scribble/eval pollen/setup racket/string (for-label racket syntax/modresolve (except-in pollen #%module-begin) pollen/setup))
@(define my-eval (make-base-eval)) @(define my-eval (make-base-eval))
@(my-eval `(require pollen pollen/setup)) @(my-eval `(require pollen pollen/setup))
@ -106,6 +106,21 @@ Default separators used in decoding.
@defoverridable[compile-cache-max-size exact-positive-integer?]{Maximum size of the compile cache.} @defoverridable[compile-cache-max-size exact-positive-integer?]{Maximum size of the compile cache.}
@defoverridable[compile-cache-watchlist (listof (or/c path? path-string?))]{List of extra files that the compile cache watches during a project-server session. If one of the files on the watchlist changes, the compile cache is invalidated (just as it would be if @racket["pollen.rkt"] changed).
If the compile cache can't find a certain file on the watchlist, it will be ignored. Therefore, to avoid unexpected behavior, the best policy is to pass in complete paths (or path strings). An easy way to convert a module name into a complete path is with @racket[resolve-module-path]:
@fileblock["pollen.rkt"
@codeblock{
(module+ setup
(require syntax/modresolve)
(provide (all-defined-out))
(define compile-cache-watchlist (map resolve-module-path '("my-module.rkt"))))
}]
}
@defoverridable[publish-directory (or/c path-string? path-for-some-system?)]{Default target for @secref{raco_pollen_publish}. A complete path is used as is; a relative path is published to the desktop.. @pollen-history[#:added "1.1"]} @defoverridable[publish-directory (or/c path-string? path-for-some-system?)]{Default target for @secref{raco_pollen_publish}. A complete path is used as is; a relative path is published to the desktop.. @pollen-history[#:added "1.1"]}
@defoverridable[unpublished-path? (path? . -> . boolean?)]{@pollen-history[#:changed "1.1" @elem{Deprecated. Please use @racket[setup:omitted-path?].}]} @defoverridable[unpublished-path? (path? . -> . boolean?)]{@pollen-history[#:changed "1.1" @elem{Deprecated. Please use @racket[setup:omitted-path?].}]}
@ -134,6 +149,8 @@ Default separators used in decoding.
@defoverridable[index-pages (listof string?)]{List of strings that the project server will use as directory default pages, in order of priority. Has no effect on command-line rendering operations. Also has no effect on your live web server (usually that's a setting you need to make in an @tt{.htaccess} configuration file).} But with this setting, you can simulate the behavior of your live server, so that internal index-page URLs work correctly. @defoverridable[index-pages (listof string?)]{List of strings that the project server will use as directory default pages, in order of priority. Has no effect on command-line rendering operations. Also has no effect on your live web server (usually that's a setting you need to make in an @tt{.htaccess} configuration file).} But with this setting, you can simulate the behavior of your live server, so that internal index-page URLs work correctly.
@section{Parameters} @section{Parameters}
I mean @italic{parameters} in the Racket sense, i.e. values that can be fed to @racket[parameterize]. I mean @italic{parameters} in the Racket sense, i.e. values that can be fed to @racket[parameterize].

@ -46,6 +46,8 @@
(with-handlers ([exn:fail? NAME-FAIL-THUNKED]) (with-handlers ([exn:fail? NAME-FAIL-THUNKED])
(dynamic-require `(submod ,(apply get-path-to-override get-path-args) WORLD-SUBMOD) 'NAME NAME-FAIL-THUNKED))))))])) (dynamic-require `(submod ,(apply get-path-to-override get-path-args) WORLD-SUBMOD) 'NAME NAME-FAIL-THUNKED))))))]))
(define-settable compile-cache-watchlist null)
(define-settable preproc-source-ext 'pp) (define-settable preproc-source-ext 'pp)
(define-settable markup-source-ext 'pm) (define-settable markup-source-ext 'pm)
(define-settable markdown-source-ext 'pmd) (define-settable markdown-source-ext 'pmd)

Loading…
Cancel
Save