public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/java-ebuilder:master commit in: maven/eclass/
@ 2020-08-05 14:31 Miroslav Šulc
  0 siblings, 0 replies; only message in thread
From: Miroslav Šulc @ 2020-08-05 14:31 UTC (permalink / raw
  To: gentoo-commits

commit:     6630c8b0d4c1beb5dee68d4481487e8acd0340e4
Author:     zongyu <zzy2529420793 <AT> gmail <DOT> com>
AuthorDate: Wed Aug  5 04:04:34 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 04:05:29 2020 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=6630c8b0

update java-pkg-maven: recogize files by suffixes

Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>

 maven/eclass/java-pkg-maven.eclass | 45 ++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/maven/eclass/java-pkg-maven.eclass b/maven/eclass/java-pkg-maven.eclass
index d926cc3..fb41bb2 100644
--- a/maven/eclass/java-pkg-maven.eclass
+++ b/maven/eclass/java-pkg-maven.eclass
@@ -13,23 +13,30 @@
 
 EXPORT_FUNCTIONS src_unpack
 
-# @ECLASS-VARIABLE: JAVA_SOURCE_FILENAME
+# @ECLASS-VARIABLE: JAVA_SRC_DIR
 # @DESCRIPTION:
-# The filename of the source code.
-: ${JAVA_SOURCE_FILENAME:=${P}-sources.jar}
-
-# @ECLASS-VARIABLE: JAVA_TEST_SOURCE_FILENAME
-# @DESCRIPTION:
-# The filename of the source code for launch testing.
-: ${JAVA_TEST_SOURCE_FILENAME:=${P}-test-sources.jar}
+# A directory relative to ${S} which contains the source code.
+# source code distributed by Maven Central are exactly the root of
+# the source code, we need to assign them a separate directory to
+# avoid the situation that the source code, the resources and the
+# source code for testing are mixed in ${S}.
+#
+: ${JAVA_SRC_DIR:=src/main/java}
 
 # @ECLASS-VARIABLE: JAVA_RESOURCE_DIRS
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# A directory relative to ${S} which contain the resources of the
+# A directory relative to ${S} which contains the resources of the
 # application. Give it a default value to handle src_unpack.
 : ${JAVA_RESOURCE_DIRS:=src/main/resources}
 
+# @ECLASS-VARIABLE: JAVA_RESOURCE_DIRS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A directory relative to ${S} which contains the source code for testing
+# the application. Give it a default value to handle src_unpack.
+: ${JAVA_TEST_SRC_DIR:=src/test/java}
+
 # @FUNCTION: java-pkg-binjar_src_unpack
 # @DESCRIPTION:
 # Copy the binary jar into the expected place of java-pkg-simple.  Do
@@ -37,23 +44,27 @@ EXPORT_FUNCTIONS src_unpack
 java-pkg-maven_src_unpack() {
 	for file in ${A}; do
 		case ${file} in
-			${JAVA_BINJAR_FILENAME}) ;;
-			${JAVA_SOURCE_FILENAME})
-				mkdir -p "${S}"/${JAVA_SRC_DIR}\
-					|| die "Could not create ${JAVA_SRC_DIR}"
-				unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_SRC_DIR}\
-					|| die "Could not unzip source code" ;;
-			${JAVA_TEST_SOURCE_FILENAME})
+			*-test-sources.jar)
 				mkdir -p "${S}"/${JAVA_TEST_SRC_DIR}\
 					|| die "Could not create ${JAVA_TEST_SRC_DIR}"
 				unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_TEST_SRC_DIR}\
 					|| die "Could not unzip source code for testing" ;;
+			*-sources.jar)
+				mkdir -p "${S}"/${JAVA_SRC_DIR}\
+					|| die "Could not create ${JAVA_SRC_DIR}"
+				unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_SRC_DIR}\
+					|| die "Could not unzip source code"
+				if [[ -d "${S}"/${JAVA_SRC_DIR}/META-INF ]] ; then
+					rm "${S}"/${JAVA_SRC_DIR}/META-INF -r || die
+				fi ;;
+			*)
+				unpack ${file};;
 		esac
 	done
 
 	# the resources (maven resources are bundled inside source file)
+	mkdir -p $(dirname "${S}"/${JAVA_RESOURCE_DIRS}) || die
 	cp "${S}"/${JAVA_SRC_DIR} "${S}"/${JAVA_RESOURCE_DIRS} -r || die
-	rm "${S}"/${JAVA_RESOURCE_DIRS}/META-INF -r || die
 	find "${S}"/${JAVA_RESOURCE_DIRS} -type f ! -name \*.properties \
 		-exec rm {} \; || die
 }


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-05 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-05 14:31 [gentoo-commits] proj/java-ebuilder:master commit in: maven/eclass/ Miroslav Šulc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox