commit:     ee4ae9f475412915941b4c4ed4a479bf528cc5b0
Author:     Yuan Liao <liaoyuan <AT> gmail <DOT> com>
AuthorDate: Thu Jan 20 02:51:31 2022 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 09:30:03 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee4ae9f4

dev-java/stringtemplate: Add 4.3.1, resolve antlr-3.5 circular dep

stringtemplate-4 requires antlr-3.5 only during the build time to
generate *.java files from src/org/stringtemplate/v4/compiler/*.g files.
This causes the circular dependency issue described by the linked bug
since antlr-3.5 depends on stringtemplate-4.  Fortunately, the sources
JAR for stringtemplate 4.3.1 from Maven Central contains those generated
*.java files (presumably pre-generated by the upstream), so if the Java
sources from that JAR are used, the build-time dependency on antlr-3.5
can be eliminated, finally resolving this chicken-or-egg problem.

Bug: https://bugs.gentoo.org/742554
Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com>
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 dev-java/stringtemplate/Manifest                   |  2 +
 ...mplate-4.3.1-BaseTest-javac-source-target.patch | 28 ++++++++
 .../stringtemplate/stringtemplate-4.3.1.ebuild     | 74 ++++++++++++++++++++++
 3 files changed, 104 insertions(+)

diff --git a/dev-java/stringtemplate/Manifest b/dev-java/stringtemplate/Manifest
index 7b192ce400f9..1466c75ff71b 100644
--- a/dev-java/stringtemplate/Manifest
+++ b/dev-java/stringtemplate/Manifest
@@ -1,3 +1,5 @@
+DIST ST4-4.3.1-sources.jar 198002 BLAKE2B 
d1bd78dac71800e342291920ba78ab39c9a43b1f3866e2afcb0e1d61d439592663a625efe2a5a215c6032469e7ebeeebb31267e1681536ca0cc524cc58781a3d
 SHA512 
bd06940b629ab0378afd6342b6f5beef002023387843cefd866ebe6ae8e94996edc3f21a0c70ed3570d3fcb7194bf354d0e42d4eff32522b3c01c51369867be0
 DIST antlr-3.5.2-complete.jar 2456317 BLAKE2B 
d9afa08ad98dbff16d30425b97a0ddac7402055916e6a7dd290c3b9a2b26a4751c02f405d8d13c186333430c370c94bd73419b14c8e46df2971f68536cc484a0
 SHA512 
560f208e38759b5e626de56816e1fce9c191c526c04ca782513859d468ac444d1e8e62c03870a68f8f9d8daee0f45fca465150e2bbfc71b46e46b952519044b1
 DIST stringtemplate-3.2.1.tar.gz 107877 BLAKE2B 
e099aaef047de12706ca4c771f28742dc48ec14a577b2384b32850e304b29284436b3c850846136cbd37481ff48cfb2fd5935d2de3aafa5c817ae24f62579435
 SHA512 
76203182302d42a0f79de7e8a22f44c59ddc5604761034e420b6973894e0ca1e6154cbcb322ec6f9a064ee89cc5f6478b775a716692c80c7f0c77566aa8a0e25
 DIST stringtemplate-4.0.8.tar.gz 147305 BLAKE2B 
0c09326f4eecfc86db8588a9b8db801bac8d8e128f8ef004a3691813d1dfcbd1e397acd5cad47e4c9d44d7ee8c17b8f6b66386fb897e4137df43dc46f46dc3f3
 SHA512 
21e4936356a6d374bf92645f09351a495a5900a408ead8dce1903ed81d7fc70eb4b44b206b587b05ed87edb2d4792c1cf72907a9cb527e18373ba2e5f31b5724
+DIST stringtemplate-4.3.1.tar.gz 432541 BLAKE2B 
c5b4124524e36a7104908dabf9ed258d2397095d8dc86eef401d0da1ac245629e88a1b2d0e35417ed7735ad6b8495fd2cc82970601a16ee856f5456fdc24b48f
 SHA512 
afe62ca1cbc7572d05859c6fdaa1eb3221045da582bce5d88c328acae39128c904396f8ba1e10643a2757123297ba1924e046841cc8a667fbc724bdeca95680c

diff --git 
a/dev-java/stringtemplate/files/stringtemplate-4.3.1-BaseTest-javac-source-target.patch
 
b/dev-java/stringtemplate/files/stringtemplate-4.3.1-BaseTest-javac-source-target.patch
new file mode 100644
index 000000000000..5824425ce35b
--- /dev/null
+++ 
b/dev-java/stringtemplate/files/stringtemplate-4.3.1-BaseTest-javac-source-target.patch
@@ -0,0 +1,28 @@
+From 4e12a210f2b933c92ded6ee141f6399144a866f5 Mon Sep 17 00:00:00 2001
+From: Yuan Liao <[email protected]>
+Date: Mon, 24 Jan 2022 06:17:03 -0800
+Subject: [PATCH] BaseTest.java: Change javac source/target to 1.8 for JDK 17
+
+JDK 17 no longer supports 1.6 as the source or target version.
+
+Signed-off-by: Yuan Liao <[email protected]>
+---
+ test/org/stringtemplate/v4/test/BaseTest.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/org/stringtemplate/v4/test/BaseTest.java 
b/test/org/stringtemplate/v4/test/BaseTest.java
+index 536d686..74a3949 100644
+--- a/test/org/stringtemplate/v4/test/BaseTest.java
++++ b/test/org/stringtemplate/v4/test/BaseTest.java
+@@ -258,7 +258,7 @@ public abstract class BaseTest {
+             fileManager.getJavaFileObjectsFromFiles(files);
+ 
+         Iterable<String> compileOptions =
+-            Arrays.asList("-g", "-source", "1.6", "-target", "1.6", 
"-implicit:class", "-Xlint:-options", "-d", workingDirName, "-cp", 
workingDirName+pathSep+CLASSPATH);
++            Arrays.asList("-g", "-source", "1.8", "-target", "1.8", 
"-implicit:class", "-Xlint:-options", "-d", workingDirName, "-cp", 
workingDirName+pathSep+CLASSPATH);
+ 
+         JavaCompiler.CompilationTask task =
+             compiler.getTask(null, fileManager, null, compileOptions, null,
+-- 
+2.34.1
+

diff --git a/dev-java/stringtemplate/stringtemplate-4.3.1.ebuild 
b/dev-java/stringtemplate/stringtemplate-4.3.1.ebuild
new file mode 100644
index 000000000000..3eb42e302549
--- /dev/null
+++ b/dev-java/stringtemplate/stringtemplate-4.3.1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="org.antlr:ST4:4.3.1"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="A Java template engine"
+HOMEPAGE="https://www.stringtemplate.org/";
+# Maven Central sources JAR for *.java sources pre-generated from *.g files;
+# the source generation requires antlr-tool-3.5, which depends on this package.
+# Tarball for the test suite and DOCS files
+SRC_URI="
+       https://repo1.maven.org/maven2/org/antlr/ST4/${PV}/ST4-${PV}-sources.jar
+       https://github.com/antlr/${PN}4/archive/${PV}.tar.gz -> ${P}.tar.gz
+"
+
+LICENSE="BSD"
+SLOT="4"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+CP_DEPEND="
+       dev-java/antlr-runtime:3.5
+"
+
+BDEPEND="
+       app-arch/unzip
+"
+
+DEPEND="
+       >=virtual/jdk-1.8:*
+       ${CP_DEPEND}
+       test? (
+               dev-java/antlr-tool:3.5
+       )
+"
+
+RDEPEND="
+       >=virtual/jre-1.8:*
+       ${CP_DEPEND}
+"
+
+S="${WORKDIR}"
+TARBALL_S="${S}/${PN}4-${PV}"
+
+JAVA_SRC_DIR="org"
+
+JAVA_TEST_GENTOO_CLASSPATH="junit-4,antlr-tool-3.5"
+JAVA_TEST_SRC_DIR="${TARBALL_S}/test"
+
+DOCS=( "${TARBALL_S}/"{CHANGES.txt,contributors.txt,README.md} )
+
+src_prepare() {
+       java-pkg_clean # Just in case Maven Central sources JAR contains binary
+       if use test; then
+               pushd "${TARBALL_S}" > /dev/null ||
+                       die "Failed to enter directory storing tarball contents"
+               eapply "${FILESDIR}/${P}-BaseTest-javac-source-target.patch"
+               popd > /dev/null ||
+                       die "Failed to leave directory storing tarball contents"
+       fi
+       java-pkg-2_src_prepare
+       # Some of these tests requires a graphical display.
+       rm -v 
"${JAVA_TEST_SRC_DIR}/org/stringtemplate/v4/test/TestEarlyEvaluation.java" || 
die
+}
+
+src_install() {
+       java-pkg-simple_src_install
+       einstalldocs # https://bugs.gentoo.org/789582
+}

Reply via email to