Maven dependencies loaded via ASDF defintions.

If a Maven3 installation can be found via FIND-MVN, ASDF definitions
of the form

   (:mvn "GROUP-ID/ARTIFACT-ID" :version "VERSION")

will be resolved at the ASDF system load time via the Maven Aether
resolution mechanism.

The log4j example wrapping now works.

N.b. this code seriously distorts some of the notions of ASDF which
really seems to depend on its components actually being resident on
the filesystem.  This needs to be adressed ("blessed") via
consultation with ASDF developers to ensure that the path we are
choosing is reasonably future-proof.
parent d7862cda
......@@ -3,12 +3,17 @@
(defsystem :abcl-asdf
:author "Mark Evenson"
:version "0.3.2"
:depends-on ("jss")
:version "0.4.0"
:depends-on (jss)
((:module packages :pathname ""
((:file "packages")))
(:module base :pathname ""
((:module base :pathname "" :components
((:file "abcl-asdf")
(:file "asdf-jar"
:depends-on ("abcl-asdf"))
(:file "maven-embedder"
:depends-on ("abcl-asdf" "asdf-jar"))))))
:depends-on ("abcl-asdf" "asdf-jar")))
:depends-on (packages))))
(defpackage #:abcl-asdf
(:use :cl)
(in-package :asdf)
(defclass iri (static-class)
(schema authority path query fragment))
(defclass iri (component)
((schema :initform nil)
(authority :initform nil)
(path :initform nil)
(query :initform nil)
(fragment :initform nil)))
(defclass mvn (iri) ())
(defclass mvn (iri)
((group-id :initform nil)
(artifact-id :initform nil)))
(defmethod find-component ((component iri) path)
;;; We interpret compilation to ensure that load-op will succeed
(defmethod perform ((op compile-op) (c mvn))
(let ((version (component-version c)))
(abcl-asdf:satisfy (component-name c)
:version (if version version :latest))))
(maybe-parse-mvn c)
(abcl-asdf:satisfy c))
(defmethod perform ((operation load-op) (c mvn))
(let ((version (component-version c)))
(maybe-parse-mvn c)
(abcl-asdf:satisfy (component-name c)
:version (if version version :latest))))))
(abcl-asdf:satisfy c)))))
;;; A Maven URI has the form "mvn:group-id/artifact-id/version"
;;; Currently we "stuff" the group-id/artifact-id into the 'name' and
;;; use the component 'version' for the version string.
(defun maybe-parse-mvn (component)
(with-slots (asdf::name asdf::group-id asdf::artifact-id
asdf::version asdf::schema asdf::path) component
(when (null asdf::artifact-id)
(let ((slash (search "/" name)))
(unless (and (integerp slash)
(error "Failed to construct a mvn reference from name '~A' and version '~A'"
asdf::name asdf::version))
(setf asdf::group-id (subseq asdf::name 0 slash)
asdf::artifact-id (subseq asdf::name (1+ slash))
asdf::schema "mvn"
asdf::path (format nil "~A/~A" asdf::name asdf::version))))))
(defmethod source-file-type ((component iri) (system system))
(defmethod component-relative-pathname ((component iri))
(in-package #:abcl-asdf)
(defun satisfy (name &key (version :latest))
(declare (ignore version))
(resolve-dependencies name))
(defun satisfy (mvn-component)
(with-slots (asdf::group-id asdf::artifact-id asdf::version) mvn-component
(resolve-dependencies asdf::group-id asdf::artifact-id asdf::version)))
(defun as-classpath (classpath)
"For a given MVN entry, return a list of loadable archives
(defpackage #:abcl-asdf
(:use :cl)
(require :jss)
(let ((logger (#"getLogger" 'Logger (symbol-name (gensym)))))
(#"log" logger "Kilroy wuz here."))
(let ((logger (#"getLogger" 'log4j.Logger (symbol-name (gensym)))))
(#"trace" logger "Kilroy wuz here."))
......@@ -3,8 +3,10 @@
(defsystem :log4j
((:mvn "log4j/log4j" :version "1.4.9")
(:module src :pathname "")
((:file "example"))))
((:module log4j.jar :components
((:mvn "log4j/log4j" :version "1.2.15")))
(:module source :pathname "" :components
((:file "example"))
:depends-on (log4j.jar))))
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