compiler/cm-accomplice: adjust protocol for extra options
Instead of introducing a subtype of `file-dependency` to imply one new option, add a subtype that has an options table for easier extensibility. (Thanks to Sam for pointing out that I shouldn't make this mistake again.)
This commit is contained in:
parent
805cd95049
commit
ece9126656
|
@ -560,16 +560,16 @@ logger named @racket['cm-accomplice]. The message data is a
|
|||
the first field's value is @racket[file] and the second field's value
|
||||
is @racket[#f] (to indicate a non-module dependency). If the
|
||||
@racket[indirect?] argument is true, the data is more specifically an
|
||||
instance of a @racketidfont{file-dependency/indirect} prefab structure
|
||||
type that is a subtype of @racketidfont{file-dependency} with no new
|
||||
fields.
|
||||
instance of a @racketidfont{file-dependency/options} prefab structure
|
||||
type that is a subtype of @racketidfont{file-dependency} with one extra
|
||||
field: a hash table mapping @racket['indirect] to @racket[#t].
|
||||
|
||||
A compilation manager implemented by @racketmodname[compiler/cm] looks
|
||||
for such messages to register an external dependency. In response, the
|
||||
compilation manager records (in a @filepath{.dep} file) the path as
|
||||
contributing to the implementation of the module currently being
|
||||
compiled. Afterward, if the registered file is modified, the
|
||||
compilation manager will know to recompile the module. An ``indirect''
|
||||
compilation manager will know to recompile the module. An indirect
|
||||
dependency has no effect on recompilation, but it can signal to other
|
||||
tools, such as a package-dependency checker, that the dependency is
|
||||
indirect (and should not imply a direct package dependency).
|
||||
|
|
|
@ -16,5 +16,6 @@
|
|||
'cm-accomplice
|
||||
(format "file dependency: ~s" f)
|
||||
(if indirect?
|
||||
`#s((file-dependency/indirect file-dependency 2) ,f ,module?)
|
||||
`#s((file-dependency/options file-dependency 2) ,f ,module?
|
||||
#hasheq((indirect . #t)))
|
||||
`#s(file-dependency ,f ,module?))))
|
||||
|
|
|
@ -317,7 +317,7 @@
|
|||
(define-struct ext-reader-guard (proc top)
|
||||
#:property prop:procedure (struct-field-index proc))
|
||||
(define-struct file-dependency (path module?) #:prefab)
|
||||
(define-struct (file-dependency/indirect file-dependency) () #:prefab)
|
||||
(define-struct (file-dependency/options file-dependency) (table) #:prefab)
|
||||
|
||||
(define (compile-zo* mode roots path src-sha1 read-src-syntax zo-name up-to-date collection-cache)
|
||||
;; The `path' argument has been converted to .rkt or .ss form,
|
||||
|
@ -398,7 +398,10 @@
|
|||
(path? (file-dependency-path (vector-ref l 2))))
|
||||
(external-dep! (file-dependency-path (vector-ref l 2))
|
||||
(file-dependency-module? (vector-ref l 2))
|
||||
(file-dependency/indirect? (vector-ref l 2))))
|
||||
(and (file-dependency/options? (vector-ref l 2))
|
||||
(hash-ref (file-dependency/options-table (vector-ref l 2))
|
||||
'indirect
|
||||
#f))))
|
||||
(loop))))
|
||||
|
||||
;; Write the code and dependencies:
|
||||
|
|
Loading…
Reference in New Issue
Block a user