Changeset 13904


Ignore:
Timestamp:
04/01/12 20:39:17 (9 years ago)
Author:
Mark Evenson
Message:

abcl-asdf: refactor interface.

ENSURE-REMOTE-REPOSITORY now takes a keyword to specify the remote
repository to create. RESOLVE-DEPENDENCIES should now use this
mechanism to specify the remote repository.

The ASDF syntax of adding a :repository doesn't seem to be working.

Location:
trunk/abcl/contrib/abcl-asdf
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/contrib/abcl-asdf/abcl-asdf.lisp

    r13903 r13904  
    22;;;;
    33;;;; Done separate from asdf.lisp for stability.
     4(require :asdf)
    45(in-package :asdf)
    56
     
    1213
    1314(defclass mvn (iri)
    14   ((group-id :initform nil)
    15    (artifact-id :initform nil)
     15  ((group-id :initarg :group-id :initform nil)
     16   (artifact-id :initarg :artifact-id :initform nil)
    1617   (repository :initform "http://repo1.maven.org/maven2/") ;;; XXX unimplmented
    1718;; inherited from ASDF:COMPONENT ??? what are the CL semantics on overriding -- ME 2012-04-01
     
    2223  component)
    2324
     25
    2426;;; We intercept compilation to ensure that load-op will succeed
    2527(defmethod perform ((op compile-op) (c mvn))
    26   (ensure-parsed-mvn c)
    27   (abcl-asdf:resolve c))
     28  (abcl-asdf:resolve   
     29   (ensure-parsed-mvn c)))
    2830     
    2931(defmethod perform ((operation load-op) (c mvn))
    30   (ensure-parsed-mvn c)
    3132  (java:add-to-classpath
    3233   (abcl-asdf:as-classpath
    33     (abcl-asdf:resolve c))))
     34    (abcl-asdf:resolve
     35     (ensure-parsed-mvn c)))))
    3436
    3537;;; A Maven URI has the form "mvn:group-id/artifact-id/version"
     
    4547(defparameter *mvn-repositories* nil
    4648  "A list of all Maven repositories encountered in the lifetime of this instance of the implementation.")
     49
     50#+nil
     51(defmethod slot-missing ((class mvn) object slot-name operation &optional new-value)
     52  (setf (slot-value object slot-name)
     53        (if new-value
     54            new-value
     55            nil)))
    4756
    4857(defun ensure-parsed-mvn (component)
     
    7281        (pushnew repository *mvn-repositories*)
    7382        ;;; Always normalized path "on the way out" to contain group-id/artifact-id/version
    74         (setf path (format nil "~A/~A/~A" group-id artifact-id version))))))
     83        (setf path (format nil "~A/~A/~A" group-id artifact-id version))))
     84    component))
     85
     86(export `(mvn iri ensure-parsed-mvn
     87              group-id artifact-id version) 'asdf)
    7588
    7689(defmethod source-file-type ((component iri) (system system))
  • trunk/abcl/contrib/abcl-asdf/maven-embedder.lisp

    r13901 r13904  
    290290  (jss:new 'aether.repository.RemoteRepository id type url))
    291291
     292(defparameter *default-repository*
     293   "http://repo1.maven.org/maven2/")
     294
     295(defun add-repository (repository)
     296  (ensure-remote-repository :repository repository))
     297
    292298(defparameter *maven-remote-repository*  nil
    293299    "The remote repository used by the Maven Aether embedder.")
    294 (defun ensure-remote-repository ()
     300(defun ensure-remote-repository (&key repository *default-repository* repository-p)
    295301  (unless *init* (init))
    296   (unless *maven-remote-repository*
    297     (let ((r (make-remote-repository "central" "default" "http://repo1.maven.org/maven2/")))
     302  (unless (or repository-p
     303              *maven-remote-repository*)
     304    (let ((r (make-remote-repository "central" "default" repository)))
    298305      (when *maven-http-proxy*
    299306        (#"setProxy" r (make-proxy)))
     
    301308  *maven-remote-repository*)
    302309
    303 (defun resolve-dependencies (group-id artifact-id &optional (version "LATEST" versionp))
    304   "Dynamically resolve Maven dependencies for item with GROUP-ID and ARTIFACT-ID at VERSION.
     310(defun resolve-dependencies (group-id artifact-id
     311                             &optional  ;;; XXX Uggh.  Move to keywords when we get the moxie.
     312                             (version "LATEST" versionp)
     313                             (repository *maven-remote-repository* repository-p))
     314  "Dynamically resolve Maven dependencies for item with GROUP-ID and ARTIFACT-ID
     315optionally with a VERSION and a REPOSITORY.  Users of the function are advised
    305316
    306317All recursive dependencies will be visited before resolution is successful.
     
    322333         (collect-request (java:jnew (jss:find-java-class "CollectRequest"))))
    323334    (#"setRoot" collect-request dependency)
    324     (#"addRepository" collect-request (ensure-remote-repository))
     335    (#"addRepository" collect-request
     336                      (if repository-p
     337                          (ensure-remote-repository :repository repository)
     338                          (ensure-remote-repository)))
    325339    (let* ((node
    326340            (#"getRoot" (#"collectDependencies" (ensure-repository-system) (ensure-session) collect-request)))
     
    379393
    380394         
    381 (defmethod resolve ((string t))
     395(defmethod resolve ((string string))
    382396  "Resolve a colon separated GROUP-ID:ARTIFACT-ID[:VERSION] reference to a Maven artifact.
    383397
     
    390404  (let ((result (split-string string ":")))
    391405    (cond
    392       ((<= 2 (length result) 3)
     406      ((= (length result) 3)
     407       (resolve-dependencies (first result) (second result) (third result)))
     408      (t
    393409       (apply #'resolve-dependencies result)))))
    394410 
     411#+nil
     412(defmethod resolve ((mvn asdf:mvn))
     413  (with-slots (asdf::group-id asdf::artifact-id asdf::version)
     414      (asdf:ensure-parsed-mvn mvn)
     415    (resolve-dependencies (format nil "~A:~A:~A" asdf::group-id asdf::artifact-id asdf::version))))
Note: See TracChangeset for help on using the changeset viewer.