Ignore:
Timestamp:
10/21/16 08:40:31 (7 years ago)
Author:
Mark Evenson
Message:

abcl-asdf: introspect Maven exectuable output to find libraries

Fixes usage of CFFI with Quicklisp under FreeBSD RELEASE-11.0.

File:
1 edited

Legend:

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

    r14845 r14905  
    119119   (list (make-pathname :defaults (merge-pathnames "../lib/" (find-mvn))
    120120                        :name nil :type nil)
     121         (ignore-errors
     122           (make-pathname :defaults (merge-pathnames "lib/" (mvn-home))
     123                          :name nil :type nil))
    121124         ;; library location for homebrew maven package on OS X
    122125         (make-pathname :defaults (merge-pathnames "../libexec/lib/" (find-mvn))
     
    163166      (error "Failed to determine Maven version: ~A." e))))
    164167
     168(defun mvn-home ()
     169  "If the Maven executable can be invoked, introspect the value
     170  reported as Maven home."
     171  (handler-case
     172      (multiple-value-bind (output error-output status)
     173          (uiop/run-program:run-program
     174           (format nil "~a --version" (truename (find-mvn)))
     175           :output :string
     176           :error-output :string)
     177        (unless (zerop status)
     178          (error "Failed to invoke Maven executable to introspect library locations: ~a." error-output))
     179        (let ((pattern (#"compile"
     180                        'regex.Pattern
     181                        "Maven home: (.+)$")))
     182          (with-input-from-string (s output)
     183            (do ((line (read-line s nil :eof)
     184                       (read-line s nil :eof)))
     185                ((or (not line) (eq line :eof)) nil)
     186              (let ((matcher (#"matcher" pattern line)))
     187                (when (#"find" matcher)
     188                  (return-from mvn-home (uiop/pathname:ensure-directory-pathname (#"group" matcher 1)))))))))
     189    (subprocess-error (e)
     190          (error "Failed to invoke Maven executable to introspect library locations: ~a." e))))
     191                       
    165192(defun ensure-mvn-version ()
    166193  "Return t if Maven version is 3.0.3 or greater."
     
    179206
    180207(defparameter *init* nil)
    181 
     208 
    182209(defun init (&optional &key (force nil))
    183210  "Run the initialization strategy to bootstrap a Maven dependency node.
Note: See TracChangeset for help on using the changeset viewer.