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

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

Fix all compilation warnings.

Still not expected that ABCL-ASDF works, esp. in the use of
RUN-PROGRAM.

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