Commit dd2b8fe4 authored by Rahul Jain's avatar Rahul Jain

wild-pathname-based modules for asdf.
(:wild-module "name" :pathname "foo/*.bar" :component-class 'bar-file), e.g.
parent dd2f963e
;;; -*- Lisp -*-
(asdf:defsystem wild-module
:version "0.0"
:components ((:wild-module "systems"
:pathname "*.asd")))
;;; -*- Lisp -*-
(load "../asdf")
(load "../wild-modules")
(setf asdf:*central-registry* '(*default-pathname-defaults*))
(asdf:oos 'asdf:load-op 'wild-module)
(in-package :asdf)
(defclass wild-module (module)
((component-class :accessor wild-module-component-class
:initform 'static-file :initarg :component-class)
(component-options :accessor wild-module-component-options
:initform nil :initarg :component-options)))
(defmethod (setf module-components) (new-value (module wild-module))
(declare (ignore new-value))
(sysdef-error "Cannot explicitly set wild-module ~A's components. Please ~
use a wild pathname instead." module))
(defmethod reinitialize-instance :after ((self wild-module) &key)
(let ((pathname (slot-value self 'relative-pathname)))
(and pathname
(not (wild-pathname-p pathname))
(sysdef-error "Wild-module ~A specified with non-wild pathname ~A."
self pathname))
(setf (slot-value self 'components)
(let* ((*default-pathname-defaults* (component-parent-pathname self))
(files (directory (merge-pathnames (component-relative-pathname self))))
(class (wild-module-component-class self))
(options (wild-module-component-options self)))
(mapcar (lambda (file)
(apply #'make-instance class
:name (file-namestring file)
;; XXX fails when wildcards are in
;; the directory or higher parts.
:pathname file
:parent self
options))
files)))))
(export '(wild-module))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment