From: Julien Lepiller <julien@lepiller.eu>
To: 43639@debbugs.gnu.org
Subject: [bug#43639] [PATCH 02/15] gnu: Add java-antlr4-runtime.
Date: Sun, 27 Sep 2020 00:18:11 +0200 [thread overview]
Message-ID: <20200926221824.20925-2-julien@lepiller.eu> (raw)
In-Reply-To: <20200926221824.20925-1-julien@lepiller.eu>
* gnu/packages/java.scm (java-antlr4-runtime): New variable.
* gnu/packages/patches/java-antlr4-Add-standalone-generator.patch: New
file.
* gnu/packages/patches/java-antlr4-fix-code-too-large.java: New file.
* gnu/local.mk (dist_patch_DATA): Add them.
---
gnu/local.mk | 2 +
gnu/packages/java.scm | 34 +++++++
...java-antlr4-Add-standalone-generator.patch | 52 +++++++++++
.../java-antlr4-fix-code-too-large.java | 90 +++++++++++++++++++
4 files changed, 178 insertions(+)
create mode 100644 gnu/packages/patches/java-antlr4-Add-standalone-generator.patch
create mode 100644 gnu/packages/patches/java-antlr4-fix-code-too-large.java
diff --git a/gnu/local.mk b/gnu/local.mk
index ba94adfe72..8e2f1976bf 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1159,6 +1159,8 @@ dist_patch_DATA = \
%D%/packages/patches/jamvm-2.0.0-aarch64-support.patch \
%D%/packages/patches/jamvm-2.0.0-disable-branch-patching.patch \
%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-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 ad8011fbd8..0fd0d5e29f 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -8199,6 +8199,40 @@ This is possible because TreeLayout separates the layout of a tree from the
actual rendering.")
(license license:bsd-3)))
+(define-public java-antlr4-runtime
+ (package
+ (name "java-antlr4-runtime")
+ (version "4.8")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/antlr/antlr4")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1qal3add26qxskm85nk7r758arladn5rcyjinmhlhznmpbbv9j8m"))
+ (patches
+ (search-patches "java-antlr4-Add-standalone-generator.patch"
+ "java-antlr4-fix-code-too-large.java"))))
+ (build-system ant-build-system)
+ (arguments
+ `(#:jar-name "java-antlr4-runtime.jar"
+ #:source-dir "runtime/Java/src/org"
+ #:tests? #f; tests depend on java-antlr4 itself
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'copy-resources
+ (lambda _
+ (copy-recursively "runtime/Java/src/main/dot"
+ "build/classes")
+ #t)))))
+ (home-page "https://antlr.org")
+ (synopsis "ANTLR runtime library")
+ (description "This package contains the runtime library used with generated
+sources by ANTLR.")
+ (license license:bsd-3)))
+
(define-public java-commons-cli-1.2
;; This is a bootstrap dependency for Maven2.
(package
diff --git a/gnu/packages/patches/java-antlr4-Add-standalone-generator.patch b/gnu/packages/patches/java-antlr4-Add-standalone-generator.patch
new file mode 100644
index 0000000000..75b6dce39f
--- /dev/null
+++ b/gnu/packages/patches/java-antlr4-Add-standalone-generator.patch
@@ -0,0 +1,52 @@
+From 3b43b79da15be994348f13035474925ba592fe1f Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Fri, 15 Sep 2017 10:06:42 +0200
+Subject: [PATCH] Add standalone template generator
+
+---
+ tool/src/org/antlr/v4/unicode/UnicodeRenderer.java | 33 ++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+ create mode 100644 tool/src/org/antlr/v4/unicode/UnicodeRenderer.java
+
+diff --git a/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java b/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java
+new file mode 100644
+index 0000000..9e53213
+--- /dev/null
++++ b/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java
+@@ -0,0 +1,33 @@
++package org.antlr.v4.unicode;
++
++import org.stringtemplate.v4.*;
++import org.stringtemplate.v4.misc.ErrorBuffer;
++import org.antlr.v4.unicode.UnicodeDataTemplateController;
++
++import java.io.File;
++import java.io.FileWriter;
++import java.io.IOException;
++import java.util.Map;
++import java.util.Map.Entry;
++
++public class UnicodeRenderer extends UnicodeDataTemplateController {
++ public static void main(String[] arg)
++ throws IOException {
++ String inputdir = arg[0];
++ String input = arg[1];
++ String output = arg[2];
++
++ FileWriter fileWriter = new FileWriter(new File(output));
++ ErrorBuffer listener = new ErrorBuffer();
++
++ STGroupDir group = new STGroupDir(inputdir);
++ ST st = group.getInstanceOf(input);
++
++ for(Entry<String, Object> entry : getProperties().entrySet())
++ st.add(entry.getKey(), entry.getValue());
++
++ st.write(new AutoIndentWriter(fileWriter), listener);
++ fileWriter.flush();
++ fileWriter.close();
++ }
++}
+--
+2.13.5
+
diff --git a/gnu/packages/patches/java-antlr4-fix-code-too-large.java b/gnu/packages/patches/java-antlr4-fix-code-too-large.java
new file mode 100644
index 0000000000..9e9f92349d
--- /dev/null
+++ b/gnu/packages/patches/java-antlr4-fix-code-too-large.java
@@ -0,0 +1,90 @@
+From d22db2048534bdf3d9615117291f9d86564ff10d Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sat, 19 Sep 2020 21:05:48 +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 | 17 ++++++++++++++---
+ .../unicode/UnicodeDataTemplateController.java | 18 ++++++++++--------
+ 2 files changed, 24 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 0f22c73..3573873 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;
+@@ -15,7 +15,7 @@ import org.antlr.v4.runtime.misc.Interval;
+ */
+ public abstract class UnicodeData {
+ private static final Map\<String, IntervalSet\> propertyCodePointRanges = new HashMap\<\>(<length(propertyCodePointRanges)>);
+- private static final Map\<String, String\> propertyAliases = new HashMap\<\>(<length(propertyAliases)>);
++ private static final Map\<String, String\> propertyAliases = new HashMap\<\>(<length(propertyAliasesA)> + <length(propertyAliasesB)>);
+
+ // Work around Java 64k bytecode method limit by splitting up static
+ // initialization into one method per Unicode property
+@@ -30,9 +30,20 @@ static private void addProperty<i>() {
+ propertyCodePointRanges.put("<k>".toLowerCase(Locale.US), codePointRanges);
+ \}}; separator="\n\n">
+
++ // Property aliases
++ static private void addPropertyAliases1() {
++ <propertyAliasesA.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesA.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++ }
++
++ // Property aliases
++ static private void addPropertyAliases2() {
++ <propertyAliasesB.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesB.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++ }
++
+ // Property aliases
+ static private void addPropertyAliases() {
+- <propertyAliases.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliases.(k)>".toLowerCase(Locale.US)); }; separator="\n">
++ addPropertyAliases1();
++ addPropertyAliases2();
+ }
+
+ // 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 da244a3..dc591cb 100644
+--- a/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
++++ b/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
+@@ -78,17 +78,19 @@ public abstract class UnicodeDataTemplateController {
+ addTR35ExtendedPictographicPropertyCodesToCodePointRanges(propertyCodePointRanges);
+ addEmojiPresentationPropertyCodesToCodePointRanges(propertyCodePointRanges);
+
+- Map<String, String> propertyAliases = new LinkedHashMap<>();
+- addUnicodeCategoryCodesToNames(propertyAliases);
+- addUnicodeBinaryPropertyCodesToNames(propertyAliases);
+- addUnicodeScriptCodesToNames(propertyAliases);
+- addUnicodeBlocksToNames(propertyAliases);
+- addUnicodeIntPropertyCodesToNames(propertyAliases);
+- propertyAliases.put("EP", "Extended_Pictographic");
++ Map<String, String> propertyAliases1 = new LinkedHashMap<>();
++ Map<String, String> propertyAliases2 = new LinkedHashMap<>();
++ addUnicodeCategoryCodesToNames(propertyAliases1);
++ addUnicodeBinaryPropertyCodesToNames(propertyAliases1);
++ addUnicodeScriptCodesToNames(propertyAliases1);
++ addUnicodeBlocksToNames(propertyAliases2);
++ addUnicodeIntPropertyCodesToNames(propertyAliases2);
++ propertyAliases2.put("EP", "Extended_Pictographic");
+
+ Map<String, Object> properties = new LinkedHashMap<>();
+ properties.put("propertyCodePointRanges", propertyCodePointRanges);
+- properties.put("propertyAliases", propertyAliases);
++ properties.put("propertyAliasesA", propertyAliases1);
++ properties.put("propertyAliasesB", propertyAliases2);
+ return properties;
+ }
+
+--
+2.28.0
+
--
2.28.0
next prev parent reply other threads:[~2020-09-26 22:19 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 ` Julien Lepiller [this message]
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 ` [bug#43639] [PATCH 12/15] gnu: Add java-tunnelvisionlabs-antlr4-runtime-annotations Julien Lepiller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200926221824.20925-2-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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.