Gentoo Archives: gentoo-commits

From: "Miroslav Šulc" <fordfrog@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java-ebuilder:master commit in: maven/eclass/
Date: Wed, 05 Aug 2020 14:31:55
Message-Id: 1596600329.6630c8b0d4c1beb5dee68d4481487e8acd0340e4.fordfrog@gentoo
1 commit: 6630c8b0d4c1beb5dee68d4481487e8acd0340e4
2 Author: zongyu <zzy2529420793 <AT> gmail <DOT> com>
3 AuthorDate: Wed Aug 5 04:04:34 2020 +0000
4 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 5 04:05:29 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=6630c8b0
7
8 update java-pkg-maven: recogize files by suffixes
9
10 Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>
11
12 maven/eclass/java-pkg-maven.eclass | 45 ++++++++++++++++++++++++--------------
13 1 file changed, 28 insertions(+), 17 deletions(-)
14
15 diff --git a/maven/eclass/java-pkg-maven.eclass b/maven/eclass/java-pkg-maven.eclass
16 index d926cc3..fb41bb2 100644
17 --- a/maven/eclass/java-pkg-maven.eclass
18 +++ b/maven/eclass/java-pkg-maven.eclass
19 @@ -13,23 +13,30 @@
20
21 EXPORT_FUNCTIONS src_unpack
22
23 -# @ECLASS-VARIABLE: JAVA_SOURCE_FILENAME
24 +# @ECLASS-VARIABLE: JAVA_SRC_DIR
25 # @DESCRIPTION:
26 -# The filename of the source code.
27 -: ${JAVA_SOURCE_FILENAME:=${P}-sources.jar}
28 -
29 -# @ECLASS-VARIABLE: JAVA_TEST_SOURCE_FILENAME
30 -# @DESCRIPTION:
31 -# The filename of the source code for launch testing.
32 -: ${JAVA_TEST_SOURCE_FILENAME:=${P}-test-sources.jar}
33 +# A directory relative to ${S} which contains the source code.
34 +# source code distributed by Maven Central are exactly the root of
35 +# the source code, we need to assign them a separate directory to
36 +# avoid the situation that the source code, the resources and the
37 +# source code for testing are mixed in ${S}.
38 +#
39 +: ${JAVA_SRC_DIR:=src/main/java}
40
41 # @ECLASS-VARIABLE: JAVA_RESOURCE_DIRS
42 # @DEFAULT_UNSET
43 # @DESCRIPTION:
44 -# A directory relative to ${S} which contain the resources of the
45 +# A directory relative to ${S} which contains the resources of the
46 # application. Give it a default value to handle src_unpack.
47 : ${JAVA_RESOURCE_DIRS:=src/main/resources}
48
49 +# @ECLASS-VARIABLE: JAVA_RESOURCE_DIRS
50 +# @DEFAULT_UNSET
51 +# @DESCRIPTION:
52 +# A directory relative to ${S} which contains the source code for testing
53 +# the application. Give it a default value to handle src_unpack.
54 +: ${JAVA_TEST_SRC_DIR:=src/test/java}
55 +
56 # @FUNCTION: java-pkg-binjar_src_unpack
57 # @DESCRIPTION:
58 # Copy the binary jar into the expected place of java-pkg-simple. Do
59 @@ -37,23 +44,27 @@ EXPORT_FUNCTIONS src_unpack
60 java-pkg-maven_src_unpack() {
61 for file in ${A}; do
62 case ${file} in
63 - ${JAVA_BINJAR_FILENAME}) ;;
64 - ${JAVA_SOURCE_FILENAME})
65 - mkdir -p "${S}"/${JAVA_SRC_DIR}\
66 - || die "Could not create ${JAVA_SRC_DIR}"
67 - unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_SRC_DIR}\
68 - || die "Could not unzip source code" ;;
69 - ${JAVA_TEST_SOURCE_FILENAME})
70 + *-test-sources.jar)
71 mkdir -p "${S}"/${JAVA_TEST_SRC_DIR}\
72 || die "Could not create ${JAVA_TEST_SRC_DIR}"
73 unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_TEST_SRC_DIR}\
74 || die "Could not unzip source code for testing" ;;
75 + *-sources.jar)
76 + mkdir -p "${S}"/${JAVA_SRC_DIR}\
77 + || die "Could not create ${JAVA_SRC_DIR}"
78 + unzip -q -o "${DISTDIR}"/${file} -d "${S}"/${JAVA_SRC_DIR}\
79 + || die "Could not unzip source code"
80 + if [[ -d "${S}"/${JAVA_SRC_DIR}/META-INF ]] ; then
81 + rm "${S}"/${JAVA_SRC_DIR}/META-INF -r || die
82 + fi ;;
83 + *)
84 + unpack ${file};;
85 esac
86 done
87
88 # the resources (maven resources are bundled inside source file)
89 + mkdir -p $(dirname "${S}"/${JAVA_RESOURCE_DIRS}) || die
90 cp "${S}"/${JAVA_SRC_DIR} "${S}"/${JAVA_RESOURCE_DIRS} -r || die
91 - rm "${S}"/${JAVA_RESOURCE_DIRS}/META-INF -r || die
92 find "${S}"/${JAVA_RESOURCE_DIRS} -type f ! -name \*.properties \
93 -exec rm {} \; || die
94 }