commit:     d4351d70912ba6b097a0229f1118b2950b4a974f
Author:     Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Tue Aug 26 05:14:53 2025 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Sep 25 10:58:13 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4351d70

dev-java/antlr-runtime: add 4.13.2

new version not affected by bug #936490

Bug: https://bugs.gentoo.org/936490
Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
Part-of: https://github.com/gentoo/gentoo/pull/43565
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 dev-java/antlr-runtime/Manifest                    |   1 +
 dev-java/antlr-runtime/antlr-runtime-4.13.2.ebuild | 104 +++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/dev-java/antlr-runtime/Manifest b/dev-java/antlr-runtime/Manifest
index bb8fc82c34c3..b254f9f52ea6 100644
--- a/dev-java/antlr-runtime/Manifest
+++ b/dev-java/antlr-runtime/Manifest
@@ -1,2 +1,3 @@
+DIST antlr-4.13.2.tar.gz 4167326 BLAKE2B 
709f3c18329e08a811d7a4e5258fc0183ba6fa6ab62fe83ab694360cf1ce2bb3aa3f30cc62a0339a6ff8b64dd0a766057fd6f751cfc34a4e05051e4d54a57fad
 SHA512 
afd8ecab637a0e70cddf98f63c918eab2b907f87207624e20e80a79f885d6502d4ab734a602b1707969d61944410828b689ec2f8b09c15314fe991024cde1613
 DIST antlr-4.9.3.tar.gz 4640242 BLAKE2B 
fb58f5e533051cb2c439c32f0462c1d463c99df862ba7e1a37a1c61378ab36a9edb9525c2a342de5b517da6f02d8291de5976c550932314f3464aad1a778afb9
 SHA512 
61452404c9639b5a0908cda16605f17c0fed0c9adfc3278c7408f9971420e9d1fe8f9e974e0826c2e3e780fdd83324094c0246cd5b28fa63f5686b094ea08127
 DIST antlr-runtime-3.5.3-sources.jar 204572 BLAKE2B 
8f4493497cbfef613028d4847d1a68a0fdd29f5bf80c3a72b33093aa048409fb740aa95e16e7ceb279b939fabf3a617ccc8046ef6b879eafdb4ae14599951799
 SHA512 
fbfb656b32aa40ce731996774c9a5df28e2dbf67d097a834b39ef137555ff618c26a881af599191fb75366dc3824e281e93a32dbed65d49cc39e2017d836ae95

diff --git a/dev-java/antlr-runtime/antlr-runtime-4.13.2.ebuild 
b/dev-java/antlr-runtime/antlr-runtime-4.13.2.ebuild
new file mode 100644
index 000000000000..cae53fb8fb35
--- /dev/null
+++ b/dev-java/antlr-runtime/antlr-runtime-4.13.2.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2025 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:antlr4-runtime:4.13.2"
+JAVA_TESTING_FRAMEWORKS="junit-jupiter"
+
+inherit java-pkg-2 java-pkg-simple junit5
+
+MY_PN="${PN%-runtime}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="ANTLR 4 Runtime"
+HOMEPAGE="https://www.antlr.org/";
+SRC_URI="https://github.com/antlr/antlr4/archive/${PV}.tar.gz -> 
${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_PN}4-${PV}"
+
+LICENSE="BSD"
+SLOT="4"
+KEYWORDS="~amd64 ~arm64 ~ppc64"
+
+DEPEND="
+       >=virtual/jdk-1.8:*
+       test? (
+               ~dev-java/antlr-tool-${PV}:${SLOT}
+               dev-java/jol-core:0
+       )
+"
+
+RDEPEND="
+       >=virtual/jre-1.8:*
+"
+
+JAVA_AUTOMATIC_MODULE_NAME="org.antlr.antlr4.runtiime"
+JAVA_SRC_DIR="runtime/Java/src"
+JAVA_TEST_GENTOO_CLASSPATH="antlr-tool-${SLOT},jol-core,junit-5"
+JAVA_TEST_RESOURCE_DIRS="runtime-testsuite/resources"
+JAVA_TEST_SRC_DIR="runtime-testsuite/test"
+
+src_prepare() {
+       java-pkg_clean
+       java-pkg-2_src_prepare
+}
+
+src_test() {
+       # Build classpath for tests
+       # The JAR created during src_compile must appear in the classpath 
*before*
+       # any dependencies to ensure that *it* is the JAR being tested; 
otherwise,
+       # because the test suite depends on antlr-tool, which depends on this
+       # package, the copy of this package's JAR installed on the system would 
be
+       # tested instead when it appears earlier in the classpath, which might
+       # cause test failures when the version being built differs from the 
version
+       # already installed on the system, like https://bugs.gentoo.org/834138
+       local CP="${S}/${JAVA_JAR_FILENAME}"
+       local test_dep res_dir
+       for test_dep in ${JAVA_TEST_GENTOO_CLASSPATH}; do
+               CP+=":$(java-pkg_getjars --build-only --with-dependencies 
"${test_dep}")"
+       done
+       for res_dir in "${JAVA_TEST_RESOURCE_DIRS[@]}"; do
+               CP+=":${res_dir}"
+       done
+
+       pushd "${JAVA_TEST_SRC_DIR[0]}" > /dev/null ||
+               die "Failed to enter test source directory for ${PN}"
+
+       einfo "Generating ANTLR 4 parsers for tests ..."
+       local java_exe="$(java-config -J)"
+       local g4_files=( $(find * -name "*.g4") )
+       local file
+       for file in "${g4_files[@]}"; do
+               local java_pkg="${file%/*.g4}"
+               java_pkg="${java_pkg//\//.}"
+               "${java_exe}" -cp "${CP}" org.antlr.v4.Tool \
+                       -visitor -package "${java_pkg}" "${file}" ||
+                       die "Failed to generate ANTLR 4 parser from ${file}"
+       done
+
+       # Create a list of tests to run
+       # 
https://github.com/antlr/antlr4/blob/4.9.3/runtime-testsuite/pom.xml#L100
+       # Excluding classes with "No runnable methods"
+       local TESTS=$(find * -type f -name "Test*.java")
+       TESTS="${TESTS//.java}"
+       TESTS="${TESTS//\//.}"
+
+       popd > /dev/null || die "Failed to leave test source directory for 
${PN}"
+
+       local classes="target/classes"
+
+       # Compile Java test sources, and process @CommentHasStringValue
+       # annotations at the same time
+       local javac_extra_args=()
+       if ver_test "$(java-config -g PROVIDES_VERSION)" -ge 17; then
+               javac_extra_args+=(
+                       
-J--add-opens=jdk.compiler/com.sun.tools.javac.{main,model,tree,util}=ALL-UNNAMED
+               )
+       fi
+       ejavac -d "${classes}" -cp "${CP}:${processor_cp}" \
+               "${javac_extra_args[@]}" \
+               $(find "${JAVA_TEST_SRC_DIR[@]}" -name "*.java")
+
+       ejunit5 -classpath "${classes}:${CP}" ${TESTS}
+}

Reply via email to