source: trunk/abcl/contrib/abcl-asdf/abcl-asdf.lisp @ 13342

Last change on this file since 13342 was 13342, checked in by Mark Evenson, 10 years ago

Implementation strategy: use the Maven Ant tasks to drive via build.xml.

File size: 2.0 KB
Line 
1(defpackage #:abcl-asdf
2  (:use :cl)
3  (:export #:package))
4
5(defpackage #:mvn
6  (:use :cl)
7  (:export #:satisfy))
8
9(in-package :asdf-jar)
10
11(in-package :asdf)
12(defclass iri (static-class) ())
13
14(defclass mvn (iri) ())
15
16
17;;; We interpret compilation to ensure that load-op will succeed
18(defmethod perform ((operation compile-op) (component mvn))
19    (let ((version (component-version mvn)))
20      (mvn:satisfy (component-name mvn) 
21                   :version (if version version :latest))))
22
23(defmethod perform ((operation load-op) (component mvn))
24    (let ((version (component-version mvn)))
25      (java:add-to-classpath 
26       (as-classpath (mvn:satisfy (component-name mvn)
27                                  :version (if version version :latest))))))
28
29(defun decompose (iri) 
30  ;;; XXX test
31  `((:scheme :jvm)
32    (:authority :mvn)
33    (:host "log4j")
34    (:version "1.4.10")))
35
36(defun mvn:satisfy (name &key (version :latest))
37  (let ((build.xml (make-temp-file)))
38    (with-open-file (s build.xml :direction :output)
39      (write-string *ant-build-template* s ))
40    (run-program 
41     (format nil "ant -find ~A" build.xml))))
42
43#|
44
45Ant with Maven tasks would add the following
46
47  <artifact:dependencies pathId="abcl.dynamic.classpath">
48    <dependency groupId="junit" artifactId="junit" version="3.8.2"/>
49  </artifact:dependencies>
50|#
51
52(defvar *ant-build-template*
53  (format nil
54  "<?xml version='1.0' encoding='UTF-8'?>
55<project xmlns='antlib:org.apache.tools.ant'
56         name='abcl-mvn-~A' default='install'>
57
58  <artifact:dependencies pathId='abcl.dynamic.classpath'>
59    <dependency groupId='~A' artifactId='~A' version='~A'/>
60  </artifact:dependencies>
61
62  <path id='abcl.jar'>
63    <pathelement location='/export/home/evenson/work/abcl/dist/abcl.jar'/>
64  </path>
65
66  <target name='install'>
67    <java classname='org.armedbear.lisp.Main'>
68      <classpath refid='abcl.jar'>
69      <classpath refid='abcl.dynamic.classpath'>
70    </java>
71  </target>
72</project>
73" (symbol-name (gensym)) "junit" "junit" "3.8.2"))
74
75
76
77
78 
79
Note: See TracBrowser for help on using the repository browser.