fix openjdk doc non determinism

Julien LepillerTue Jun 05 19:17:38+0200 2018

35fdb4e

fix openjdk doc non determinism

more/packages/java.scm

2626
  #:use-module (guix cvs-download)
2727
  #:use-module (guix hg-download)
2828
  #:use-module (guix utils)
29+
  #:use-module (guix build syscalls)
2930
  #:use-module (guix build-system ant)
3031
  #:use-module (guix build-system gnu)
3132
  #:use-module (guix build-system trivial)

28492850
                 (("@IgnoreJRERequirement") "")))
28502851
             #t)))))))
28512852
2853+
(define-public java-guava-25
2854+
  (package
2855+
    (inherit java-guava)
2856+
    (version "25.1")
2857+
    (source (origin
2858+
              (method url-fetch)
2859+
              (uri (string-append "https://github.com/google/guava/"
2860+
                                  "archive/v" version ".tar.gz"))
2861+
              (file-name (string-append "java-guava-" version ".tar.gz"))
2862+
              (sha256
2863+
               (base32
2864+
                "0jxwp8kfjcj4hyjwvnakk4d0yszp9np2l8c3hwz3ipxmwxk4dx7k"))))
2865+
    (arguments
2866+
     `(#:tests? #f                      ; no tests included
2867+
       #:jar-name "guava.jar"
2868+
       #:source-dir "guava/src"
2869+
       #:jdk ,openjdk9
2870+
       #:phases
2871+
       (modify-phases %standard-phases
2872+
         (add-after 'unpack 'trim-sources
2873+
           (lambda _
2874+
             (with-directory-excursion "guava/src/com/google/common"
2875+
               ;; Remove annotations to avoid extra dependencies:
2876+
               ;; * "j2objc" annotations are used when converting Java to
2877+
               ;;   Objective C;
2878+
               ;; * "errorprone" annotations catch common Java mistakes at
2879+
               ;;   compile time;
2880+
               ;; * "IgnoreJRERequirement" is used for Android.
2881+
               (substitute* (find-files "." "\\.java$")
2882+
                 (("import com.google.j2objc.*") "")
2883+
                 (("import com.google.errorprone.annotation.*") "")
2884+
                 (("import org.codehaus.mojo.animal_sniffer.*") "")
2885+
                 (("@CanIgnoreReturnValue") "")
2886+
                 (("@LazyInit") "")
2887+
                 (("@WeakOuter") "")
2888+
                 (("@RetainedWith") "")
2889+
                 (("@Weak") "")
2890+
                 (("@ForOverride") "")
2891+
                 (("@J2ObjCIncompatible") "")
2892+
                 (("@CompatibleWith\\(\"[A-Z]\"\\)") "")
2893+
                 (("@Immutable\\([^\\)]*\\)") "")
2894+
                 (("@Immutable") "")
2895+
                 (("@ReflectionSupport\\([^\\)]*\\)") "")
2896+
                 (("@DoNotMock.*") "")
2897+
                 (("@MustBeClosed") "")
2898+
                 (("@IgnoreJRERequirement") "")))
2899+
             #t)))))))
2900+
28522901
;(define-public java-xml-commons
28532902
;  (package
28542903
;    (name "java-xml-commons")

43084357
    (build-system gnu-build-system)
43094358
    (outputs '("out" "jdk" "doc"))
43104359
    (arguments
4311-
     `(#:tests? #f; TODO: requires jtreg
4360+
     `(#:tests? #f; require jtreg
4361+
       #:imported-modules
4362+
       (;(guix build gnu-build-system)
4363+
        (guix build syscalls)
4364+
        ,@%gnu-build-system-modules)
43124365
       #:phases
43134366
       (modify-phases %standard-phases
43144367
         (delete 'patch-source-shebangs)

43294382
             (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "yes")
43304383
             (invoke "make" "all")
43314384
             #t))
4332-
         (replace 'check
4333-
           (lambda _
4334-
             (invoke "make" "test")
4385+
         ;(replace 'check
4386+
         ;  (lambda _
4387+
         ;    (invoke "make" "test")
4388+
         ;    #t))
4389+
         ;; Some of the libraries in the lib/ folder link to libjvm.so.
4390+
         ;; But that shared object is located in the server/ folder, so it
4391+
         ;; cannot be found.  This phase creates a symbolic link in the
4392+
         ;; lib/ folder so that the other libraries can find it.
4393+
         ;;
4394+
         ;; See:
4395+
         ;; https://lists.gnu.org/archive/html/guix-devel/2017-10/msg00169.html
4396+
         ;;
4397+
         ;; FIXME: Find the bug in the build system, so that this symlink is
4398+
         ;; not needed.
4399+
         (add-after 'install 'install-libjvm
4400+
           (lambda* (#:key inputs outputs #:allow-other-keys)
4401+
             (let* ((lib-out (string-append (assoc-ref outputs "out")
4402+
                                             "/lib"))
4403+
                    (lib-jdk (string-append (assoc-ref outputs "jdk")
4404+
                                             "/lib")))
4405+
               (symlink (string-append lib-jdk "/server/libjvm.so")
4406+
                        (string-append lib-jdk "/libjvm.so"))
4407+
               (symlink (string-append lib-out "/server/libjvm.so")
4408+
                        (string-append lib-out "/libjvm.so")))
43354409
             #t))
43364410
         (replace 'install
43374411
           (lambda* (#:key outputs #:allow-other-keys)
43384412
             (let ((out (assoc-ref outputs "out"))
43394413
                   (jdk (assoc-ref outputs "jdk"))
43404414
                   (doc (assoc-ref outputs "doc"))
4341-
                   (images (car (find-files "build" ".*-server-release"))))
4415+
                   (images (car (find-files "build" ".*-server-release"
4416+
                                            #:directories? #t))))
43424417
               (copy-recursively (string-append images "/images/jdk") jdk)
43434418
               (copy-recursively (string-append images "/images/jre") out)
43444419
               (copy-recursively (string-append images "/images/docs") doc))
4420+
             #t))
4421+
         (add-after 'install 'strip-zip-timestamps
4422+
           (lambda* (#:key outputs #:allow-other-keys)
4423+
             (use-modules (guix build syscalls))
4424+
             (for-each (lambda (zip)
4425+
                         (let ((dir (mkdtemp! "zip-contents.XXXXXX")))
4426+
                           (with-directory-excursion dir
4427+
                             (invoke "unzip" zip))
4428+
                           (delete-file zip)
4429+
                           (for-each (lambda (file)
4430+
                                       (let ((s (lstat file)))
4431+
                                         (unless (eq? (stat:type s) 'symlink)
4432+
                                           (format #t "reset ~a~%" file)
4433+
                                           (utime file 0 0 0 0))))
4434+
                             (find-files dir #:directories? #t))
4435+
                           (with-directory-excursion dir
4436+
                             (let ((files (find-files "." ".*" #:directories? #t)))
4437+
                               (apply invoke "zip" "-0" "-X" zip files)))))
4438+
               (find-files (assoc-ref outputs "doc") ".*.zip$"))
43454439
             #t)))))
43464440
    (inputs
43474441
     `(("alsa-lib" ,alsa-lib)