diff options
author | Julien Lepiller <julien@lepiller.eu> | 2020-06-27 23:58:07 +0200 |
---|---|---|
committer | Julien Lepiller <julien@lepiller.eu> | 2020-07-17 04:21:13 +0200 |
commit | b777e194376ec5ace990789e92251f89983da3e6 (patch) | |
tree | 3516de8dbe960f9e36da7c7a4e7f0e0906ea45cc | |
parent | e1ee5a75f3017315bb82f38b068bd4c003464b64 (diff) | |
download | guix-b777e194376ec5ace990789e92251f89983da3e6.tar.gz |
gnu: Add maven-surefire-common.
* gnu/packages/maven.scm (maven-surefire-common): New variable. * gnu/packages/java.scm (java-hawtjni, java-jansi-native, java-jansi): Install from pom file.
-rw-r--r-- | gnu/packages/java.scm | 39 | ||||
-rw-r--r-- | gnu/packages/maven.scm | 88 |
2 files changed, 122 insertions, 5 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index bc650968e0..f7d8c8c696 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -11079,7 +11079,11 @@ including pre-existing objects that you do not have source-code of.") (with-directory-excursion "hawtjni-generator/src/main/resources/" (install-file "libhawtjni.so" lib) (install-file "hawtjni.h" inc))) - #t))))) + #t)) + (add-before 'install 'install-parent + (install-pom-file "pom.xml")) + (replace 'install + (install-from-pom "hawtjni-runtime/pom.xml"))))) (inputs `(("java-commons-cli" ,java-commons-cli) ("java-asm" ,java-asm) @@ -11138,8 +11142,16 @@ that is part of the SWT Tools project.") (lambda* (#:key outputs #:allow-other-keys) (install-file "src/main/native-package/src/jansi.h" (string-append (assoc-ref outputs "out") "/include")) - #t))))) - (inputs + #t)) + (add-before 'install 'fix-pom + (lambda _ + ;; pom contains variables to complete name, but we don't support that + (substitute* "pom.xml" + (("\\$\\{platform\\}") "native")) + #t)) + (replace 'install + (install-from-pom "pom.xml"))))) + (propagated-inputs `(("java-hawtjni" ,java-hawtjni))) (home-page "https://fusesource.github.io/jansi/") (synopsis "Native library for jansi") @@ -11168,8 +11180,25 @@ console output.") (modify-phases %standard-phases (add-after 'check 'clear-term (lambda _ - (invoke "echo" "-e" "\\e[0m")))))) - (inputs + (invoke "echo" "-e" "\\e[0m"))) + (add-before 'install 'install-parent + (install-pom-file "pom.xml")) + (add-before 'install 'fix-pom + (lambda _ + ;; pom adds jansi native versions for different platforms, but we + ;; only need one, so use native instead + (substitute* "jansi/pom.xml" + (("windows32") "native") + (("windows64") "native") + (("osx") "native") + (("linux32") "native") + (("linux64") "native") + (("freebsd32") "native") + (("freebsd64") "native")) + #t)) + (replace 'install + (install-from-pom "jansi/pom.xml"))))) + (propagated-inputs `(("java-jansi-native" ,java-jansi-native))) (native-inputs `(("java-junit" ,java-junit) diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm index cbeda43b72..bfb5a51807 100644 --- a/gnu/packages/maven.scm +++ b/gnu/packages/maven.scm @@ -3495,3 +3495,91 @@ starting from JUnit 4."))) (synopsis "SureFire JUnit 4.0+ runner") (description "This package contains the runner for tests run on a forked JVM, using JUnit 4.0 or later."))) + +(define-public maven-surefire-common + (package + (inherit java-surefire-logger-api) + (name "maven-surefire-common") + (arguments + `(#:tests? #f; require mockito 2 + #:jar-name "maven-surefire-common.jar" + #:source-dir "maven-surefire-common/src/main/java" + #:phases + (modify-phases %standard-phases + (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-io" "java-commons-lang3" + "java-commons-compress" "maven-common-artifact-filters"))) + #t)) + (add-after 'build 'shade + (lambda* (#:key inputs #:allow-other-keys) + (let ((jarjar + (car (find-files (assoc-ref inputs "java-jarjar") ".*.jar$"))) + (injar "maven-surefire-common.jar") + (outjar "maven-surefire-common-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.common." + "org.apache.maven.shared.utils.@1~%")) + (format #t (string-append + "rule " + "org.apache.commons.io.** " + "org.apache.maven.surefire.shade.common." + "org.apache.commons.io.@1~%")) + (format #t (string-append + "rule " + "org.apache.commons.lang3.** " + "org.apache.maven.surefire.shade.common." + "org.apache.commons.lang3.@1~%")) + (format #t (string-append + "rule " + "org.apache.commons.compress.** " + "org.apache.maven.surefire.shade.common." + "org.apache.commons.compress.@1~%")))) + (invoke "java" "-jar" jarjar "process" "rules" injar outjar) + (delete-file injar) + (rename-file outjar injar))) + #t)) + (add-before 'install 'fix-pom + (lambda _ + (substitute* "maven-surefire-common/pom.xml" + (("maven-toolchain") "maven-core")) + #t)) + (replace 'install + (install-from-pom "maven-surefire-common/pom.xml"))))) + (propagated-inputs + `(("java-surefire-api" ,java-surefire-api) + ("java-surefire-extensions-api" ,java-surefire-extensions-api) + ("java-surefire-booter" ,java-surefire-booter) + ("maven-core" ,maven-core) + ("maven-plugin-annotations" ,maven-plugin-annotations) + ("maven-common-artifact-filters" ,maven-common-artifact-filters) + ("maven-artifact-transfer" ,maven-artifact-transfer) + ("java-plexus-java" ,java-plexus-java) + ("java-jansi" ,java-jansi) + ("java-commons-io" ,java-commons-io) + ("java-commons-lang3" ,java-commons-lang3) + ("java-commons-compress" ,java-commons-compress) + ("maven-shared-utils" ,maven-shared-utils-3.1) + ("java-surefire-parent-pom" ,java-surefire-parent-pom))) + (inputs + `(("java-jsr305" ,java-jsr305))) + (native-inputs + `(("unzip" ,unzip) + ("java-jarjar" ,java-jarjar))) + (synopsis "API used in Surefire and Failsafe MOJO") + (description "This package contains an API used in SureFire and Failsafe +MOJO."))) |