java-pkg-simple.eclass: fix a problem in multi-relase packaging

There was too much of '--release ${version}' leading to validation
errors and preventing successful creation of the jar when packaging
(jar --create -f ) dev-java/fastdoubleparser. Removing it and changing
the output directory of multi-release classes solves the problem and
allows removal of the multi_release variable.

Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Part-of: https://github.com/gentoo/gentoo/pull/42134
Closes: https://github.com/gentoo/gentoo/pull/42134
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Volkmar W. Pogatzki 2025-05-17 19:13:32 +02:00 committed by Sam James
parent 3343f7f0a9
commit b9319f2dfb
No known key found for this signature in database
GPG Key ID: 738409F520DF9190

View File

@ -598,7 +598,7 @@ java-pkg-simple_src_compile() {
# compile sources in ${reldir}
ejavac \
-d target/versions/${release} \
-d ${classes}/META-INF/versions/${release} \
-encoding ${JAVA_ENCODING} \
-classpath "${modulepath}:${JAVA_INTERMEDIATE_JAR_NAME}.jar" \
--module-path "${modulepath}:${JAVA_INTERMEDIATE_JAR_NAME}.jar" \
@ -606,7 +606,7 @@ java-pkg-simple_src_compile() {
--patch-module "${JAVA_INTERMEDIATE_JAR_NAME}"="${JAVA_INTERMEDIATE_JAR_NAME}.jar" \
${JAVAC_ARGS} $(find ${reldir} -type f -name '*.java')
JAVA_GENTOO_CLASSPATH_EXTRA+=":target/versions/${release}"
JAVA_GENTOO_CLASSPATH_EXTRA+=":${classes}/META-INF/versions/${release}"
done
JAVA_PKG_WANT_SOURCE=${tmp_source}
@ -681,21 +681,7 @@ java-pkg-simple_src_compile() {
fi
# package
local jar_args multi_release=""
if [[ -n ${JAVA_RELEASE_SRC_DIRS[@]} ]]; then
# Preparing the multi_release variable. From multi-release compilation
# the release-specific classes are sorted in target/versions/${release}
# directories.
# TODO:
# Could this possibly be simplified with printf?
pushd target/versions > /dev/null || die
for version in $(ls -d * | sort -g); do
debug-print "Version is ${version}"
multi_release="${multi_release} --release ${version} -C target/versions/${version} . "
done
popd > /dev/null || die
fi
local jar_args
if [[ -e ${classes}/META-INF/MANIFEST.MF ]]; then
sed '/Created-By: /Id' -i ${classes}/META-INF/MANIFEST.MF
@ -703,7 +689,14 @@ java-pkg-simple_src_compile() {
else
jar_args="cf ${JAVA_JAR_FILENAME}"
fi
jar ${jar_args} -C ${classes} . ${multi_release} || die "jar failed"
jar ${jar_args} -C ${classes} . || die "jar failed"
if [[ -n ${JAVA_RELEASE_SRC_DIRS[@]} ]]; then
# From multi-release compilation the release-specific classes are sorted
# in target/classes/META-INF/versions/${release} directories.
echo 'Multi-Release: true' >> "${T}/add-to-MANIFEST.MF" || die "add true"
fi
if [[ -n "${JAVA_AUTOMATIC_MODULE_NAME}" ]]; then
echo "Automatic-Module-Name: ${JAVA_AUTOMATIC_MODULE_NAME}" \
>> "${T}/add-to-MANIFEST.MF" || die "adding module name failed"