unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: 43639@debbugs.gnu.org
Subject: [bug#43639] [PATCH 12/15] gnu: Add java-tunnelvisionlabs-antlr4-runtime-annotations.
Date: Sun, 27 Sep 2020 00:18:21 +0200	[thread overview]
Message-ID: <20200926221824.20925-12-julien@lepiller.eu> (raw)
In-Reply-To: <20200926221824.20925-1-julien@lepiller.eu>

* gnu/packages/java.scm
(java-tunnelvisionlabs-antlr4-runtime-annotations): New variable.
* gnu/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         | 38 ++++++++
 ...unnelvisionlabs-antlr-code-too-large.patch | 87 +++++++++++++++++++
 3 files changed, 126 insertions(+)
 create mode 100644 gnu/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8e2f1976bf..01a825721d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1161,6 +1161,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/jamvm-2.0.0-opcode-guard.patch		\
   %D%/packages/patches/java-antlr4-Add-standalone-generator.patch	\
   %D%/packages/patches/java-antlr4-fix-code-too-large.java	\
+  %D%/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch	\
   %D%/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch	\
   %D%/packages/patches/java-commons-collections-fix-java8.patch \
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 198a06c292..73a5fbd693 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -8520,6 +8520,44 @@ parse trees.")))
                (list name package))))
         (package-inputs antlr4)))))
 
+(define-public java-tunnelvisionlabs-antlr4-runtime-annotations
+  (package
+    (inherit java-antlr4-runtime)
+    (name "java-tunnelvisionlabs-antlr4-runtime-annotations")
+    (version "4.7.4")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/tunnelvisionlabs/antlr4")
+                     (commit (string-append version "-opt"))))
+              (file-name (git-file-name "java-tunnelvisionlabs-antlr4" version))
+              (sha256
+               (base32
+                "1mf2lvvsszpialsk23ma83pwp50nd32lrbjpa847zlm5gmranbr8"))
+              (patches
+                (search-patches "java-antlr4-Add-standalone-generator.patch"
+                                "java-tunnelvisionlabs-antlr-code-too-large.patch"))))
+    (arguments
+     `(#:jar-name "java-antlr4-runtime-annotations.jar"
+       #:source-dir "runtime/JavaAnnotations/src"
+       #:tests? #f; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'copy-resources
+           (lambda _
+             (copy-recursively "runtime/JavaAnnotations/resources"
+                               "build/classes")
+             #t))
+         (add-after 'copy-resources 'rebuild-jar
+           (lambda _
+             (invoke "ant" "jar")
+             #t)))))
+    (inputs '())
+    (native-inputs '())
+    (synopsis "Annotations for ANTLR's runtime library")
+    (description "This package contains annotations used during the build of
+the runtime library of ANTLR.")))
+
 (define-public java-commons-cli-1.2
   ;; This is a bootstrap dependency for Maven2.
   (package
diff --git a/gnu/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch b/gnu/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch
new file mode 100644
index 0000000000..7bdf05eb9c
--- /dev/null
+++ b/gnu/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch
@@ -0,0 +1,87 @@
+From 56ae699a27eca52cc0bb14cbc9944b62136be52b Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sun, 20 Sep 2020 21:07:29 +0200
+Subject: [PATCH] Separate addPropertyAliases in two methods
+
+The quantity of data used to generate addPropertyAliases creates a big
+method, that is too big for java and results in "error: code too large".
+This is most likely due to added data between the expected version of
+icu and the actual version of icu in Guix.
+---
+ .../org/antlr/v4/tool/templates/unicodedata.st | 15 ++++++++++++---
+ .../unicode/UnicodeDataTemplateController.java | 18 ++++++++++--------
+ 2 files changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/tool/resources/org/antlr/v4/tool/templates/unicodedata.st b/tool/resources/org/antlr/v4/tool/templates/unicodedata.st
+index f5052b7..125d15b 100644
+--- a/tool/resources/org/antlr/v4/tool/templates/unicodedata.st
++++ b/tool/resources/org/antlr/v4/tool/templates/unicodedata.st
+@@ -1,4 +1,4 @@
+-unicodedata(propertyCodePointRanges, propertyAliases) ::= <<
++unicodedata(propertyCodePointRanges, propertyAliasesA, propertyAliasesB) ::= <<
+ package org.antlr.v4.unicode;
+ 
+ import java.util.Arrays;
+@@ -17,7 +17,7 @@ public enum UnicodeData {
+ 	;
+ 
+ 	private static final Map\<String, IntervalSet\> propertyCodePointRanges = new HashMap\<String, IntervalSet\>(<length(propertyCodePointRanges)>);
+-	private static final Map\<String, String\> propertyAliases = new HashMap\<String, String\>(<length(propertyAliases)>);
++	private static final Map\<String, String\> propertyAliases = new HashMap\<String, String\>(<length(propertyAliasesA)> + <length(propertyAliasesB)>);
+ 
+ 	// Work around Java 64k bytecode method limit by splitting up static
+ 	// initialization into one method per Unicode property
+@@ -33,8 +33,17 @@ static private void addProperty<i>() {
+ \}}; separator="\n\n">
+ 
+ 	// Property aliases
++	static private void addPropertyAliasesA() {
++		<propertyAliasesA.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesA.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++	}
++
++	static private void addPropertyAliasesB() {
++		<propertyAliasesB.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesB.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++	}
++
+ 	static private void addPropertyAliases() {
+-		<propertyAliases.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliases.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++        addPropertyAliasesA();
++        addPropertyAliasesB();
+ 	}
+ 
+ 	// Put it all together
+diff --git a/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java b/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
+index 570190c..692cee0 100644
+--- a/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
++++ b/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
+@@ -74,17 +74,19 @@ public abstract class UnicodeDataTemplateController {
+ 		addTR35ExtendedPictographicPropertyCodesToCodePointRanges(propertyCodePointRanges);
+ 		addEmojiPresentationPropertyCodesToCodePointRanges(propertyCodePointRanges);
+ 
+-		Map<String, String> propertyAliases = new LinkedHashMap<String, String>();
+-		addUnicodeCategoryCodesToNames(propertyAliases);
+-		addUnicodeBinaryPropertyCodesToNames(propertyAliases);
+-		addUnicodeScriptCodesToNames(propertyAliases);
+-		addUnicodeBlocksToNames(propertyAliases);
+-		addUnicodeIntPropertyCodesToNames(propertyAliases);
+-		propertyAliases.put("EP", "Extended_Pictographic");
++		Map<String, String> propertyAliasesA = new LinkedHashMap<String, String>();
++		Map<String, String> propertyAliasesB = new LinkedHashMap<String, String>();
++		addUnicodeCategoryCodesToNames(propertyAliasesA);
++		addUnicodeBinaryPropertyCodesToNames(propertyAliasesA);
++		addUnicodeScriptCodesToNames(propertyAliasesA);
++		addUnicodeBlocksToNames(propertyAliasesB);
++		addUnicodeIntPropertyCodesToNames(propertyAliasesB);
++		propertyAliasesB.put("EP", "Extended_Pictographic");
+ 
+ 		Map<String, Object> properties = new LinkedHashMap<String, Object>();
+ 		properties.put("propertyCodePointRanges", propertyCodePointRanges);
+-		properties.put("propertyAliases", propertyAliases);
++		properties.put("propertyAliasesA", propertyAliasesA);
++		properties.put("propertyAliasesB", propertyAliasesB);
+ 		return properties;
+ 	}
+ 
+-- 
+2.28.0
+
-- 
2.28.0





  parent reply	other threads:[~2020-09-26 22:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26 22:13 [bug#43639] [PATCH] [staging] gnu: groovy: Update to 3.0.5 Julien Lepiller
2020-09-26 22:18 ` [bug#43639] [PATCH 01/15] gnu: Add java-treelayout Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 02/15] gnu: Add java-antlr4-runtime Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 03/15] gnu: Add antlr4 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 04/15] gnu: ant/java8: Update to 1.10.8 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 05/15] gnu: ant: Update to 1.9.15 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 06/15] gnu: Add java-asm-8 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 07/15] gnu: Add java-asm-tree-8 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 08/15] gnu: Add java-asm-analysis-8 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 09/15] gnu: Add java-asm-util-8 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 10/15] gnu: Add java-antlr4-runtime-4.1 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 11/15] gnu: Add antlr4-4.1 Julien Lepiller
2020-09-26 22:18   ` Julien Lepiller [this message]
2020-09-26 22:18   ` [bug#43639] [PATCH 13/15] gnu: Add java-tunnelvisionlabs-antlr4-runtime Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 14/15] gnu: Add java-tunnelvisionlabs-antlr4 Julien Lepiller
2020-09-26 22:18   ` [bug#43639] [PATCH 15/15] gnu: Add java-javaparser Julien Lepiller
2020-09-26 22:23 ` [bug#43639] [PATCH 16/16] gnu: groovy: Update to 3.0.5 Julien Lepiller
2020-10-14  1:44 ` bug#43639: [PATCH] [staging] " Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200926221824.20925-12-julien@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=43639@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).