summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuan Liao <liaoyuan@gmail.com>2022-01-28 12:39:08 -0800
committerMiroslav Šulc <fordfrog@gentoo.org>2022-02-04 09:17:41 +0100
commitdc41685a8022e842dc7d34140655f0d4da3dec25 (patch)
treea9da667fea6ccf2857474c720f29e57e5c64cc6f /dev-java
parentdev-java/jol-core: Initial import (diff)
downloadgentoo-dc41685a8022e842dc7d34140655f0d4da3dec25.tar.gz
gentoo-dc41685a8022e842dc7d34140655f0d4da3dec25.tar.bz2
gentoo-dc41685a8022e842dc7d34140655f0d4da3dec25.zip
dev-java/antlr-tool: Add 4.9.3
Signed-off-by: Yuan Liao <liaoyuan@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/24006/commits/ac3c4a909a1d95ac41a1d9e4c57aa2d989028ecd Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'dev-java')
-rw-r--r--dev-java/antlr-tool/Manifest2
-rw-r--r--dev-java/antlr-tool/antlr-tool-4.9.3.ebuild142
-rw-r--r--dev-java/antlr-tool/files/4.9.3-test-fixes.patch26
-rw-r--r--dev-java/antlr-tool/metadata.xml1
4 files changed, 171 insertions, 0 deletions
diff --git a/dev-java/antlr-tool/Manifest b/dev-java/antlr-tool/Manifest
index 5af9733be86b..165df95f41e4 100644
--- a/dev-java/antlr-tool/Manifest
+++ b/dev-java/antlr-tool/Manifest
@@ -1,2 +1,4 @@
DIST antlr-3.5.2.tar.gz 6927126 BLAKE2B 1907229549434dfea6ef1fa915137a2f733bd61f0a40aacb131689df619d1c92e125453ec3d1febc5d92da1841ffbde060af196cff1ca8fb6f4684600375e161 SHA512 e2a0520093fb2a77dcd9d44f26a9fdd612dceaffb398c53b2b8cd29f4630830647ede29e8dd55b434cb2c165b0fd1d77968ec6e6de0798f14d9cdfd9e6fccd99
+DIST antlr-4.9.3.tar.gz 4640242 BLAKE2B fb58f5e533051cb2c439c32f0462c1d463c99df862ba7e1a37a1c61378ab36a9edb9525c2a342de5b517da6f02d8291de5976c550932314f3464aad1a778afb9 SHA512 61452404c9639b5a0908cda16605f17c0fed0c9adfc3278c7408f9971420e9d1fe8f9e974e0826c2e3e780fdd83324094c0246cd5b28fa63f5686b094ea08127
DIST antlr-tool-3.5.2-sources.jar 957096 BLAKE2B 39b75824e129c8111f302eb71407a683c59e91e79a3fa13c5386c4ba4aa322e706deb10b36df3591ab0843faff5702091d543272ee85d63cd92cb36cc72e1ceb SHA512 50fece361b69299be0c0941e6fe2bfacfc39c0b3dad3320126a9a80cd0f053fbaa6332612e2bab2872db122025d6abfe4b35a4636ef1c101e9131bbd2cdf5e28
+DIST antlr-tool-4.9.3-sources.jar 961749 BLAKE2B 294c7ba6dff9a1039d3e570d7d49f46a564302d1e7a25ac9f662a2c293cbabadd6a5a4a94d026c4e5fcca37c407e104956badbd1cbbf71b957e464dc67cf823e SHA512 7d70e80714b673eb8301def5e66a7133b2ac477e3cc219e37877ef9df673e0599a1148a8c1929ca8eab081d4e7375c9079241765a1f38832b21cfe8608ef4429
diff --git a/dev-java/antlr-tool/antlr-tool-4.9.3.ebuild b/dev-java/antlr-tool/antlr-tool-4.9.3.ebuild
new file mode 100644
index 000000000000..bf1ef9d555c6
--- /dev/null
+++ b/dev-java/antlr-tool/antlr-tool-4.9.3.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Artifact ID for antlr-tool is 'antlr4'
+# https://github.com/antlr/antlr4/blob/4.9.3/tool/pom.xml#L14
+MAVEN_ID="org.antlr:antlr4:4.9.3"
+
+JAVA_PKG_IUSE="doc source test"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+MY_PN="${PN%-tool}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="The ANTLR 4 grammar compiler"
+HOMEPAGE="https://www.antlr.org/"
+# Maven Central sources JAR for tool/src/org/antlr/v4/unicode/UnicodeData.java,
+# which requires string-template-maven-plugin to generate; tarball for the rest
+SRC_URI="
+ https://github.com/antlr/antlr4/archive/${PV}.tar.gz -> ${MY_P}.tar.gz
+ https://repo1.maven.org/maven2/org/antlr/antlr4/${PV}/antlr4-${PV}-sources.jar -> ${P}-sources.jar
+"
+
+LICENSE="BSD"
+SLOT="4"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+CP_DEPEND="
+ ~dev-java/antlr-runtime-${PV}:${SLOT}
+ dev-java/antlr-runtime:3.5
+ dev-java/jakarta-json-api:1
+ dev-java/icu4j:70
+ dev-java/stringtemplate:4
+ dev-java/treelayout:0
+"
+
+DEPEND="
+ >=virtual/jdk-1.8:*
+ ${CP_DEPEND}
+ dev-java/antlr-tool:3.5
+ test? (
+ dev-java/jol-core:0
+ )
+"
+
+RDEPEND="
+ >=virtual/jre-1.8:*
+ ${CP_DEPEND}
+"
+
+S="${WORKDIR}/${MY_PN}4-${PV}"
+
+JAVA_SRC_DIR=(
+ tool/src
+ ../src/org # For UnicodeData.java
+)
+JAVA_RESOURCE_DIRS=( tool/resources )
+
+JAVA_TEST_GENTOO_CLASSPATH="junit-4,jol-core"
+JAVA_TEST_SRC_DIR=(
+ tool-testsuite/test
+ # The runtime test suite is used as a library for tool test suite
+ runtime-testsuite/{annotations,test}
+)
+JAVA_TEST_RESOURCE_DIRS=(
+ # Some resources are mixed with test source files
+ "${JAVA_TEST_SRC_DIR[0]}"
+)
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+ MY_JAVA="$(java-config -J)"
+}
+
+src_prepare() {
+ java-pkg_clean
+ eapply "${FILESDIR}/${PV}-test-fixes.patch"
+ java-pkg-2_src_prepare
+}
+
+src_compile() {
+ ebegin "Generating ANTLR 3 parsers"
+ "${MY_JAVA}" -cp "$(java-pkg_getjars \
+ --build-only --with-dependencies antlr-tool-3.5)" \
+ org.antlr.Tool $(find "${JAVA_SRC_DIR[@]}" -name "*.g") ||
+ die "Failed to generate ANTLR 3 parsers"
+ java-pkg-simple_src_compile
+}
+
+src_test() {
+ # Build classpath for tests
+ local test_deps=(
+ "${JAVA_TEST_GENTOO_CLASSPATH}"
+ antlr-runtime-${SLOT}
+ antlr-runtime-3.5
+ jakarta-json-api-1
+ icu4j-70
+ stringtemplate-4
+ treelayout
+ )
+ local CP="${S}/${JAVA_JAR_FILENAME}"
+ for test_dep in "${test_deps[@]}"; do
+ CP+=":$(java-pkg_getjars --with-dependencies "${test_dep}")"
+ done
+ for res_dir in "${JAVA_TEST_RESOURCE_DIRS[@]}"; do
+ CP+=":${res_dir}"
+ done
+
+ ebegin "Generating ANTLR 4 parsers for tests"
+ pushd runtime-testsuite/test > /dev/null ||
+ die "Failed to enter runtime test source directory"
+ g4_files=( $(find * -name "*.g4") )
+ for file in "${g4_files[@]}"; do
+ java_pkg="${file%/*.g4}"
+ java_pkg="${java_pkg//\//.}"
+ "${MY_JAVA}" -cp "${CP}" org.antlr.v4.Tool \
+ -visitor -package "${java_pkg}" "${file}" ||
+ die "Failed to generate ANTLR 4 parser from ${file}"
+ done
+ popd > /dev/null || die "Failed to leave runtime test source directory"
+
+ # Compile Java test sources
+ local classes="target/classes"
+ ejavac -d "${classes}" -cp "${CP}" \
+ $(find "${JAVA_TEST_SRC_DIR[@]}" -name "*.java")
+
+ # Create a list of tests to run
+ pushd "${JAVA_TEST_SRC_DIR[0]}" > /dev/null ||
+ die "Failed to enter test source directory for ${PN}"
+ local TESTS=$(find * -type f \
+ \( -name "Test*.java" -o -name "*Test.java" \) \
+ -not -name "BaseJavaToolTest.java" # No runnable methods
+ )
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+ popd > /dev/null || die "Failed to leave test source directory for ${PN}"
+
+ ejunit4 -classpath "${classes}:${CP}" ${TESTS}
+}
diff --git a/dev-java/antlr-tool/files/4.9.3-test-fixes.patch b/dev-java/antlr-tool/files/4.9.3-test-fixes.patch
new file mode 100644
index 000000000000..9cb6884ba194
--- /dev/null
+++ b/dev-java/antlr-tool/files/4.9.3-test-fixes.patch
@@ -0,0 +1,26 @@
+From 3eabbddff69dcbcaf9a59f407cc8bef4be8e215b Mon Sep 17 00:00:00 2001
+From: Yuan Liao <liaoyuan@gmail.com>
+Date: Thu, 3 Feb 2022 11:51:53 -0800
+Subject: [PATCH] Use 1.8 as javac -source/-target for running tests on Java 17
+
+Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
+---
+ .../test/org/antlr/v4/test/runtime/java/BaseJavaTest.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java
+index cc03bdc11..82061135e 100644
+--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java
++++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java
+@@ -137,7 +137,7 @@ public class BaseJavaTest extends BaseRuntimeTestSupport implements RuntimeTestS
+ fileManager.getJavaFileObjectsFromFiles(files);
+
+ Iterable<String> compileOptions =
+- Arrays.asList("-g", "-source", "1.6", "-target", "1.6", "-implicit:class", "-Xlint:-options", "-d", getTempDirPath(), "-cp", getTempDirPath() + PATH_SEP + CLASSPATH);
++ Arrays.asList("-g", "-source", "1.8", "-target", "1.8", "-implicit:class", "-Xlint:-options", "-d", getTempDirPath(), "-cp", getTempDirPath() + PATH_SEP + CLASSPATH);
+
+ JavaCompiler.CompilationTask task =
+ compiler.getTask(null, fileManager, null, compileOptions, null,
+--
+2.34.1
+
diff --git a/dev-java/antlr-tool/metadata.xml b/dev-java/antlr-tool/metadata.xml
index ad571d3247b8..61e37d49ba13 100644
--- a/dev-java/antlr-tool/metadata.xml
+++ b/dev-java/antlr-tool/metadata.xml
@@ -6,6 +6,7 @@
<name>Java</name>
</maintainer>
<upstream>
+ <remote-id type="github">antlr/antlr4</remote-id>
<remote-id type="github">antlr/antlr3</remote-id>
</upstream>
</pkgmetadata>