summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-06-27 16:08:22 +0200
committerJulien Lepiller <julien@lepiller.eu>2020-07-17 04:16:33 +0200
commitb909d584445fc41096b76a570fa9a0b6e1875177 (patch)
tree92c3bfad2a471490dc29c42c52324a3ecf24e737 /gnu
parent756e976e56e7eefee5a829823a70df493dfd8773 (diff)
downloadguix-b909d584445fc41096b76a570fa9a0b6e1875177.tar.gz
gnu: Add maven-3.0-model.
* gnu/packages/maven.scm (maven-3.0-model): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/maven.scm52
1 files changed, 52 insertions, 0 deletions
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index eb2a0b34d9..3a3e7cf8e0 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -2098,3 +2098,55 @@ reporting or the build process.")))
               `("maven-pom" ,maven-3.0-pom)
               input))
         (package-propagated-inputs maven-artifact)))))
+
+(define-public maven-3.0-model
+  (package
+    (inherit maven-model)
+    (version (package-version maven-3.0-pom))
+    (source (package-source maven-3.0-pom))
+    (propagated-inputs
+      (map
+        (lambda (input)
+          (if (equal? (car input) "maven-pom")
+              `("maven-pom" ,maven-3.0-pom)
+              input))
+        (package-propagated-inputs maven-artifact)))
+    (arguments
+     `(#:jar-name "maven-model.jar"
+       #:source-dir "maven-model/src/main/java"
+       #:test-dir "maven-model/src/test"
+       #:modules
+       ((guix build ant-build-system)
+        (guix build java-utils)
+        (guix build syscalls)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'use-newer-model
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The model has almost not changed, but the newer version is
+             ;; needed to prevent an error in the newer modello we have
+             (let ((source (assoc-ref inputs "maven-source"))
+                   (dir (mkdtemp! "maven-source-XXXXXXXX")))
+               (with-directory-excursion dir
+                 (invoke "tar" "xf" source)
+                 (copy-file (car (find-files "." "maven.mdo"))
+                            "../maven-model/src/main/mdo/maven.mdo")))
+             #t))
+         (add-before 'build 'generate-models
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define (modello-single-mode file version mode)
+               (invoke "java" "org.codehaus.modello.ModelloCli"
+                       file mode "maven-model/src/main/java" version
+                       "false" "true" "UTF-8"))
+             (let ((file "maven-model/src/main/mdo/maven.mdo"))
+               (modello-single-mode file "4.0.0" "java")
+               (modello-single-mode file "4.0.0" "xpp3-reader")
+               (modello-single-mode file "4.0.0" "xpp3-writer")
+               (modello-single-mode file "4.0.0" "xpp3-extended-reader"))
+             #t))
+         (replace 'install
+           (install-from-pom "maven-model/pom.xml")))))
+    (inputs
+      `(("maven-source" ,(package-source maven-pom))
+        ,@(package-inputs maven-model)))))