emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/javaimp cfd11d6: * javaimp-maven.el: Extract javaimp--m


From: Filipp Gunbin
Subject: [elpa] externals/javaimp cfd11d6: * javaimp-maven.el: Extract javaimp--maven-call, support mvnw
Date: Thu, 4 Nov 2021 11:16:22 -0400 (EDT)

branch: externals/javaimp
commit cfd11d6db2a1fffcb5303d4a529df22b7a48d4fc
Author: Filipp Gunbin <fgunbin@fastmail.fm>
Commit: Filipp Gunbin <fgunbin@fastmail.fm>

    * javaimp-maven.el: Extract javaimp--maven-call, support mvnw
---
 javaimp-gradle.el |  4 ++--
 javaimp-maven.el  | 29 ++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/javaimp-gradle.el b/javaimp-gradle.el
index 3f4a120..60db6b3 100644
--- a/javaimp-gradle.el
+++ b/javaimp-gradle.el
@@ -128,11 +128,11 @@ descriptor."
          (local-gradlew (if (memq system-type '(cygwin windows-nt))
                             "gradlew.bat"
                           "gradlew"))
-         (gradlew (if (file-exists-p local-gradlew)
+         (program (if (file-exists-p local-gradlew)
                       local-gradlew
                     javaimp-gradle-program)))
     (javaimp--call-build-tool
-     gradlew
+     program
      handler
      "-q"
      "-I" (javaimp-cygpath-convert-maybe
diff --git a/javaimp-maven.el b/javaimp-maven.el
index cfbd14e..6a62956 100644
--- a/javaimp-maven.el
+++ b/javaimp-maven.el
@@ -29,10 +29,9 @@ reads project structure from the output and records which 
files
 belong to which modules and other module information.  Returns
 resulting module trees."
   (message "Visiting Maven POM file %s..." file)
-  (let* ((xml-tree (javaimp--call-build-tool
-                    javaimp-mvn-program
+  (let* ((xml-tree (javaimp--maven-call
+                    file
                     #'javaimp--maven-effective-pom-handler
-                    "-f" (javaimp-cygpath-convert-maybe file)
                     "help:effective-pom"))
         (projects (or (if (assq 'project xml-tree)
                            (list (assq 'project xml-tree))
@@ -189,16 +188,28 @@ are somewhat arbitrary."
         modules)))))
 
 (defun javaimp--maven-fetch-dep-jars (module _ids)
-  (javaimp--call-build-tool
-   javaimp-mvn-program
+  (javaimp--maven-call
+   ;; always invoke for this module's pom.xml
+   (javaimp-module-file module)
    (lambda ()
-     (goto-char (point-min))
      (search-forward "Dependencies classpath:")
      (forward-line 1)
      (javaimp--split-native-path (thing-at-point 'line)))
-   ;; always invoke for this module's pom.ml
-   "-f" (javaimp-cygpath-convert-maybe
-         (javaimp-module-file module))
    "dependency:build-classpath"))
 
+(defun javaimp--maven-call (file handler task)
+  (let* ((default-directory (file-name-directory file))
+         ;; Prefer local mvn wrapper
+         (local-mvnw (if (memq system-type '(cygwin windows-nt))
+                         "mvnw.cmd"
+                       "mvnw"))
+         (program (if (file-exists-p local-mvnw)
+                      local-mvnw
+                    javaimp-mvn-program)))
+    (javaimp--call-build-tool
+     program
+     handler
+     "-f" (javaimp-cygpath-convert-maybe file)
+     task)))
+
 (provide 'javaimp-maven)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]