* [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml
@ 2023-09-28 5:10 Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11 Volkmar W. Pogatzki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Volkmar W. Pogatzki @ 2023-09-28 5:10 UTC (permalink / raw
To: gentoo-dev
The etestng function is presently limited to running test classes and
has no option for running testng.xml files. Using testng.xml in an
ebuild requires manual coding in src_test().
This change adds a switch to the etestng function which allows running
default src_test() with either testng.xml files or test classes.
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-utils-2.eclass | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index c1f42408e462..3fe64e1c317d 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1886,7 +1886,7 @@ ejunit4() {
# @CODE
# $1 - -cp or -classpath
# $2 - the classpath passed to it
-# $@ - test classes for testng to run.
+# $@ - test classes or testng.xml for testng to run.
# @CODE
etestng() {
debug-print-function ${FUNCNAME} $*
@@ -1910,6 +1910,7 @@ etestng() {
-cp ${cp}
-Djava.io.tmpdir="${T}"
-Djava.awt.headless=true
+ -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}"
${JAVA_TEST_EXTRA_ARGS[@]}
${runner}
${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
@@ -1922,7 +1923,11 @@ etestng() {
)
fi
- args+=( -testclass ${tests} )
+ if [[ "${test%.xml}" == "${test}" ]]; then
+ args+=( -testclass ${tests} )
+ else
+ args+=( ${tests%,} )
+ fi
debug-print "java ${args[@]}"
java ${args[@]} || die "Running TestNG failed."
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11
2023-09-28 5:10 [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml Volkmar W. Pogatzki
@ 2023-09-28 5:10 ` Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 3/4] java-pkg-simple.eclass: avoid reverse dependency for dev-java/testng Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 4/4] java-utils-2.eclass: " Volkmar W. Pogatzki
2 siblings, 0 replies; 4+ messages in thread
From: Volkmar W. Pogatzki @ 2023-09-28 5:10 UTC (permalink / raw
To: gentoo-dev
- switches slot of dependency assertj-core 2 -> 3
- removes test restriction
- moves "test" from IUSE to JAVA_PKG_IUSE
- sets the "-verbose 3" option to get the PASSED/FAILED information
- uses older version of jcommander 0 -> 1.64
- uses the DOCS array instead of dodoc
- uses JAVA_RESOURCE_DIRS instead of java-pkg_addres which allows
removing src_compile()
- chops long lines
- adds MAVEN_ID so that java-ebuilder can find it
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
dev-java/testng: fixup
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
dev-java/testng/Manifest | 5 ++
dev-java/testng/metadata.xml | 2 +-
dev-java/testng/testng-6.11.ebuild | 100 +++++++++++++++++++++++++++++
3 files changed, 106 insertions(+), 1 deletion(-)
create mode 100644 dev-java/testng/testng-6.11.ebuild
diff --git a/dev-java/testng/Manifest b/dev-java/testng/Manifest
index 310f28a1c68c..aaf68f18ad4d 100644
--- a/dev-java/testng/Manifest
+++ b/dev-java/testng/Manifest
@@ -1 +1,6 @@
+DIST apache-groovy-binary-2.4.21.zip 37467992 BLAKE2B e0f925bad53f0f8a7012f0bea420ec3e5986118cc23cd677a11f619284754eacc15c3012cf780063fef574053781bba924a86e5fa2ac284d86f349ad18173704 SHA512 e2f73405d7521b99e3ce5622cffcc505bbc039ccb1c35696fc895d648a9325937a136cf97a229f7ac1b90b63ad8603881350c4d41e514ad45233fb333d76d510
+DIST groovy-all-2.4.7.jar 7015434 BLAKE2B 23d22ddd78229c485ed9384169acee154258644249b856661e17d1d0efb5518e32473a26962b5d657a09b41d490813ed76254820ffdf39e83869209617b66c2d SHA512 4c26ff9f7137c0506c95f7ba1d4228ce57e16d87b77dd1d114390224207d71d3958460c7b5a239d5f41596ab87e7f4aa7aaea1dfce19a50badf8f9b818329c54
+DIST jquery-3.5.1.jar 313070 BLAKE2B 76abfbd21d83f72a3cfcb666f3a2fcfcf5975e723a462996bac9701caf6b59cb9998746af713ebb1f6bfe49cce91544216cc65dc6819e95e8a15930744685415 SHA512 9f560415b36875958ff1d3c6d37fa79d6d134c5f5fc7719dd21db36d1f24dec39787834b2a9ffb104ec6b56e725ccc524a8ff9b189ced3d68e24296b2daae720
+DIST spock-core-1.0-groovy-2.4.jar 588030 BLAKE2B 68d8fad8b6ffb45a18778797ea23d4f3b09256bf4e9f207ee666d07572399cd13522e6f1590219a80e23f6906a2e9eaf1f22c6a3c01717e8c1e99b5d37b89210 SHA512 078c0b16688eaa3134043e58ed4273981797ea92f08723b5508c7d7e4f635278dd5ca731fb294da2a1f35674623d969ee423d4344c2c822e1d4cb8d4f3383790
+DIST testng-6.11.tar.gz 677522 BLAKE2B 2e7bf30fcf805cce5a7ec42f22c39e9f4678642fcde9752c51d118e655189805661edeeff1a3db0e960c79e7542fe25ab8fa6995f142da12b3adc8753fd8a361 SHA512 996d7a18399e16626756b7a790182c7b6bf3453280209d0a09d4a509d698fcad1a80e58ec36702de95bd59c90c237463719ad44934c14390620fc9655d871252
DIST testng-6.9.10.tar.gz 6271781 BLAKE2B 5b77f4b1d9bfdca6749a1d33f465a30bcd9ab9dd9fc37abf8148301c24d6bf287224d9886c0f681deac54e12f9460139ce2a2058b3d160c05cf8fcb9f7808373 SHA512 ed9ad1ced20904ab261d2a233f3fa43ee1ea31778e992cdd27459811b256a6998d8385dd01ff72821133208a1fbd72aa3599a4b8bc0eb4d7b696d34593f9567e
diff --git a/dev-java/testng/metadata.xml b/dev-java/testng/metadata.xml
index 43f8b5d27805..f79c946be086 100644
--- a/dev-java/testng/metadata.xml
+++ b/dev-java/testng/metadata.xml
@@ -6,6 +6,6 @@
<name>Java</name>
</maintainer>
<upstream>
- <remote-id type="github">cbeust/testng</remote-id>
+ <remote-id type="github">testng-team/testng</remote-id>
</upstream>
</pkgmetadata>
diff --git a/dev-java/testng/testng-6.11.ebuild b/dev-java/testng/testng-6.11.ebuild
new file mode 100644
index 000000000000..fd5411152497
--- /dev/null
+++ b/dev-java/testng/testng-6.11.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="org.testng:testng:6.11"
+JAVA_TESTING_FRAMEWORKS="testng"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="Testing framework inspired by JUnit and NUnit with new features"
+HOMEPAGE="https://testng.org/"
+# Presently we install the binary version of jquery since it is not packaged in ::gentoo.
+JQV="3.5.1"
+# Currently we bundle the binary versions of spock-core, groovy-all and apache-groovy-binary.
+# These are used only for tests, we don't install them.
+SCV="1.0-groovy-2.4"
+GAV="2.4.7"
+AGV="2.4.21"
+SRC_URI="https://github.com/testng-team/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+ https://repo1.maven.org/maven2/org/webjars/jquery/${JQV}/jquery-${JQV}.jar
+ test? (
+ https://repo1.maven.org/maven2/org/spockframework/spock-core/${SCV}/spock-core-${SCV}.jar
+ https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/${GAV}/groovy-all-${GAV}.jar
+ https://downloads.apache.org/groovy/${AGV}/distribution/apache-groovy-binary-${AGV}.zip
+ )"
+S="${WORKDIR}/${P}"
+
+LICENSE="Apache-2.0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+SLOT="0"
+
+CP_DEPEND="
+ dev-java/ant-core:0
+ dev-java/bsh:0
+ dev-java/guice:4
+ dev-java/jcommander:1.64
+ dev-java/junit:4
+ dev-java/snakeyaml:0
+"
+
+DEPEND="${CP_DEPEND}
+ >=virtual/jdk-1.8:*
+ test? ( dev-java/assertj-core:3 )"
+
+RDEPEND="${CP_DEPEND}
+ >=virtual/jre-1.8:*"
+
+BDEPEND="app-arch/unzip"
+
+DOCS=( README {ANNOUNCEMENT,CHANGES}.txt )
+
+JAVA_RESOURCE_DIRS="src/main/resources"
+JAVA_SRC_DIR="src/main/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="assertj-core-3"
+JAVA_TEST_RESOURCE_DIRS="src/test/resources"
+JAVA_TEST_RUN_ONLY="src/test/resources/testng.xml"
+JAVA_TEST_SRC_DIR="src/test/java"
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ java-pkg_clean ! -path "./src/*"
+
+ rm src/main/resources/META-INF/MANIFEST.MF || die
+}
+
+src_test() {
+ # This contains the compiler groovyc
+ unzip "${DISTDIR}/apache-groovy-binary-${AGV}.zip"
+
+ JAVA_GENTOO_CLASSPATH_EXTRA=":${DISTDIR}/spock-core-${SCV}.jar"
+
+ ejavac -cp "${JAVA_TEST_SRC_DIR}:${PN}.jar:$(java-pkg_getjars guava)" \
+ src/test/java/test/SimpleBaseTest.java || die
+
+ "groovy-${AGV}/bin/groovyc" \
+ -cp "${JAVA_TEST_SRC_DIR}:${DISTDIR}/spock-core-${SCV}.jar" \
+ -d target/test-classes \
+ src/test/groovy/test/groovy/* || die
+
+ JAVA_GENTOO_CLASSPATH_EXTRA+=":${DISTDIR}/groovy-all-${GAV}.jar"
+ java-pkg-simple_src_test
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ java-pkg_dolauncher ${PN} --main org.testng.TestNG
+
+ java-pkg_newjar "${DISTDIR}/jquery-${JQV}.jar" jquery.jar
+ java-pkg_register-dependency testng jquery.jar
+
+ java-pkg_register-ant-task
+
+ if use doc; then
+ docinto html
+ dodoc -r doc
+ fi
+}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-dev] [PATCH 3/4] java-pkg-simple.eclass: avoid reverse dependency for dev-java/testng
2023-09-28 5:10 [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11 Volkmar W. Pogatzki
@ 2023-09-28 5:10 ` Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 4/4] java-utils-2.eclass: " Volkmar W. Pogatzki
2 siblings, 0 replies; 4+ messages in thread
From: Volkmar W. Pogatzki @ 2023-09-28 5:10 UTC (permalink / raw
To: gentoo-dev
Presently, when using testng in JAVA_TESTING_FRAMEWORKS, it gets added
to test dependencies. Emerging dev-java/testng with USE=test would lead
to a reverse dependency on itself.
This change allows emerging / testing testng with the ebuild specifying
JAVA_TESTING_FRAMEWORKS="testng" without such reverse dependency.
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-pkg-simple.eclass | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index abac18ca03f8..0ca0914aeee0 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2022 Gentoo Authors
+# Copyright 2004-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-pkg-simple.eclass
@@ -47,7 +47,8 @@ if has test ${JAVA_PKG_IUSE}; then
test_deps+=" amd64? ( dev-util/pkgdiff
dev-util/japi-compliance-checker )";;
testng)
- test_deps+=" dev-java/testng:0";;
+ [[ ${PN} != testng ]] && \
+ test_deps+=" dev-java/testng:0";;
esac
done
[[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-dev] [PATCH 4/4] java-utils-2.eclass: avoid reverse dependency for dev-java/testng
2023-09-28 5:10 [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11 Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 3/4] java-pkg-simple.eclass: avoid reverse dependency for dev-java/testng Volkmar W. Pogatzki
@ 2023-09-28 5:10 ` Volkmar W. Pogatzki
2 siblings, 0 replies; 4+ messages in thread
From: Volkmar W. Pogatzki @ 2023-09-28 5:10 UTC (permalink / raw
To: gentoo-dev
This change depends on the correlating change on the
java-pkg-simple.eclass.
For testing dev-java/testng before having it installed it is not
possible to use java-pkg_getjars. This change adds a condition so
that this case uses the freshly compiled testng.jar.
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-utils-2.eclass | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 3fe64e1c317d..133dde59cebd 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1892,7 +1892,11 @@ etestng() {
debug-print-function ${FUNCNAME} $*
local runner=org.testng.TestNG
- local cp=$(java-pkg_getjars --with-dependencies testng)
+ if [[ ${PN} != testng ]]; then
+ local cp=$(java-pkg_getjars --with-dependencies testng)
+ else
+ local cp=testng.jar
+ fi
local tests
if [[ ${1} = -cp || ${1} = -classpath ]]; then
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-28 5:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28 5:10 [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11 Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 3/4] java-pkg-simple.eclass: avoid reverse dependency for dev-java/testng Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 4/4] java-utils-2.eclass: " Volkmar W. Pogatzki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox