source: tags/1.5.0/contrib/abcl-asdf/asdf-mvn-module.lisp

Last change on this file was 15018, checked in by mevenson, 7 months ago

asdf-mvn-module: enable use of MVN-MODULE in ASDF definitions

The MVN-MODULE component allows finer control over Maven's
behavior when the transitive dependency graph contains conflicting
requirements.

(:mvn-module NAME

:dependencies DEPENDENCIES
:managed-dependencies MANAGED-DEPENDENCIES
:exclusions EXCLUSIONS)

where

DEPENDENCIES

A list of Maven artifacts in the form of colon or slash separated
components GROUPID:ARTIFACTID:VERSIONID.

MANAGED-DEPENDENCIES

A List of maven artifacts. If an dependency with same GROUPID and
ARTIFACTID are encountered, the version specified here overrides.

EXCLUSIONS

A list of partial maven artifacts groupid:artifactid. Dependencies
with same groupid and artifactid are exluded

An example of a MVN-MODULE ASDF declaration:

(defsystem foo

:defsystem-depends-on (asdf-mvn-module)
:components ((:mvn-module maven

:dependencies
("net.sourceforge.owlapi/pellet-cli-ignazio1977/2.4.0-ignazio1977"

"org.semanticweb.elk/elk-owlapi/0.4.3"
"net.sourceforge.owlapi/org.semanticweb.hermit/1.3.8.413"
"net.sourceforge.owlapi/owlapi-distribution/4.2.6"
"net.sourceforge.owlapi/owlexplanation/2.0.0"
"de.sciss/prefuse-core/1.0.1"
"de.sciss/prefuse-demos/1.0.1")

:managed-dependencies
("org.slf4j/slf4j-api/1.7.21"

"net.sourceforge.owlapi:owlapi-distribution:4.2.6")

:exclusions
("net.sourceforge.owlapi:owlapi-osgidistribution"

"edu.stanford.protege:org.protege.editor.owl")))

c.f. <https://mailman.common-lisp.net/pipermail/armedbear-devel/2017-April/003810.html>

Originally from <https://github.com/alanruttenberg/abcl/blob/stage/contrib/abcl-asdf/>.

File size: 1.4 KB
Line 
1(in-package :asdf)
2
3 ;; dependencies: a list of maven artifacts. color or slash separated
4 ;;   components groupid:artifactid:versionid
5
6 ;; managed-dependencies: a list of maven artifacts. If an dependency
7 ;;   with same groupid and artifactid are encountered, the version
8 ;;   specified here overrides.
9
10 ;; exclusions: a list of partial maven artifacts
11 ;;   groupid:artifactid. Dependencies with same groupid and artifactid are
12 ;;   exluded
13
14(defclass mvn-module (component) 
15  ((depends :initarg :dependencies :initform nil :accessor mvn-module-depends)
16   (excludes :initarg :exclusions :initform nil :accessor mvn-module-excludes)
17   (managed :initarg :managed-dependencies :initform nil :accessor mvn-module-managed)))
18
19(defmethod component-children ((c mvn-module))
20  nil)
21
22;;; ASDF problems: method is deprecated.  How do we define MVN-MODULE,
23;;; a subclass of ASDF:COMPONENT, which has no corresponding pathname?
24(defmethod source-file-type ((c mvn-module) (system parent-component))  nil)
25
26(defmethod perform ((op compile-op) (c mvn-module)))
27
28(defmethod perform ((op prepare-op) (c mvn-module)))
29
30(defmethod perform ((operation load-op) (c mvn-module))
31  (loop for path in (abcl-asdf:resolve-multiple-maven-dependencies
32                     (mvn-module-depends c) (mvn-module-managed c) (mvn-module-excludes c))
33  do
34     (unless (member path abcl-asdf::*added-to-classpath* :test 'equalp)
35       (jss::add-to-classpath  path))))
Note: See TracBrowser for help on using the repository browser.