Subject: [PATCH 1/6] gnu: Add java-gson-2.8.6.

From: Mike Gerwitz <[email-masked]>
Date: Thu, 15 Apr 2021 21:23:42 -0400

This introduces a new package rather than upgrading the exist java-gson
package because it is built using OpenJDK11; I didn't want to have to
propagate that JDK dependency to the other packages that use it.

OpenJDK 11 was chosen becuase this dependency was introduced for
tla2tools.

* gnu/packages/java.scm (java-gson-2.8.6): 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 207f136513..62f684a74c 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <[email-masked]>
 ;;; Copyright © 2020 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2021 Vincent Legoll <[email-masked]>
+;;; Copyright © 2021 Mike Gerwitz <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -11724,6 +11725,37 @@ string to an equivalent Java object.  Gson can work with arbitrary Java objects
 including pre-existing objects that you do not have source-code of.")
     (license license:asl2.0)))
 
+;; This requires a different Java version than 2.8.2 above
+(define-public java-gson-2.8.6
+  (package
+    (inherit java-gson)
+    (name "java-gson")
+    (version "2.8.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/google/gson")
+                    (commit (string-append "gson-parent-" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0kk5p3vichdb0ph1lzknrcpbklgnmq455mngmjpxvvj29p3rgpk3"))))
+    (arguments
+     `(#:jar-name "gson.jar"
+       #:jdk ,openjdk11
+       #:source-dir "gson/src/main/java"
+       #:test-dir "gson/src/test"
+       #:phases
+       (modify-phases %standard-phases
+         ;; avoid Maven dependency
+         (add-before 'build 'fill-template
+           (lambda _
+             (with-directory-excursion "gson/src/main"
+               (copy-file "java-templates/com/google/gson/internal/GsonBuildConfig.java"
+                          "java/com/google/gson/internal/GsonBuildConfig.java")
+               (substitute* "java/com/google/gson/internal/GsonBuildConfig.java"
+                 (("\\$\\{project.version\\}") ,version))))))))))
+
 (define-public java-hawtjni
   (package
     (name "java-hawtjni")
-- 
Mike Gerwitz
Activist For User Freedom | GNU Maintainer & Volunteer
GPG: D6E9 B930 028A 6C38 F43B  2388 FEF6 3574 5E6F 6D05
https://mikegerwitz.com