Re: non existent input files patch
Marco Baringer <[email protected]>
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
the patch i just sent has some urresevant whitespace only changes, this one is a bit cleaner. Marco Baringer <[email protected]> writes: > More than once i have miss typed a filename in my asdf system files, > the following patch makes asdf do something when this happens (ie an > input file doesn't exist). without this patch all you get is a werid > error abut NIL not being a number (because the result of #'probe-file > is passed to mak in operation-done-p). > > comments would be appreciated. > > > > -- > -Marco > Ring the bells that still can ring. > Forget your perfect offering. > There is a crack in everything. > That's how the light gets in. > -Leonard Cohen -- -Marco Ring the bells that still can ring. Forget your perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen
asdf.diff
(text/x-patch, 3 KB)
Index: asdf.lisp
===================================================================
RCS file: /cvsroot/cclan/asdf/asdf.lisp,v
retrieving revision 1.68
diff -u -r1.68 asdf.lisp
--- asdf.lisp 19 Mar 2003 12:58:15 -0000 1.68
+++ asdf.lisp 5 Apr 2003 12:51:29 -0000
@@ -98,8 +98,21 @@
(parse-integer v :start (1+ dot)
:junk-allowed t)))))
-(defvar *compile-file-warnings-behaviour* :warn)
-(defvar *compile-file-failure-behaviour* #+sbcl :error #-sbcl :warn)
+(defvar *asdf-warnings-behaviour* :warn
+ "What to do when an operation warns.
+
+Can be one of:
+:IGNORE - do nothing
+:WARN - signal a warning
+:ERROR - signal an error
+")
+
+(defvar *asdf-failure-behaviour* :ignore
+ "What to da when on operation fails. Same values and semantics as
+ *asdf-warnings-behaviour*")
+
+(defvar *compile-file-warnings-behaviour* *asdf-warnings-behaviour*)
+(defvar *compile-file-failure-behaviour* *asdf-failure-behaviour*)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; utility stuff
@@ -430,7 +443,11 @@
:accessor operation-original-initargs)
(visited-nodes :initform nil :accessor operation-visited-nodes)
(visiting-nodes :initform nil :accessor operation-visiting-nodes)
- (parent :initform nil :initarg :parent :accessor operation-parent)))
+ (parent :initform nil :initarg :parent :accessor operation-parent)
+ (on-warnings :initarg :on-warnings :accessor operation-on-warnings
+ :initform *asdf-warnings-behaviour*)
+ (on-failure :initarg :on-failure :accessor operation-on-failure
+ :initform *asdf-failure-behaviour*)))
(defmethod print-object ((o operation) stream)
(print-unreadable-object (o stream :type t :identity t)
@@ -660,6 +677,19 @@
for operation ~A, component ~A~@:>")
(class-of operation) (class-of c)))
+(defmethod perform :before ((op operation) (c source-file))
+ (let ((file-name (component-pathname c)))
+ (if (probe-file file-name)
+ file-name
+ ;; input file doesn't exist
+ (ecase (operation-on-failure op)
+ (:ignore nil)
+ (:warn (warn "Inexistent file ~S listed as an input file for ~S."
+ file-name c))
+ (:error (error "Inexistent file ~S listed as an input file for ~S."
+ file-name c))))))
+
+
(defmethod perform ((operation operation) (c module))
nil)
@@ -671,10 +701,8 @@
(defclass compile-op (operation)
((proclamations :initarg :proclamations :accessor compile-op-proclamations :initform nil)
- (on-warnings :initarg :on-warnings :accessor operation-on-warnings
- :initform *compile-file-warnings-behaviour*)
- (on-failure :initarg :on-failure :accessor operation-on-failure
- :initform *compile-file-failure-behaviour*)))
+ (on-failure :initform *compile-file-failure-behaviour*)
+ (on-warnings :initform *compile-file-warnings-behaviour*)))
(defmethod perform :before ((operation compile-op) (c source-file))
(map nil #'ensure-directories-exist (output-files operation c)))