[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26803: [PATCH 27/36] gnu: Add java-mockito-1.
From: |
Roel Janssen |
Subject: |
bug#26803: [PATCH 27/36] gnu: Add java-mockito-1. |
Date: |
Thu, 11 May 2017 10:13:49 +0200 |
User-agent: |
mu4e 0.9.18; emacs 25.2.1 |
Ricardo Wurmus writes:
> * gnu/packages/java.scm (java-mockito): New variable.
> ---
> gnu/packages/java.scm | 60
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 859f9934a..2cf2821c0 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -1977,6 +1977,66 @@ logging implementations. A library that uses the
> commons-logging API can be
> used with any logging implementation at runtime.")
> (license license:asl2.0)))
>
> +;; This is the last release of the 1.x series.
> +(define-public java-mockito-1
> + (package
> + (name "java-mockito")
> + (version "1.10.19")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "http://repo1.maven.org/maven2/"
> + "org/mockito/mockito-core/" version
> + "/mockito-core-" version "-sources.jar"))
> + (sha256
> + (base32
> + "0vmiwnwpf83g2q7kj1rislmja8fpvqkixjhawh7nxnygx6pq11kc"))))
> + (build-system ant-build-system)
> + (arguments
> + `(#:jar-name "mockito.jar"
> + #:tests? #f ; no tests included
> + ;; FIXME: patch-and-repack does not support jars, so we have to apply
> + ;; patches in build phases.
> + #:phases
> + (modify-phases %standard-phases
> + ;; Mockito fails to build with our verson of hamcrest without this
> + ;; definition.
> + (add-after 'unpack 'fix-hamcrest-build-error
> + (lambda _
> + (substitute*
> "src/org/mockito/internal/matchers/LocalizedMatcher.java"
> + (("public Matcher getActualMatcher\\(\\) .*" line)
> + (string-append "
> + public void describeMismatch(Object item, Description description) {
> + actualMatcher.describeMismatch(item, description);
> + }"
> + line)))
> + #t))
I understand this is easier and possibly less error-prone than creating
a patch file instead, but how far are we going with adding/removing code
inside the package recipes?
As far as the actual code addition goes, it is pretty straightforward:
It adds a function that hamcrest expects is available. Maybe add a
comment describing this? Then it's OK to me.
> + ;; Mockito bundles cglib. We have a cglib package, so let's use
> + ;; that instead.
> + (add-after 'unpack 'use-system-libraries
> + (lambda _
> + (with-directory-excursion
> "src/org/mockito/internal/creation/cglib"
> + (substitute* '("CGLIBHacker.java"
> + "CglibMockMaker.java"
> + "ClassImposterizer.java"
> + "DelegatingMockitoMethodProxy.java"
> + "MethodInterceptorFilter.java"
> + "MockitoNamingPolicy.java"
> + "SerializableMockitoMethodProxy.java"
> + "SerializableNoOp.java")
> + (("import org.mockito.cglib") "import net.sf.cglib")))
> + #t)))))
Nice unbundling!
> + (inputs
> + `(("java-junit" ,java-junit)
> + ("java-objenesis" ,java-objenesis)
> + ("java-cglib" ,java-cglib)
> + ("java-hamcrest-core" ,java-hamcrest-core)))
> + (home-page "http://mockito.org")
> + (synopsis "Mockito is a mock library for Java")
> + (description "Mockito is a mocking library for Java which lets you write
> +tests with a clean and simple API. It generates mocks using reflection, and
> +it records all mock invocations, including methods arguments.")
> + (license license:asl2.0)))
> +
> (define-public java-commons-cli
> (package
> (name "java-commons-cli")
Otherwise, LGTM!
Kind regards,
Roel Janssen
- bug#26803: [PATCH 21/36] gnu: Add java-jmock-1., (continued)
bug#26803: [PATCH 20/36] gnu: Add java-commons-daemon., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 28/36] gnu: Add java-httpcomponents-httpcore., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 29/36] gnu: Add java-httpcomponents-httpcore-nio., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 27/36] gnu: Add java-mockito-1., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 30/36] gnu: Add java-httpcomponents-httpcore-ab., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 33/36] gnu: Add java-commons-httpclient., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 32/36] gnu: Add java-httpcomponents-httpmime., Ricardo Wurmus, 2017/05/06
bug#26803: [PATCH 34/36] gnu: Add java-commons-net., Ricardo Wurmus, 2017/05/06