abcl-asdf.lisp 1.38 KB
Newer Older
1 2
(defpackage #:abcl-asdf
  (:use :cl)
3 4 5
  (:export 
   #:satisfy
   #:as-classpath
6

7
   #:resolve-artifact
8 9 10 11 12 13 14
   #:resolve-dependencies

   #:add-directory-jars-to-class-path
   #:need-to-add-directory-jar?
   
   #:*added-to-classpath*
   #:*inhibit-add-to-classpath*))
15 16

(in-package :asdf)
17 18
(defclass iri (static-class) 
  (schema authority path query fragment))
19 20 21 22

(defclass mvn (iri) ())

;;; We interpret compilation to ensure that load-op will succeed
23 24
(defmethod perform ((op compile-op) (c mvn))
    (let ((version (component-version c)))
25 26
      (abcl-asdf:satisfy (component-name c) 
                         :version (if version version :latest))))
27

28 29
(defmethod perform ((operation load-op) (c mvn))
    (let ((version (component-version c)))
30
      (java:add-to-classpath 
31 32
       (abcl-asdf:as-classpath 
        (abcl-asdf:satisfy (component-name c)
33 34
                     :version (if version version :latest))))))

35
(in-package #:abcl-asdf)
36

37
(defun satisfy (name &key (version :latest))
38 39 40 41
  (declare (ignore version))
  (resolve-dependencies name))
           
(defun as-classpath (classpath)
42 43
  "For a given MVN entry, return a list of loadable archives 
 suitable for addition to the classpath."
44
  (split-string classpath ":"))
45

46 47 48 49 50
(defun split-string (string split-char)
  (loop :for i = 0 :then (1+ j)
     :as j = (position split-char string :test #'string-equal :start i)
     :collect (subseq string i j)
     :while j))