From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: [PATCH] Add junit. Date: Fri, 22 Apr 2016 16:16:25 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atbsy-0006RK-Os for guix-devel@gnu.org; Fri, 22 Apr 2016 10:16:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atbst-00025G-5L for guix-devel@gnu.org; Fri, 22 Apr 2016 10:16:44 -0400 Received: from venus.bbbm.mdc-berlin.de ([141.80.25.30]:52847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atbss-00025A-Jp for guix-devel@gnu.org; Fri, 22 Apr 2016 10:16:39 -0400 Received: from localhost (localhost [127.0.0.1]) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTP id F2E6338069F for ; Fri, 22 Apr 2016 16:16:36 +0200 (CEST) Received: from venus.bbbm.mdc-berlin.de ([127.0.0.1]) by localhost (venus.bbbm.mdc-berlin.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wXayRLY32usN for ; Fri, 22 Apr 2016 16:16:30 +0200 (CEST) Received: from HTCAONE.mdc-berlin.net (puck.citx.mdc-berlin.de [141.80.36.101]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTPS for ; Fri, 22 Apr 2016 16:16:30 +0200 (CEST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: "guix-devel@gnu.org" --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Guix, here=E2=80=99s a first batch of patches for Java libraries. Many Java pa= ckages depend on JUnit, so that=E2=80=99s where I started. =E2=80=9Chamcrest-co= re=E2=80=9D is just a small part of the whole hamcrest library, but it=E2=80=99s enough to buil= d JUnit. I tested JUnit previously with the log4j-api package, but I cannot submit this right now due to a bug(?) in Guile=E2=80=99s HTTP client, whi= ch makes it impossible for me to download the sources of its dependencies, such as this one: http://central.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi= .core-6.0.0-sources.jar ERROR: Bad Date header: Wed, 30 Jul 2014 3:47:42 GMT Once that=E2=80=99s fixed I=E2=80=99ll try to get more Java stuff package= d. ~~ Ricardo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0001-gnu-Add-java-qdox-1.12.patch" >From 78c6375f283f0bd1e58ea3036078aa589521d496 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 22 Apr 2016 16:07:38 +0200 Subject: [PATCH 1/4] gnu: Add java-qdox-1.12. * gnu/packages/java.scm (java-qdox-1.12): New variable. --- gnu/packages/java.scm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 02131f1..4005751 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -23,6 +23,7 @@ #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system gnu) + #:use-module (guix build-system ant) #:use-module (gnu packages) #:use-module (gnu packages attr) #:use-module (gnu packages autotools) @@ -829,3 +830,44 @@ build process and its dependencies, whereas Make uses Makefile format.") "jdk-drop" "langtools-drop" "hotspot-drop"))))))) (define-public icedtea icedtea-7) +;; java-hamcrest-core uses qdox version 1.12. We package this version instead +;; of the latest release. +(define-public java-qdox-1.12 + (package + (name "java-qdox") + (version "1.12.1") + (source (origin + (method url-fetch) + (uri (string-append "http://central.maven.org/maven2/" + "com/thoughtworks/qdox/qdox/" version + "/qdox-" version "-sources.jar")) + (sha256 + (base32 + "0hlfbqq2avf5s26wxkksqmkdyk6zp9ggqn37c468m96mjv0n9xfl")))) + (build-system ant-build-system) + (arguments + `(;; Tests require junit + #:tests? #f + #:jar-name "qdox.jar" + #:phases + (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key source #:allow-other-keys) + (mkdir "src") + (with-directory-excursion "src" + (zero? (system* "jar" "-xf" source))))) + ;; At this point we don't have junit, so we must remove the API + ;; tests. + (add-after 'unpack 'delete-tests + (lambda _ + (delete-file-recursively "src/com/thoughtworks/qdox/junit") + #t))))) + (home-page "http://qdox.codehaus.org/") + (synopsis "Parse definitions from Java source files") + (description + "QDox is a high speed, small footprint parser for extracting +class/interface/method definitions from source files complete with JavaDoc +@code{@tags}. It is designed to be used by active code generators or +documentation tools.") + (license license:asl2.0))) + -- 2.7.3 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0002-gnu-Add-java-jarjar.patch" >From e7cc2c93ad870fed42c6ad0a73ee22e2213a7db1 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 22 Apr 2016 16:08:14 +0200 Subject: [PATCH 2/4] gnu: Add java-jarjar. * gnu/packages/java.scm (java-jarjar): New variable. --- gnu/packages/java.scm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 4005751..6013626 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -871,3 +871,39 @@ class/interface/method definitions from source files complete with JavaDoc documentation tools.") (license license:asl2.0))) +(define-public java-jarjar + (package + (name "java-jarjar") + (version "1.4") + (source (origin + (method url-fetch) + (uri (string-append + "https://storage.googleapis.com/google-code-archive-downloads/v2/" + "code.google.com/jarjar/jarjar-src-" version ".zip")) + (sha256 + (base32 + "1v8irhni9cndcw1l1wxqgry013s2kpj0qqn57lj2ji28xjq8ndjl")))) + (build-system ant-build-system) + (arguments + `(;; Tests require junit, which ultimately depends on this package. + #:tests? #f + #:build-target "jar" + #:phases + (modify-phases %standard-phases + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((target (string-append (assoc-ref outputs "out") + "/share/java"))) + (install-file (string-append "dist/jarjar-" ,version ".jar") + target)) + #t))))) + (native-inputs + `(("unzip" ,unzip))) + (home-page "https://code.google.com/archive/p/jarjar/") + (synopsis "Repackage Java libraries") + (description + "Jar Jar Links is a utility that makes it easy to repackage Java +libraries and embed them into your own distribution. Jar Jar Links includes +an Ant task that extends the built-in @code{jar} task.") + (license license:asl2.0))) + -- 2.7.3 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0003-gnu-Add-java-hamcrest-core.patch" >From bca8447276390a1e38061e50be1c83ddc9545350 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 22 Apr 2016 16:08:41 +0200 Subject: [PATCH 3/4] gnu: Add java-hamcrest-core. * gnu/packages/java.scm (java-hamcrest-core): New variable. --- gnu/packages/java.scm | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 6013626..b73f239 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -907,3 +907,84 @@ libraries and embed them into your own distribution. Jar Jar Links includes an Ant task that extends the built-in @code{jar} task.") (license license:asl2.0))) +(define-public java-hamcrest-core + (package + (name "java-hamcrest-core") + (version "1.3") + (source (origin + (method url-fetch) + (uri (string-append "https://hamcrest.googlecode.com/files/" + "hamcrest-" version ".tgz")) + (sha256 + (base32 + "1hi0jv0zrgsf4l25aizxrgvxpsrmdklsmvw0jzwz7zv9s108whn6")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Delete bundled jar archives. + (for-each delete-file (find-files "." "\\.jar$")) + #t)))) + (build-system ant-build-system) + (arguments + `(#:tests? #f ; Tests require junit + #:make-flags (list (string-append "-Dversion=" ,version)) + #:build-target "core" + #:phases + (modify-phases %standard-phases + ;; Disable unit tests, because they require junit, which requires + ;; hamcrest-core. We also give a fixed value to the "Built-Date" + ;; attribute from the manifest for reproducibility. + (add-before 'configure 'patch-build.xml + (lambda _ + (substitute* "build.xml" + (("unit-test, ") "") + (("\\$\\{build.timestamp\\}") "guix")) + #t)) + ;; Java's "getMethods()" returns methods in an unpredictable order. + ;; To make the output of the generated code deterministic we must + ;; sort the array of methods. + (add-after 'unpack 'make-method-order-deterministic + (lambda _ + (substitute* "hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java" + (("import java\\.util\\.Iterator;" line) + (string-append line "\n" + "import java.util.Arrays; import java.util.Comparator;")) + (("allMethods = cls\\.getMethods\\(\\);" line) + (string-append "_" line + " +private Method[] getSortedMethods() { + Arrays.sort(_allMethods, new Comparator() { + @Override + public int compare(Method a, Method b) { + return a.toString().compareTo(b.toString()); + } + }); + return _allMethods; +} + +private Method[] allMethods = getSortedMethods();"))))) + (add-before 'build 'do-not-use-bundled-qdox + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "build.xml" + (("lib/generator/qdox-1.12.jar") + (string-append (assoc-ref inputs "java-qdox-1.12") + "/share/java/qdox.jar"))) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (install-file (string-append "build/hamcrest-core-" + ,version ".jar") + (string-append (assoc-ref outputs "out") + "/share/java"))))))) + (native-inputs + `(("java-qdox-1.12" ,java-qdox-1.12) + ("java-jarjar" ,java-jarjar))) + (home-page "http://hamcrest.org/") + (synopsis "Library of matchers for building test expressions") + (description + "This package provides a library of matcher objects (also known as +constraints or predicates) allowing @code{match} rules to be defined +declaratively, to be used in other frameworks. Typical scenarios include +testing frameworks, mocking libraries and UI validation rules.") + (license license:bsd-2))) + -- 2.7.3 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename="0004-gnu-Add-java-junit.patch" >From 119b0fd10aa47385c0fa9de99c901a204cb12d93 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 22 Apr 2016 16:09:17 +0200 Subject: [PATCH 4/4] gnu: Add java-junit. * gnu/packages/java.scm (java-junit): New variable. --- gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index b73f239..62d1d3f 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -988,3 +988,35 @@ declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules.") (license license:bsd-2))) +(define-public java-junit + (package + (name "java-junit") + (version "4.12") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/junit-team/junit/" + "archive/r" version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "090dn5v1vs0b3acyaqc0gjf6p8lmd2h24wfzsbq7sly6b214anws")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Delete bundled jar archives. + (delete-file-recursively "lib") + #t)))) + (build-system ant-build-system) + (arguments + `(#:tests? #f ; no tests + #:jar-name "junit.jar")) + (inputs + `(("java-hamcrest-core" ,java-hamcrest-core))) + (home-page "http://junit.org/") + (synopsis "Test framework for Java") + (description + "JUnit is a simple framework to write repeatable tests for Java projects. +JUnit provides assertions for testing expected results, test fixtures for +sharing common test data, and test runners for running tests.") + (license license:epl1.0))) + -- 2.7.3 --=-=-=--