]> asedeno.scripts.mit.edu Git - cl-protobufs.git/blobdiff - asdf-support.lisp
Don't kluge *asdf-verbose* on asdf3.
[cl-protobufs.git] / asdf-support.lisp
index 9087828f9ce16bb9bae2a542a5a330bcc5244f66..ad67db339f03358555147d5ba676162b6855f974 100644 (file)
@@ -67,7 +67,7 @@
     ;; Path was specified with ':proto-pathname'
     (subpathname (component-pathname (component-parent component))
                  (proto-relative-pathname component)
-                 :type (source-explicit-file-type component))
+                 :type (source-file-explicit-type component))
     ;; No ':proto-pathname', the path of the protobuf file
     ;; defaults to the component-pathname, with its automatic type "proto"
     (component-pathname component)))
 
 ;; Process 'import' lines
 (defun process-imports (schema imports)
-  "Imports all of the files given by 'imports'.
-   If the file is a .proto file, it first parses it and writes a .lisp file.
-   The .lisp file is the compiled and loaded."
+  "Processes the imports for a schema.
+   If the import is a symbol, see if that resolves to an existing schema.
+   If the import is a file (string, pathname), parse it as a .proto in the usual manner."
   (dolist (import imports)
-    (let* ((proto-file (do-process-import (pathname import)))
-           (imported   (find-schema proto-file)))
-      (when imported
-        (appendf (proto-imported-schemas schema) (list imported))))))
+    (let ((imported-schema (find-schema
+                            (etypecase import
+                              ((or string pathname)
+                               (do-process-import (pathname import)))
+                              (symbol import)))))
+      (if imported-schema
+        (appendf (proto-imported-schemas schema) (list imported-schema))
+        (error "Could not import ~S" import)))))
 
 (defun process-imports-from-file (imports-file)
   (when (probe-file imports-file)
 (defun do-process-import (import
                           &key (search-path *protobuf-search-path*)
                                (output-path *protobuf-output-path*))
-  (dolist (path search-path (error "Could not import ~S" import))
+  (dolist (path (or search-path
+                    ;; Fallback in case someone is playing with 'parse-schema' by hand
+                    (and (asdf::absolute-pathname-p import) (list (directory-namestring import))))
+           (error "Could not import ~S" import))
     (let* ((proto-file (asdf::merge-pathnames* import path))
            (lisp-file (if output-path
                         (asdf::lispize-pathname
            (imports-file (make-pathname :type "proto-imports"
                                         :defaults lisp-file))
            (fasl-file  (compile-file-pathname lisp-file))
-           (asdf:*asdf-verbose* nil)    ;for safe-file-write-date
+           #-asdf3 (asdf:*asdf-verbose* nil)    ;for safe-file-write-date
            (proto-date (asdf::safe-file-write-date proto-file))
            (lisp-date  (asdf::safe-file-write-date lisp-file))
            (fasl-date  (asdf::safe-file-write-date fasl-file))