mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-09 06:37:10 -08:00
dev-java/antlr: EAPI 7, min java 1.8 (slot 3)
Package-Manager: Portage-3.0.18, Repoman-3.0.2 Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/20829 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
JAVA_PKG_IUSE="doc test"
|
||||
|
||||
inherit java-pkg-2 java-pkg-simple
|
||||
|
||||
DESCRIPTION="A parser generator for many languages"
|
||||
HOMEPAGE="https://www.antlr3.org/"
|
||||
SRC_URI="https://www.antlr3.org/download/${P}.tar.gz
|
||||
https://www.antlr3.org/download/${P}.jar" # Prebuilt version needed.
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="3"
|
||||
KEYWORDS="amd64 ~arm ~arm64 ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
CDEPEND=">=dev-java/antlr-2.7.7-r7:0
|
||||
dev-java/stringtemplate:0"
|
||||
|
||||
RDEPEND="${CDEPEND}
|
||||
>=virtual/jre-1.8:*"
|
||||
|
||||
DEPEND="${CDEPEND}
|
||||
>=virtual/jdk-1.8:*
|
||||
test? ( dev-java/junit:4 )"
|
||||
|
||||
PATCHES=(
|
||||
# These fixes have been applied in 3.5.
|
||||
"${FILESDIR}/${PV}-test-fixes.patch"
|
||||
"${FILESDIR}/${PV}-java-8.patch"
|
||||
)
|
||||
|
||||
S="${WORKDIR}/${P}"
|
||||
JAVA_GENTOO_CLASSPATH_EXTRA="${S}/${PN}-runtime.jar"
|
||||
JAVA_GENTOO_CLASSPATH="antlr,stringtemplate"
|
||||
|
||||
src_unpack() {
|
||||
unpack ${P}.tar.gz
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
java-pkg_clean
|
||||
|
||||
# Some tests fail under Java 8 in ways that probably aren't limited
|
||||
# to the tests. This is bad but upstream is never going to update
|
||||
# 3.2 even though other projects still rely on it. If any issues
|
||||
# arise, we can only put pressure on those projects to upgrade.
|
||||
if java-pkg_is-vm-version-ge 1.8; then
|
||||
rm -v tool/src/test/java/org/antlr/test/Test{DFAConversion,SemanticPredicates,TopologicalSort}.java || die
|
||||
fi
|
||||
|
||||
# 3.2 has strange hidden files.
|
||||
find -type f -name "._*.*" -delete || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cd "${S}/runtime/Java/src/main" || die
|
||||
JAVA_JAR_FILENAME="${S}/${PN}-runtime.jar" java-pkg-simple_src_compile
|
||||
|
||||
cd "${S}/tool/src/main" || die
|
||||
|
||||
local G; for G in antlr codegen antlr.print assign.types buildnfa define; do # from pom.xml
|
||||
antlr -o antlr2/org/antlr/grammar/v2/{,${G}.g} || die
|
||||
done
|
||||
|
||||
# We have applied a patch to fix this version under Java 8. Trouble
|
||||
# is that we need to run a prebuilt version before we can build our
|
||||
# own and that version doesn't have the fix applied. We work around
|
||||
# this by building just the offending class against the prebuilt
|
||||
# version and then putting them together in the classpath. That
|
||||
# isn't all. Due to a compiler limitation that Chewi doesn't fully
|
||||
# understand, this class cannot be compiled by itself without a
|
||||
# couple of tweaks that have been applied in the Java 8 patch.
|
||||
ejavac -classpath "${DISTDIR}/${P}.jar" java/org/antlr/tool/CompositeGrammar.java
|
||||
|
||||
java -classpath "java:${DISTDIR}/${P}.jar" org.antlr.Tool $(find antlr3 -name "*.g") || die
|
||||
JAVA_JAR_FILENAME="${S}/${PN}-tool.jar" java-pkg-simple_src_compile
|
||||
java-pkg_addres "${S}/${PN}-tool.jar" resources
|
||||
}
|
||||
|
||||
src_install() {
|
||||
java-pkg_dojar ${PN}-{runtime,tool}.jar
|
||||
java-pkg_dolauncher ${PN}${SLOT} --main org.antlr.Tool
|
||||
use doc && java-pkg_dojavadoc runtime/Java/src/main/target/api
|
||||
}
|
||||
|
||||
src_test() {
|
||||
cd tool/src/test/java || die
|
||||
local CP=".:${S}/${PN}-runtime.jar:${S}/${PN}-tool.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"
|
||||
|
||||
local TESTS=$(find * -name "Test*.java")
|
||||
TESTS="${TESTS//.java}"
|
||||
TESTS="${TESTS//\//.}"
|
||||
|
||||
ejavac -classpath "${CP}" $(find -name "*.java")
|
||||
ejunit4 -classpath "${CP}" ${TESTS}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
--- tool/src/test/java/org/antlr/test/BaseTest.java.orig 2010-11-30 01:54:04.000000000 +0000
|
||||
+++ tool/src/test/java/org/antlr/test/BaseTest.java 2015-09-24 22:25:36.872191194 +0100
|
||||
--- a/tool/src/test/java/org/antlr/test/BaseTest.java.orig 2010-11-30 01:54:04.000000000 +0000
|
||||
+++ b/tool/src/test/java/org/antlr/test/BaseTest.java 2015-09-24 22:25:36.872191194 +0100
|
||||
@@ -130,8 +130,8 @@
|
||||
try {
|
||||
Process process =
|
||||
@@ -43,8 +43,8 @@
|
||||
buf.append(line);
|
||||
buf.append('\n');
|
||||
line = in.readLine();
|
||||
--- tool/src/test/java/org/antlr/test/TestTopologicalSort.java.orig 2009-09-23 19:36:14.000000000 +0100
|
||||
+++ tool/src/test/java/org/antlr/test/TestTopologicalSort.java 2010-11-30 01:54:04.000000000 +0000
|
||||
--- a/tool/src/test/java/org/antlr/test/TestTopologicalSort.java.orig 2009-09-23 19:36:14.000000000 +0100
|
||||
+++ b/tool/src/test/java/org/antlr/test/TestTopologicalSort.java 2010-11-30 01:54:04.000000000 +0000
|
||||
@@ -49,7 +49,7 @@
|
||||
g.addEdge("F", "H");
|
||||
g.addEdge("E", "F");
|
||||
@@ -72,8 +72,8 @@
|
||||
List nodes = g.sort();
|
||||
String result = nodes.toString();
|
||||
assertEquals(expecting, result);
|
||||
--- tool/src/test/java/org/antlr/test/TestSemanticPredicates.java.orig 2009-09-23 19:36:12.000000000 +0100
|
||||
+++ tool/src/test/java/org/antlr/test/TestSemanticPredicates.java 2015-12-05 13:52:05.923411552 +0000
|
||||
--- a/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java.orig 2009-09-23 19:36:12.000000000 +0100
|
||||
+++ b/tool/src/test/java/org/antlr/test/TestSemanticPredicates.java 2015-12-05 13:52:05.923411552 +0000
|
||||
@@ -731,19 +731,23 @@
|
||||
"c : a\n" +
|
||||
" | b\n" +
|
||||
@@ -111,8 +111,8 @@
|
||||
}
|
||||
|
||||
@Test
|
||||
--- tool/src/test/java/org/antlr/test/TestAttributes.java.orig 2015-12-05 13:55:55.392843185 +0000
|
||||
+++ tool/src/test/java/org/antlr/test/TestAttributes.java 2015-12-05 14:04:38.120599871 +0000
|
||||
--- a/tool/src/test/java/org/antlr/test/TestAttributes.java.orig 2015-12-05 13:55:55.392843185 +0000
|
||||
+++ b/tool/src/test/java/org/antlr/test/TestAttributes.java 2015-12-05 14:04:38.120599871 +0000
|
||||
@@ -439,20 +439,15 @@
|
||||
ErrorManager.setErrorListener(equeue);
|
||||
Grammar g = new Grammar(
|
||||
|
||||
Reference in New Issue
Block a user