Diff antlr-runtime-4.9.3 with a antlr-runtime-4.13.2

/usr/portage/dev-java/antlr-runtime/antlr-runtime-4.13.2.ebuild 2025-11-30 18:18:03.948612341 +0300
1
# Copyright 1999-2024 Gentoo Authors
1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6 6
JAVA_PKG_IUSE="doc source test"
7
MAVEN_ID="org.antlr:antlr4-runtime:4.9.3"
8
JAVA_TESTING_FRAMEWORKS="junit-4"
7
MAVEN_ID="org.antlr:antlr4-runtime:4.13.2"
8
JAVA_TESTING_FRAMEWORKS="junit-jupiter"
9 9

  
10
inherit java-pkg-2 java-pkg-simple
10
inherit java-pkg-2 java-pkg-simple junit5
11 11

  
12 12
MY_PN="${PN%-runtime}"
13 13
MY_P="${MY_PN}-${PV}"
......
15 15
DESCRIPTION="ANTLR 4 Runtime"
16 16
HOMEPAGE="https://www.antlr.org/"
17 17
SRC_URI="https://github.com/antlr/antlr4/archive/${PV}.tar.gz -> ${MY_P}.tar.gz"
18
S="${WORKDIR}/${MY_PN}4-${PV}"
18 19

  
19 20
LICENSE="BSD"
20 21
SLOT="4"
......
32 33
	>=virtual/jre-1.8:*
33 34
"
34 35

  
35
S="${WORKDIR}/${MY_PN}4-${PV}"
36

  
36
JAVA_AUTOMATIC_MODULE_NAME="org.antlr.antlr4.runtiime"
37 37
JAVA_SRC_DIR="runtime/Java/src"
38

  
39
JAVA_TEST_GENTOO_CLASSPATH="
40
	junit-4
41
	antlr-tool-${SLOT}
42
	jol-core
43
"
44
JAVA_TEST_SRC_DIR=(
45
	runtime-testsuite/test
46
	runtime-testsuite/annotations
47
)
48
JAVA_TEST_RESOURCE_DIRS=(
49
	runtime-testsuite/resources
50
)
38
JAVA_TEST_GENTOO_CLASSPATH="antlr-tool-${SLOT},jol-core,junit-5"
39
JAVA_TEST_RESOURCE_DIRS="runtime-testsuite/resources"
40
JAVA_TEST_SRC_DIR="runtime-testsuite/test"
51 41

  
52 42
src_prepare() {
53 43
	java-pkg_clean
54
	eapply "${FILESDIR}/${PV}-test-fixes.patch"
55 44
	java-pkg-2_src_prepare
56 45
}
57 46

  
......
67 56
	local CP="${S}/${JAVA_JAR_FILENAME}"
68 57
	local test_dep res_dir
69 58
	for test_dep in ${JAVA_TEST_GENTOO_CLASSPATH}; do
70
		CP+=":$(java-pkg_getjars --with-dependencies "${test_dep}")"
59
		CP+=":$(java-pkg_getjars --build-only --with-dependencies "${test_dep}")"
71 60
	done
72 61
	for res_dir in "${JAVA_TEST_RESOURCE_DIRS[@]}"; do
73 62
		CP+=":${res_dir}"
......
76 65
	pushd "${JAVA_TEST_SRC_DIR[0]}" > /dev/null ||
77 66
		die "Failed to enter test source directory for ${PN}"
78 67

  
79
	einfo "Removing tests for non-Java runtimes ..."
80
	find org/antlr/v4/test/runtime/* -maxdepth 0 -type d \
81
		-not -name category -not -name descriptors -not -name java \
82
		-exec einfo "  {}" \; -exec rm -r "{}" + ||
83
		die "Failed to remove tests for non-Java runtimes"
84

  
85 68
	einfo "Generating ANTLR 4 parsers for tests ..."
86 69
	local java_exe="$(java-config -J)"
87 70
	local g4_files=( $(find * -name "*.g4") )
......
97 80
	# Create a list of tests to run
98 81
	# https://github.com/antlr/antlr4/blob/4.9.3/runtime-testsuite/pom.xml#L100
99 82
	# Excluding classes with "No runnable methods"
100
	local TESTS=$(find * -type f -name "Test*.java" \
101
		-not -name "TestContext.java" \
102
		-not -name "TestOutputReading.java"
103
	)
83
	local TESTS=$(find * -type f -name "Test*.java")
104 84
	TESTS="${TESTS//.java}"
105 85
	TESTS="${TESTS//\//.}"
106 86

  
......
108 88

  
109 89
	local classes="target/classes"
110 90

  
111
	# Compile the annotation processor of @CommentHasStringValue
112
	# before the test sources (requires tools.jar)
113
	ejavac -d "${classes}" -cp "${CP}:$(java-config -t)" \
114
		$(find runtime-testsuite/{annotations,processors} -name "*.java")
115
	local processor_cp="${classes}:runtime-testsuite/processors/resources"
116

  
117 91
	# Compile Java test sources, and process @CommentHasStringValue
118 92
	# annotations at the same time
119 93
	local javac_extra_args=()
......
126 100
		"${javac_extra_args[@]}" \
127 101
		$(find "${JAVA_TEST_SRC_DIR[@]}" -name "*.java")
128 102

  
129
	ejunit4 -classpath "${classes}:${CP}" ${TESTS}
103
	ejunit5 -classpath "${classes}:${CP}" ${TESTS}
130 104
}
Thank you!