forked from Shirakumo/trial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource-generator.lisp
28 lines (20 loc) · 971 Bytes
/
resource-generator.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(in-package #:org.shirakumo.fraf.trial)
(defclass resource-generator ()
())
(defgeneric generate-resources (generator input &key &allow-other-keys))
(defgeneric resource (generator identifier))
(defmethod resource ((generator resource-generator) id) NIL)
(defmethod generate-resources ((generator symbol) input &rest args)
(apply #'generate-resources (make-instance generator) input args))
(defclass compiled-generator (resource-generator)
())
(defgeneric compile-resources (generator source &key))
(defmethod generate-resources :before ((generator compiled-generator) source &key compile)
(when compile
(compile-resources generator source)))
(defun recompile-needed-p (targets sources)
(let ((latest (loop for source in (enlist sources)
maximize (file-write-date source))))
(loop for target in (enlist targets)
thereis (or (null (probe-file target))
(< (file-write-date target) latest)))))