- (let ((source (make-pathname :name (pathname-name (component-pathname component))
- :type "lisp"
- :defaults (first (output-files op component))))
- (output (first (output-files op component)))
- (*compile-file-warnings-behaviour* (operation-on-warnings op))
- (*compile-file-failure-behaviour* (operation-on-failure op)))
- (multiple-value-bind (output warnings-p failure-p)
- (apply #'compile-file* source
- :output-file output
- (compile-op-flags op))
- (when warnings-p
- (case (operation-on-warnings op)
- (:warn (warn "~@<COMPILE-FILE warned while performing ~A on ~A.~@:>" op component))
- (:error (error 'compile-warned
- :component component :operation op))
- (:ignore nil)))
- (when failure-p
- (case (operation-on-failure op)
- (:warn (warn "~@<COMPILE-FILE failed while performing ~A on ~A.~@:>" op component))
- (:error (error 'compile-failed
- :component component :operation op))
- (:ignore nil)))
- (unless output
- (error 'compile-error
- :component component :operation op)))))
+ (destructuring-bind (lisp-file imports-file) (input-files op component)
+ (destructuring-bind (fasl-file
+ &optional
+ #+clisp lib-file
+ #+(or ecl mkcl) object-file
+ #+asdf3 warnings-file)
+ (output-files op component)
+ (let* ((proto-file (protobuf-input-file component))
+ (paths (cons (directory-namestring proto-file)
+ (resolve-search-path component)))
+ (proto-impl:*protobuf-search-path* paths)
+ (proto-impl:*protobuf-output-path* fasl-file)
+ (*compile-file-warnings-behaviour* (operation-on-warnings op))
+ (*compile-file-failure-behaviour* (operation-on-failure op)))
+ (proto-impl:process-imports-from-file imports-file)
+ (multiple-value-bind (output warnings-p failure-p)
+ (apply #'compile-file* lisp-file
+ :output-file fasl-file
+ #+asdf3 #+asdf3
+ :warnings-file warnings-file
+ (append
+ #+clisp (list :lib-file lib-file)
+ #+(or ecl mkcl) (list :object-file object-file)
+ (compile-op-flags op)))
+ #+asdf3
+ (check-lisp-compile-results output warnings-p failure-p
+ "~/asdf-action::format-action/" (list (cons op component)))
+ #-asdf3
+ (progn
+ (when warnings-p
+ (case (operation-on-warnings op)
+ (:warn (warn "~@<COMPILE-FILE warned while performing ~A on ~A.~@:>" op component))
+ (:error (error 'compile-warned
+ :component component :operation op))
+ (:ignore nil)))
+ (when failure-p
+ (case (operation-on-failure op)
+ (:warn (warn "~@<COMPILE-FILE failed while performing ~A on ~A.~@:>" op component))
+ (:error (error 'compile-failed
+ :component component :operation op))
+ (:ignore nil)))
+ (unless output
+ (error 'compile-error
+ :component component :operation op))))))))
+
+(defmethod input-files ((op load-op) (component protobuf-file))
+ "The input files are the .fasl and .proto-imports files."
+ (declare (ignorable op))
+ (list (first (output-files (make-instance 'compile-op) component)) ;fasl
+ (second (output-files (make-instance 'proto-to-lisp) component)))) ;proto-imports
+
+(defmethod perform ((op load-op) (component protobuf-file))
+ (let* ((input (protobuf-input-file component))
+ (paths (cons (directory-namestring input) (resolve-search-path component)))
+ (proto-impl:*protobuf-search-path* paths)
+ (proto-impl:*protobuf-output-path* (first (input-files op component))))
+ (destructuring-bind (fasl proto-imports)
+ (input-files op component)
+ (proto-impl:process-imports-from-file proto-imports)
+ (let ((proto-impl:*protobuf-pathname* (protobuf-input-file component)))
+ (load fasl)))))