guix-commits
[Top][All Lists]
Advanced

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

100/110: gnu: Add java-surefire-api.


From: guix-commits
Subject: 100/110: gnu: Add java-surefire-api.
Date: Thu, 16 Jul 2020 22:23:39 -0400 (EDT)

roptat pushed a commit to branch master
in repository guix.

commit ac8179a05ca76bbbf620d201f4e7428a92746f96
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Sat Jun 27 23:19:32 2020 +0200

    gnu: Add java-surefire-api.
    
    * gnu/packages/maven.scm (java-surefire-api): New variable.
---
 gnu/packages/maven.scm | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 1aa4eec..f2668cd 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -3185,3 +3185,69 @@ internal to the SureFire Logger API.  It is designed to 
have no dependency.")
            (install-pom-file "pom.xml")))))
     (propagated-inputs
      `(("maven-parent-pom" ,maven-parent-pom-33)))))
+
+(define-public java-surefire-api
+  (package
+    (inherit java-surefire-logger-api)
+    (name "java-surefire-api")
+    (arguments
+     `(#:tests? #f
+       #:jar-name "java-surefire-api.jar"
+       #:source-dir "surefire-api/src/main/java"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'copy-resources
+           (lambda _
+             (mkdir-p "build/classes")
+             (copy-recursively "surefire-api/src/main/resources" 
"build/classes")
+             #t))
+         (add-before 'build 'prepare-shade
+           (lambda* (#:key inputs #:allow-other-keys)
+             (mkdir-p "build/classes")
+             (with-directory-excursion "build/classes"
+               (for-each
+                 (lambda (input)
+                   (for-each
+                     (lambda (jar-file)
+                       (invoke "jar" "xf" jar-file)
+                       (delete-file-recursively "META-INF"))
+                     (find-files (assoc-ref inputs input) ".*.jar$")))
+                 '("maven-shared-utils" "java-commons-codec")))
+             #t))
+         (add-after 'build 'shade
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((jarjar
+                   (car (find-files (assoc-ref inputs "java-jarjar") 
".*.jar$")))
+                   (injar "java-surefire-api.jar")
+                   (outjar "java-surefire-api-shaded.jar"))
+               (with-directory-excursion "build/jar"
+                 (with-output-to-file "rules"
+                   (lambda _
+                     (format #t (string-append
+                                  "rule "
+                                  "org.apache.maven.shared.utils.** "
+                                  "org.apache.maven.surefire.shade.api."
+                                  "org.apache.maven.shared.utils.@1~%"))
+                     (format #t (string-append
+                                  "rule "
+                                  "org.apache.commons.codec.** "
+                                  "org.apache.maven.surefire.shade.api."
+                                  "org.apache.commons.codec.@1~%"))))
+                 (invoke "java" "-jar" jarjar "process" "rules" injar outjar)
+                 (delete-file injar)
+                 (rename-file outjar injar)))
+             #t))
+         (replace 'install
+           (install-from-pom "surefire-api/pom.xml")))))
+    (propagated-inputs
+     `(("java-surefire-logger-api" ,java-surefire-logger-api)
+       ("java-commons-codec" ,java-commons-codec)
+       ("java-surefire-parent-pom" ,java-surefire-parent-pom)
+       ("maven-shared-utils" ,maven-shared-utils-3.1)))
+    (inputs
+     `(("java-jsr305" ,java-jsr305)))
+    (native-inputs
+     `(("unzip" ,unzip)
+       ("java-jarjar" ,java-jarjar)))
+    (synopsis "Maven SureFire API")
+    (description "This package contains the API to use Maven SureFire.")))



reply via email to

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