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