summaryrefslogtreecommitdiff
path: root/dev-java
diff options
context:
space:
mode:
authorLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2022-04-05 13:43:43 +0000
committerLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2022-04-05 13:43:43 +0000
commit79a07c40c6574f5548de684884bc4dfa8a18d46f (patch)
treee5aac2e265a3b6d48e4b4cd3b4ad501c5e02005c /dev-java
parentc5057a2c3d7be3c010fd890289ac3a0860df7887 (diff)
downloadbaldeagleos-repo-79a07c40c6574f5548de684884bc4dfa8a18d46f.tar.gz
baldeagleos-repo-79a07c40c6574f5548de684884bc4dfa8a18d46f.tar.xz
baldeagleos-repo-79a07c40c6574f5548de684884bc4dfa8a18d46f.zip
Adding metadata
Diffstat (limited to 'dev-java')
-rw-r--r--dev-java/ant-ivy/ant-ivy-2.5.0-r1.ebuild184
-rw-r--r--dev-java/antlr-runtime/antlr-runtime-4.9.3.ebuild105
-rw-r--r--dev-java/antlr-runtime/files/4.9.3-test-fixes.patch26
-rw-r--r--dev-java/randomized-runner/Manifest1
-rw-r--r--dev-java/randomized-runner/randomized-runner-2.7.9.ebuild70
-rw-r--r--dev-java/stringtemplate/Manifest2
-rw-r--r--dev-java/stringtemplate/stringtemplate-4.3.2.ebuild103
7 files changed, 485 insertions, 6 deletions
diff --git a/dev-java/ant-ivy/ant-ivy-2.5.0-r1.ebuild b/dev-java/ant-ivy/ant-ivy-2.5.0-r1.ebuild
new file mode 100644
index 000000000000..cb8092656c67
--- /dev/null
+++ b/dev-java/ant-ivy/ant-ivy-2.5.0-r1.ebuild
@@ -0,0 +1,184 @@
+# 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.apache.ivy:ivy:2.5.0"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple java-osgi
+
+DESCRIPTION="Ivy is a free java based dependency manager"
+HOMEPAGE="https://ant.apache.org/ivy/"
+SRC_URI="mirror://apache/ant/ivy/${PV}/apache-ivy-${PV}-src.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="2"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+
+PROPERTIES="test_network"
+RESTRICT="test"
+
+CDEPEND="
+ dev-java/ant-core:0
+ dev-java/bcpg:0
+ dev-java/bcprov:0
+ dev-java/httpcomponents-client
+ dev-java/commons-vfs:2
+ dev-java/httpcore:0
+ dev-java/jakarta-oro:2.0
+ dev-java/jsch:0
+ dev-java/jsch-agent-proxy:0
+ test? (
+ dev-java/ant-junit:0
+ dev-java/ant-junit4:0
+ dev-java/ant-junitlauncher:0
+ dev-java/ant-testutil:0
+ dev-java/hamcrest-core:1.3
+ dev-java/hamcrest-library:1.3
+ dev-java/xmlunit:1
+ )"
+
+# Restrict to jdk:1.8 since java.util.jar.Pack200 was removed.
+DEPEND="${CDEPEND}
+ virtual/jdk:1.8"
+RDEPEND="${CDEPEND}
+ virtual/jre:1.8"
+
+DOCS=( LICENSE NOTICE README.adoc )
+
+S="${WORKDIR}/apache-ivy-${PV}"
+
+JAVA_GENTOO_CLASSPATH="ant-core,bcpg,bcprov,httpcomponents-client-4,commons-vfs-2,httpcore,jakarta-oro-2.0,jsch,jsch-agent-proxy"
+JAVA_MAIN_CLASS="org.apache.ivy.Main"
+JAVA_SRC_DIR="src/java"
+JAVA_RESOURCE_DIRS="resources/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="ant-junit,ant-junit4,ant-junitlauncher,ant-testutil,hamcrest-core-1.3,hamcrest-library-1.3,junit-4,xmlunit-1"
+JAVA_TEST_SRC_DIR="test-src/java"
+JAVA_TEST_RESOURCE_DIRS="test"
+JAVA_GENTOO_CLASSPATH_EXTRA="ant-ivy.jar:test.jar:custom-resolver.jar"
+
+# according to 57,60 build-release.xml
+# https://github.com/apache/ant-ivy/commit/c0c8df492d2312c983f50cfdc5841e18177f6f7b
+JAVA_TEST_EXTRA_ARGS="-Divy.cache.ttl.default=1s -Dskip.download=true -Divy.home=/tmp -D/offline=true"
+
+# Several tests require a certain treatment to "generate-bundles":
+# https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/build.xml#L426-L428
+# <ant dir="${basedir}/test/test-repo" target="generate-bundles"/>
+#
+# The procedure is coded in https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/test/test-repo/build.xml#L19-L71
+# but appears too difficult to be reprodused with 'java-pkg-simple.eclass'.
+# So the failing tests will be excluded, saved for a later attempt.
+#
+# Not excluding any test classes results in "Tests run: 1109, Failures: 98"
+# Excluding those test classes listed below leads to "OK (812 tests)"
+JAVA_TEST_EXCLUDES=(
+ # https://github.com/apache/ant-ivy/blob/083e3f685c1fe29092e59c63b87e81d31fc9babe/build.properties#L56
+ # test.class.pattern = *Test
+ "org.apache.ivy.ant.testutil.AntTaskTestCase" # not in scope
+ "org.apache.ivy.core.TestPerformance" # not in scope
+ "org.apache.ivy.util.TestXmlHelper" # not in scope
+ "org.apache.ivy.TestFixture" # not in scope
+ "org.apache.ivy.TestHelper" # not in scope
+ # https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/build.xml#L412-L420
+ # <exclude name="**/Abstract*Test.java"/>
+ "org.apache.ivy.util.url.AbstractURLHandlerTest"
+ "org.apache.ivy.plugins.resolver.AbstractDependencyResolverTest"
+ "org.apache.ivy.plugins.matcher.AbstractPatternMatcherTest"
+ # following excluded tests cause test failures
+ "org.apache.ivy.ant.BuildOBRTaskTest" # Tests run: 3, Failures: 2
+ "org.apache.ivy.core.deliver.DeliverTest" # Tests run: 1, Failures: 1
+ "org.apache.ivy.core.module.descriptor.IvyMakePomTest" # Tests run: 1, Failures: 1
+ "org.apache.ivy.core.settings.XmlSettingsParserTest" # Tests run: 29, Failures: 1
+ "org.apache.ivy.osgi.core.AggregatedOSGiResolverTest" # Tests run: 3, Failures: 1
+ "org.apache.ivy.osgi.obr.OBRResolverTest" # Tests run: 16, Failures: 16
+ "org.apache.ivy.osgi.repo.BundleRepoTest" # Tests run: 4, Failures: 3
+ "org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParserTest" # Tests run: 46, Failures: 1
+ "org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParserTest" # Tests run: 44, Failures: 7
+ "org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriterTest" # Tests run: 10, Failures: 1
+ "org.apache.ivy.plugins.parser.xml.XmlModuleUpdaterTest" # Tests run: 14, Failures: 3
+ "org.apache.ivy.plugins.resolver.JarResolverTest" # Tests run: 3, Failures: 3
+ # following excluded tests can pass if run individually
+ "org.apache.ivy.ant.IvyConfigureTest" # OK (14 tests)
+ "org.apache.ivy.IvyTest" # OK (1 test)
+ "org.apache.ivy.MainTest" # OK (12 tests)
+ "org.apache.ivy.plugins.report.XmlReportWriterTest" # OK (3 tests)
+ "org.apache.ivy.plugins.resolver.BintrayResolverTest" # OK (12 tests)
+ "org.apache.ivy.plugins.resolver.ChainResolverTest" # OK (15 tests)
+ "org.apache.ivy.plugins.resolver.FileSystemResolverTest" # OK (27 tests)
+ "org.apache.ivy.plugins.resolver.IBiblioMavenSnapshotsResolutionTest" # OK (1 test)
+ "org.apache.ivy.plugins.resolver.IvyRepResolverTest" # OK (3 tests)
+ "org.apache.ivy.plugins.resolver.Maven2LocalTest" # OK (2 tests)
+ "org.apache.ivy.plugins.resolver.PackagerResolverTest" # OK (3 tests)
+ "org.apache.ivy.plugins.resolver.URLResolverTest" # OK (5 tests)
+ "org.apache.ivy.plugins.trigger.LogTriggerTest" # OK (3 tests)
+ # Without PROPERTIES="test_network", the following test cause additional failures.
+ "org.apache.ivy.core.settings.OnlineXmlSettingsParserTest"
+# "org.apache.ivy.osgi.updatesite.UpdateSiteAndIbiblioResolverTest"
+ "org.apache.ivy.osgi.updatesite.UpdateSiteLoaderTest"
+# "org.apache.ivy.plugins.resolver.IBiblioResolverTest"
+# "org.apache.ivy.plugins.resolver.MirroredURLResolverTest"
+ "org.apache.ivy.util.url.ArtifactoryListingTest"
+# "org.apache.ivy.util.url.BasicURLHandlerTest"
+# "org.apache.ivy.util.url.HttpclientURLHandlerTest"
+)
+
+src_prepare() {
+ default
+
+ mkdir --parents "${JAVA_RESOURCE_DIRS}/META-INF" || die
+ pushd "${JAVA_RESOURCE_DIRS}"
+ cp "${S}"/{NOTICE,LICENSE} META-INF/ || die
+ cp -r "${S}"/src/java/* . || die
+
+ # DEPRECATED: 'ivyconf' element is deprecated, use 'ivysettings' instead
+ # according to 210,221 build.xml and still in the upstream .jar file
+ cp org/apache/ivy/core/settings/ivy{settings,conf}-local.xml || die
+ cp org/apache/ivy/core/settings/ivy{settings,conf}-default-chain.xml || die
+ cp org/apache/ivy/core/settings/ivy{settings,conf}-main-chain.xml || die
+ cp org/apache/ivy/core/settings/ivy{settings,conf}-public.xml || die
+ cp org/apache/ivy/core/settings/ivy{settings,conf}-shared.xml || die
+ cp org/apache/ivy/core/settings/ivy{settings,conf}.xml || die
+
+ find . -type f -name '*.java' -exec rm -rf {} + || die
+ popd || die
+}
+
+src_test() {
+ # https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/build.xml#L396-L407
+ # name="build-custom-resolver-jar"
+ JAVA_SRC_DIR="test/custom-classpath"
+ JAVA_JAR_FILENAME="test/java/org/apache/ivy/core/settings/custom-resolver.jar"
+ java-pkg-simple_src_compile
+
+ # Without "license.xml" the tests won't even start. "Tests run: 1109, Failures: 318"
+ jar -cf test.jar \
+ -C test/java org/apache/ivy/plugins/parser/xml/license.xml \
+ -C test/java org/apache/ivy/plugins/parser/m2/license.xml || die
+
+ # Reduce number of failures to "Tests run: 1109, Failures: 98"
+ jar -uf "test.jar" -C test/java . || die
+
+ # Separate *.java files from test resources
+ # https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/build.xml#L389-L393
+ mkdir test-src || die
+ cp -r test/java test-src/ || die
+ find test -type f -name '*.java' -exec rm -rf {} + || die
+
+ # https://github.com/apache/ant-ivy/blob/48234fc5ede85a865eb874a96c08472ce1751fd1/build.xml#L430-L438
+ # name="prepare-test-jar-repositories"
+ mkdir test/jar-repos || die
+ jar -cfM "test/jar-repos/jarrepo1.jar" -C test/repositories/1 . || die
+# jar -cfM "test/jar-repos/jarrepo1_subdir.jar" -C test/repositories 1/**/*/ || die
+
+ java-pkg-simple_src_test
+}
+
+src_install() {
+ default
+ java-osgi_dojar-fromfile "ant-ivy.jar" "META-INF/MANIFEST.MF" "ant-ivy"
+ use doc && java-pkg_dojavadoc target/api
+ use source && java-pkg_dosrc src/*
+}
diff --git a/dev-java/antlr-runtime/antlr-runtime-4.9.3.ebuild b/dev-java/antlr-runtime/antlr-runtime-4.9.3.ebuild
index 31d041e6a974..cf26c16eb71e 100644
--- a/dev-java/antlr-runtime/antlr-runtime-4.9.3.ebuild
+++ b/dev-java/antlr-runtime/antlr-runtime-4.9.3.ebuild
@@ -3,13 +3,9 @@
EAPI=8
-# Without annotation processing using runtime-testsuite/processors,
-# the tests are bound to fail. However, the annotation processor
-# has been dropped from the 'master' branch as of January 2022, so
-# when updating this package to a new upstream version, please
-# check if it is possible to enable the tests and pass them.
-JAVA_PKG_IUSE="doc source"
+JAVA_PKG_IUSE="doc source test"
MAVEN_ID="org.antlr:antlr4-runtime:4.9.3"
+JAVA_TESTING_FRAMEWORKS="junit-4"
inherit java-pkg-2 java-pkg-simple
@@ -26,6 +22,10 @@ KEYWORDS="amd64 ~arm arm64 ppc64 x86"
DEPEND="
>=virtual/jdk-1.8:*
+ test? (
+ ~dev-java/antlr-tool-${PV}:${SLOT}
+ dev-java/jol-core:0
+ )
"
RDEPEND="
@@ -35,3 +35,96 @@ RDEPEND="
S="${WORKDIR}/${MY_PN}4-${PV}"
JAVA_SRC_DIR="runtime/Java/src"
+
+JAVA_TEST_GENTOO_CLASSPATH="
+ junit-4
+ antlr-tool-${SLOT}
+ jol-core
+"
+JAVA_TEST_SRC_DIR=(
+ runtime-testsuite/test
+ runtime-testsuite/annotations
+)
+JAVA_TEST_RESOURCE_DIRS=(
+ runtime-testsuite/resources
+)
+
+src_prepare() {
+ java-pkg_clean
+ eapply "${FILESDIR}/${PV}-test-fixes.patch"
+ 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 --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 "Removing tests for non-Java runtimes ..."
+ find org/antlr/v4/test/runtime/* -maxdepth 0 -type d \
+ -not -name category -not -name descriptors -not -name java \
+ -exec einfo " {}" \; -exec rm -r "{}" + ||
+ die "Failed to remove tests for non-Java runtimes"
+
+ 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" \
+ -not -name "TestContext.java" \
+ -not -name "TestOutputReading.java"
+ )
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+
+ popd > /dev/null || die "Failed to leave test source directory for ${PN}"
+
+ local classes="target/classes"
+
+ # Compile the annotation processor of @CommentHasStringValue
+ # before the test sources (requires tools.jar)
+ ejavac -d "${classes}" -cp "${CP}:$(java-config -t)" \
+ $(find runtime-testsuite/{annotations,processors} -name "*.java")
+ local processor_cp="${classes}:runtime-testsuite/processors/resources"
+
+ # 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")
+
+ ejunit4 -classpath "${classes}:${CP}" ${TESTS}
+}
diff --git a/dev-java/antlr-runtime/files/4.9.3-test-fixes.patch b/dev-java/antlr-runtime/files/4.9.3-test-fixes.patch
new file mode 100644
index 000000000000..9cb6884ba194
--- /dev/null
+++ b/dev-java/antlr-runtime/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/randomized-runner/Manifest b/dev-java/randomized-runner/Manifest
index 44d4d0ec7f58..b5438d14ff88 100644
--- a/dev-java/randomized-runner/Manifest
+++ b/dev-java/randomized-runner/Manifest
@@ -1 +1,2 @@
DIST randomized-runner-2.7.8.tar.gz 1501825 BLAKE2B e375d4509d8be914829c4ebfad5584e16f8f03be480ed21b52a0ad3db363b7f2761ae6442bb9baa8c929bc182c422963a6e8480165f53b7b820f9f4e2954a243 SHA512 5627f14dc70a6341838ad1ade0fa0f152ec6a5a7f3da4bc31e0ff040ea2c62aeafd669460f61f37db31de379db857ce3d58f0deed22d1cf714f1461988a92cdc
+DIST randomized-runner-2.7.9.tar.gz 1501927 BLAKE2B 41ac32c724a87021c9fd58d3c421cab1fefd00a1e9e25a29d6188b831120c5e1407894f19fa92254df5cd1f2a66a44bf6e4469fa2128d841c1f17d17a623eec9 SHA512 23db6f21a805146d759fa9d3c9a37199b7181d6c53d0f62a4d82c42cbc15816cc25a87a174ef3d533870d648039b3f8dcac9370ffaff4ef76fefb6fc2c38ee88
diff --git a/dev-java/randomized-runner/randomized-runner-2.7.9.ebuild b/dev-java/randomized-runner/randomized-runner-2.7.9.ebuild
new file mode 100644
index 000000000000..80a8dbc84563
--- /dev/null
+++ b/dev-java/randomized-runner/randomized-runner-2.7.9.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Skeleton command:
+# java-ebuilder --generate-ebuild --workdir . --pom pom.xml --download-uri https://github.com/randomizedtesting/randomizedtesting/archive/release/2.7.9.tar.gz --slot 0 --keywords "~amd64 ~arm ~arm64 ~x86" --ebuild randomized-runner-2.7.9.ebuild
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.7.9"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="JUnit test runner and plugins for running JUnit tests with pseudo-randomness"
+HOMEPAGE="https://labs.carrotsearch.com/randomizedtesting.html"
+SRC_URI="https://github.com/randomizedtesting/randomizedtesting/archive/release/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+
+# Common dependencies
+# POM: pom.xml
+# junit:junit:4.13.1 -> >=dev-java/junit-4.13.2:4
+
+CP_DEPEND="
+ >=dev-java/junit-4.12:4
+"
+
+# Compile dependencies
+# POM: pom.xml
+# test? org.assertj:assertj-core:2.2.0 -> >=dev-java/assertj-core-2.3.0:2
+
+DEPEND="
+ >=virtual/jdk-1.8:*
+ ${CP_DEPEND}
+ test? (
+ >=dev-java/assertj-core-2.3.0:2
+ )
+"
+
+RDEPEND="
+ >=virtual/jre-1.8:*
+ ${CP_DEPEND}"
+
+DOCS=( ../{CHANGES,CONTRIBUTING,README}.txt )
+
+S="${WORKDIR}/randomizedtesting-release-${PV}/${PN}"
+
+JAVA_SRC_DIR="src/main/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="assertj-core-2"
+JAVA_TEST_SRC_DIR="src/test/java"
+
+src_test() {
+ local vm_version="$(java-config -g PROVIDES_VERSION)"
+ if [[ "${vm_version}" -ge "17" ]] ; then
+ JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.lang=ALL-UNNAMED )
+ JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.util=ALL-UNNAMED )
+ JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/sun.nio.fs=ALL-UNNAMED )
+ fi
+
+ java-pkg-simple_src_test
+}
+
+src_install() {
+ default # https://bugs.gentoo.org/789582
+ java-pkg-simple_src_install
+}
diff --git a/dev-java/stringtemplate/Manifest b/dev-java/stringtemplate/Manifest
index a8ee4deb0a40..b44912b51312 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 ST4-4.3.2-sources.jar 198754 BLAKE2B 667953642ed2721d1a7c7e94d90a1f8690cfa9c31c391e9b5089f04c64728dac75edc9cd0e529607cad4c1b07abaf45719c2cbab9e962a5feef657b59c3baccc SHA512 7de339d34adf6b9207a23e8936092ea4fde78bf1faa63cee869673e91ba73d0fcbaa555602d0905c7347e894985613c63ff4ce04825decc34c896da5a687d42f
DIST stringtemplate-3.2.1.tar.gz 107877 BLAKE2B e099aaef047de12706ca4c771f28742dc48ec14a577b2384b32850e304b29284436b3c850846136cbd37481ff48cfb2fd5935d2de3aafa5c817ae24f62579435 SHA512 76203182302d42a0f79de7e8a22f44c59ddc5604761034e420b6973894e0ca1e6154cbcb322ec6f9a064ee89cc5f6478b775a716692c80c7f0c77566aa8a0e25
DIST stringtemplate-4.3.1.tar.gz 432541 BLAKE2B c5b4124524e36a7104908dabf9ed258d2397095d8dc86eef401d0da1ac245629e88a1b2d0e35417ed7735ad6b8495fd2cc82970601a16ee856f5456fdc24b48f SHA512 afe62ca1cbc7572d05859c6fdaa1eb3221045da582bce5d88c328acae39128c904396f8ba1e10643a2757123297ba1924e046841cc8a667fbc724bdeca95680c
+DIST stringtemplate-4.3.2.tar.gz 437013 BLAKE2B 0fb0fd62314a1fa5045285966b28aaf8f18579261722c0383e4ec8b3198aff59fd0e9760dcd43d8ecddf795ce3b2a882f3f339ec56d117a4b5b22e9c2718d679 SHA512 d6150f86ce458b5c74d533016bc3168fad969fc1d814d01c5ad3be2f866f7aa531357a903565f31afa3ba62423acc760b7762865e0ee5dd3af4ea546f6be25e1
diff --git a/dev-java/stringtemplate/stringtemplate-4.3.2.ebuild b/dev-java/stringtemplate/stringtemplate-4.3.2.ebuild
new file mode 100644
index 000000000000..1d0130c2b54f
--- /dev/null
+++ b/dev-java/stringtemplate/stringtemplate-4.3.2.ebuild
@@ -0,0 +1,103 @@
+# 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.2"
+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"
+JAVA_TEST_RESOURCE_DIRS=( "${TARBALL_S}/test/resources" )
+
+DOCS=( "${TARBALL_S}/"{CHANGES.txt,README.md} )
+
+src_prepare() {
+ # Do not call java-pkg_clean; otherwise, it would remove
+ # ${TARBALL_S}/test/test.jar, which is merely used as a
+ # test resource file, does not contain any *.class files,
+ # and is required to pass the tests as of version 4.3.2
+ pushd "${TARBALL_S}" > /dev/null ||
+ die "Failed to enter directory storing tarball contents"
+ eapply "${FILESDIR}/${PN}-4.3.1-BaseTest-javac-source-target.patch"
+ popd > /dev/null ||
+ die "Failed to leave directory storing tarball contents"
+ 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_test() {
+ # Make sure no older versions of this slot are present in the classpath
+ # https://bugs.gentoo.org/834138#c4
+ local old_ver_cp="$(nonfatal java-pkg_getjars "${PN}-${SLOT}")"
+ local new_test_cp="$(\
+ java-pkg_getjars --with-dependencies "${JAVA_TEST_GENTOO_CLASSPATH}")"
+ new_test_cp="${new_test_cp//"${old_ver_cp}"/}"
+
+ # Some of the test cases require an absolute path to the JAR being tested
+ # against to be in the classpath, due to the fact that they call the 'java'
+ # command outside ${S} and reuse the classpath for the tests:
+ # https://github.com/antlr/stringtemplate4/blob/4.3.1/test/org/stringtemplate/v4/test/TestImports.java#L103
+ # https://github.com/antlr/stringtemplate4/blob/4.3.1/test/org/stringtemplate/v4/test/BaseTest.java#L174
+ new_test_cp="${S}/${JAVA_JAR_FILENAME}:${new_test_cp}"
+
+ # The JAR used as a test resource file needs to be in the classpath
+ # https://github.com/antlr/stringtemplate4/blob/4.3.2/pom.xml#L53-L58
+ new_test_cp+=":${JAVA_TEST_SRC_DIR}/test.jar"
+
+ # Use JAVA_GENTOO_CLASSPATH_EXTRA to set test classpath
+ local JAVA_TEST_GENTOO_CLASSPATH=""
+ [[ -n "${JAVA_GENTOO_CLASSPATH_EXTRA}" ]] &&
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":"
+ JAVA_GENTOO_CLASSPATH_EXTRA+="${new_test_cp}"
+ java-pkg-simple_src_test
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ einstalldocs # https://bugs.gentoo.org/789582
+}