4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
JAVA_PKG_IUSE="doc source test"
|
7 |
|
MAVEN_ID="com.thoughtworks.qdox:qdox:1.12.1"
|
|
7 |
MAVEN_ID="com.thoughtworks.qdox:qdox:2.0.1"
|
|
8 |
JAVA_TESTING_FRAMEWORKS="junit-4"
|
8 |
9 |
|
9 |
|
inherit java-pkg-2
|
|
10 |
inherit java-pkg-2 java-pkg-simple
|
10 |
11 |
|
11 |
12 |
DESCRIPTION="Parser for extracting class/interface/method definitions"
|
12 |
|
HOMEPAGE="https://github.com/codehaus/qdox"
|
13 |
|
SRC_URI="https://github.com/codehaus/qdox/archive/${P}.tar.gz"
|
|
13 |
HOMEPAGE="https://github.com/paul-hammant/qdox"
|
|
14 |
SRC_URI="https://github.com/paul-hammant/qdox/archive/qdox-${PV}.tar.gz"
|
14 |
15 |
|
15 |
16 |
LICENSE="Apache-2.0"
|
16 |
|
SLOT="1.12"
|
|
17 |
SLOT="2"
|
17 |
18 |
KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~ppc-macos ~x64-macos"
|
18 |
19 |
|
19 |
|
S="${WORKDIR}/${PN}-${PN}-${PV}"
|
20 |
|
|
21 |
|
CDEPEND="dev-java/ant-core:0"
|
22 |
|
|
23 |
|
DEPEND=">=virtual/jdk-1.8:*
|
24 |
|
dev-java/byaccj:0
|
25 |
|
>=dev-java/jflex-1.6.1:0
|
26 |
|
dev-java/jmock:1.0
|
27 |
|
test? ( dev-java/junit:0 )
|
28 |
|
${CDEPEND}"
|
29 |
|
|
30 |
|
RDEPEND=">=virtual/jre-1.8:*
|
31 |
|
${CDEPEND}"
|
32 |
|
|
33 |
|
PATCHES=(
|
34 |
|
"${FILESDIR}/jflex-1.6.1.patch"
|
35 |
|
)
|
36 |
|
|
37 |
|
src_prepare() {
|
38 |
|
default
|
39 |
|
|
40 |
|
if ! use test ; then
|
41 |
|
rm src/java/com/thoughtworks/qdox/tools/QDoxTester.java
|
42 |
|
rm -rf src/java/com/thoughtworks/qdox/junit
|
43 |
|
rm -rf src/test
|
44 |
|
fi
|
45 |
|
}
|
|
20 |
DEPEND="
|
|
21 |
dev-java/jflex:0
|
|
22 |
>=virtual/jdk-1.8:*
|
|
23 |
test? (
|
|
24 |
dev-java/junit:4
|
|
25 |
dev-java/mockito:0
|
|
26 |
)
|
|
27 |
"
|
|
28 |
RDEPEND=">=virtual/jre-1.8:*"
|
|
29 |
BDEPEND="dev-java/byaccj:0"
|
|
30 |
|
|
31 |
S="${WORKDIR}/qdox-${P}"
|
|
32 |
|
|
33 |
JAVA_AUTOMATIC_MODULE_NAME="com.thoughtworks.qdox"
|
|
34 |
JAVA_SRC_DIR="src/main/java"
|
|
35 |
JAVA_CLASSPATH_EXTRA="jflex"
|
|
36 |
|
|
37 |
JAVA_TEST_SRC_DIR="src/test/java"
|
|
38 |
JAVA_TEST_RESOURCE_DIRS="src/test/resources"
|
|
39 |
JAVA_TEST_GENTOO_CLASSPATH="
|
|
40 |
junit-4
|
|
41 |
mockito
|
|
42 |
"
|
46 |
43 |
|
47 |
44 |
src_compile() {
|
48 |
|
jflex src/grammar/lexer.flex --skel src/grammar/skeleton.inner -d src/java/com/thoughtworks/qdox/parser/impl/ || die
|
49 |
|
byaccj -v -Jnorun -Jnoconstruct -Jclass=Parser -Jsemantic=Value -Jpackage=com.thoughtworks.qdox.parser.impl src/grammar/parser.y || die
|
50 |
|
mv Parser.java src/java/com/thoughtworks/qdox/parser/impl/ || die
|
51 |
|
|
52 |
|
# create jar
|
53 |
|
mkdir -p build/classes || die
|
54 |
|
|
55 |
|
local cp="$(java-pkg_getjars --build-only ant-core,jmock-1.0)"
|
56 |
|
|
57 |
|
if use test ; then
|
58 |
|
cp="${cp}:$(java-pkg_getjars --build-only junit)"
|
59 |
|
fi
|
60 |
|
|
61 |
|
ejavac -sourcepath . -d build/classes -classpath "${cp}" \
|
62 |
|
$(find . -name "*.java") || die "Cannot compile sources"
|
|
45 |
einfo "Running jflex"
|
|
46 |
jflex src/grammar/lexer.flex src/grammar/commentlexer.flex \
|
|
47 |
-d src/main/java/com/thoughtworks/qdox/parser/impl || die
|
|
48 |
|
|
49 |
einfo "Running byaccj for DefaultJavaCommentParser"
|
|
50 |
byaccj -v \
|
|
51 |
-Jnorun \
|
|
52 |
-Jnoconstruct \
|
|
53 |
-Jclass=DefaultJavaCommentParser \
|
|
54 |
-Jpackage=com.thoughtworks.qdox.parser.impl \
|
|
55 |
src/grammar/commentparser.y || die
|
|
56 |
|
|
57 |
einfo "Running byaccj for Parser"
|
|
58 |
byaccj -v \
|
|
59 |
-Jnorun \
|
|
60 |
-Jnoconstruct \
|
|
61 |
-Jclass=Parser \
|
|
62 |
-Jimplements=CommentHandler \
|
|
63 |
-Jsemantic=Value \
|
|
64 |
-Jpackage=com.thoughtworks.qdox.parser.impl \
|
|
65 |
src/grammar/parser.y || die
|
|
66 |
|
|
67 |
mv Parser.java src/main/java/com/thoughtworks/qdox/parser/impl/ || die
|
|
68 |
mv DefaultJavaCommentParser.java src/main/java/com/thoughtworks/qdox/parser/impl/ || die
|
|
69 |
mv DefaultJavaCommentParserVal.java src/main/java/com/thoughtworks/qdox/parser/impl/ || die
|
63 |
70 |
|
64 |
|
mkdir dist || die
|
65 |
|
cd build/classes || die
|
66 |
|
jar -cvf "${S}"/dist/${PN}.jar com || die "Cannot create JAR"
|
67 |
|
|
68 |
|
# generate javadoc
|
69 |
|
if use doc ; then
|
70 |
|
cd "${S}"
|
71 |
|
mkdir javadoc || die
|
72 |
|
javadoc -d javadoc -sourcepath src/java -subpackages com -classpath "${cp}"
|
73 |
|
fi
|
|
71 |
einfo "Running java-pkg-simple_src_compile"
|
|
72 |
java-pkg-simple_src_compile
|
74 |
73 |
}
|
75 |
74 |
|
76 |
75 |
src_test() {
|
77 |
|
java -cp "${S}"/dist/${PN}.jar:$(java-pkg_getjars --build-only ant-core,junit,jmock-1.0) \
|
78 |
|
com.thoughtworks.qdox.tools.QDoxTester src || die "Tests failed!"
|
79 |
|
}
|
80 |
|
|
81 |
|
src_install() {
|
82 |
|
java-pkg_dojar dist/${PN}.jar
|
83 |
|
|
84 |
|
use source && java-pkg_dosrc src/java/com
|
85 |
|
use doc && java-pkg_dojavadoc javadoc
|
|
76 |
# Too many tests fail with Java 17.
|
|
77 |
local vm_version="$(java-config -g PROVIDES_VERSION)"
|
|
78 |
if ver_test "${vm_version}" -ge 17 ; then
|
|
79 |
einfo "Tests only for Java < 17"
|
|
80 |
else
|
|
81 |
einfo "Running tests"
|
|
82 |
pushd src/test/java || die
|
|
83 |
local JAVA_TEST_RUN_ONLY=$(find * \
|
|
84 |
\( -wholename "**/*Test.java" \
|
|
85 |
-o -name 'TestMultipleLevelGenericInheritance.java' \)\
|
|
86 |
! -name "ClassLibraryBuilderTest.java" \
|
|
87 |
! -name "JavaClassTest.java" \
|
|
88 |
! -name "JavaConstructorTest.java" \
|
|
89 |
! -name "JavaFieldTest.java" \
|
|
90 |
! -name "JavaMethodTest.java" \
|
|
91 |
! -name "JavaPackageTest.java" \
|
|
92 |
! -name "JavaParameterTest.java" \
|
|
93 |
! -name "JavaSourceTest.java" \
|
|
94 |
! -name "JavaTypeTest.java" \
|
|
95 |
! -name "AbstractDocletTagTest.java" \
|
|
96 |
)
|
|
97 |
popd
|
|
98 |
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
|
|
99 |
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
|
|
100 |
java-pkg-simple_src_test
|
|
101 |
fi
|
86 |
102 |
}
|