branch: javaimp_devel commit ed2f60f669ebb317fabef5b8b26386cdfacfcc33 Author: Filipp Gunbin <fgun...@fastmail.fm> Commit: Filipp Gunbin <fgun...@fastmail.fm>
Add 'javaimp-get-all-modules' --- packages/javaimp/javaimp.el | 46 +++++++++++++++++++++++++----------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/packages/javaimp/javaimp.el b/packages/javaimp/javaimp.el index f05629a..93d35f9 100644 --- a/packages/javaimp/javaimp.el +++ b/packages/javaimp/javaimp.el @@ -192,17 +192,16 @@ Only top-level classes are included.") (car (cddr el))) +;;; Data representation + ;; FIXME: use cl-defstruct! -;; A module is represented as a list: `(ARTIFACT POM-FILE SOURCE-DIR -;; TEST-SOURCE-DIR BUILD-DIR POM-FILE-MOD-TS PARENT PARENT-TS)'. +;; Module -(defsubst javaimp-make-mod (artifact pom-file source-dir - test-source-dir build-dir - pom-file-mod-ts jars-list - parent parent-ts) +(defsubst javaimp-make-mod (artifact pom-file source-dir test-source-dir build-dir + pom-file-mod-ts jars-list parent parent-ts final-name) (list artifact pom-file source-dir test-source-dir build-dir - pom-file-mod-ts jars-list parent parent-ts)) + pom-file-mod-ts jars-list parent parent-ts final-name)) (defsubst javaimp-get-mod-artifact (module) (nth 0 module)) @@ -241,8 +240,12 @@ Only top-level classes are included.") (defsubst javaimp-set-mod-parent-ts (module value) (setcar (nthcdr 8 module) value)) - -;; An artifact is represented as a list: (GROUP-ID ARTIFACT-ID VERSION). +(defsubst javaimp-get-mod-final-name (module) + (nth 9 module)) +(defsubst javaimp-set-mod-final-name (module value) + (setcar (nthcdr 9 module) value)) + +;; Artifact (defsubst javaimp-make-artifact (group-id artifact-id version) (list group-id artifact-id version)) @@ -266,8 +269,7 @@ Only top-level classes are included.") (apply #'javaimp-make-artifact (split-string artifact ":"))) - -;; A jar is represented as a list: `(JAR-PATH JAR-MOD-TS . CLASSES-LIST). +;; JAR (defsubst javaimp-make-jar (jar-path jar-mod-ts classes-list) (cons jar-path (cons jar-mod-ts classes-list))) @@ -392,6 +394,7 @@ with POM" (javaimp-extract-artifact-info (javaimp-xml-child 'parent project-elt)) nil ;parent-ts will be set later + (javaimp-xml-first-child javaimp-xml-child 'finalName 'build-elt) ))) project-elts)) @@ -604,6 +607,19 @@ directory" (equal (javaimp-get-mod-artifact mod) artifact)))) +;;; Some functions for use in other programs + +(defun javaimp-get-source-directories () + (apply #'seq-concatenate 'list + (mapcar (lambda (root) + (mapcar #'javaimp-get-mod-source-dir (cdr root))) + javaimp-maven-root-modules))) + +(defun javaimp-get-all-modules () + "Returns flat list of all child modules." + (append (mapcar #'cdr roots))) + + ;;; Adding and organizing imports ;;;###autoload @@ -767,14 +783,6 @@ argument is a list of additional classes to import." (javaimp-forget-all-visited-modules) (javaimp-invalidate-jar-classes-cache)) -;; Some functions which can be used in other modules - -(defun javaimp-get-source-directories () - (apply #'seq-concatenate 'list - (mapcar (lambda (root) - (mapcar #'javaimp-get-mod-source-dir (cdr root))) - javaimp-maven-root-modules))) - (provide 'javaimp) ;;; javaimp.el ends here