3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

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.
This commit is contained in:
Julien Lepiller 2020-06-27 23:58:07 +02:00
parent e1ee5a75f3
commit b777e19437
No known key found for this signature in database
GPG key ID: 53D457B2D636EE82
2 changed files with 122 additions and 5 deletions

View file

@ -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)

View file

@ -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.")))