summaryrefslogtreecommitdiff
blob: 0142cf6a0a6fd3101c4dab7c5ab4f240bc019a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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="com.github.jnr:jnr-posix:3.1.16"
JAVA_TESTING_FRAMEWORKS="junit-4"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="Common cross-project/cross-platform POSIX APIs"
HOMEPAGE="https://github.com/jnr/jnr-posix"
SRC_URI="https://github.com/jnr/${PN}/archive/${P}.tar.gz"
S="${WORKDIR}/${PN}-${P}"

LICENSE="EPL-2.0 GPL-2 LGPL-2.1"
SLOT="3.0"
KEYWORDS="~amd64 ~arm arm64 ppc64 x86"

CP_DEPEND="
	>=dev-java/jnr-ffi-2.2.12:2
	dev-java/jnr-constants:0
"

DEPEND="${CP_DEPEND}
	>=virtual/jdk-11:*"

RDEPEND="${CP_DEPEND}
	>=virtual/jre-1.8:*"

JAVA_AUTOMATIC_MODULE_NAME="org.jnrproject.posix"
JAVA_SRC_DIR="src/main/java"

JAVA_TEST_GENTOO_CLASSPATH="junit-4"
JAVA_TEST_SRC_DIR="src/test/java"

src_test() {
	sed \
		-e '/import org.junit.Test/a import org.junit.Ignore;' \
		-i src/test/java/jnr/posix/FileTest.java || die

	if use ppc64; then
		# Ignore testMessageHdrMultipleControl
		# https://bugs.gentoo.org/866199
		# https://github.com/jnr/jnr-posix/issues/178
		sed \
			-e '/testMessageHdrMultipleControl/i @Ignore' \
			-e '/import org.junit.Test/a import org.junit.Ignore;' \
			-i src/test/java/jnr/posix/LinuxPOSIXTest.java || die
	fi

	if use arm; then
		# https://bugs.gentoo.org/866692
		sed \
			-e '/utimensatRelativePath()/i @Ignore' \
			-e '/utimesDefaultValuesTest()/i @Ignore' \
			-e '/futimeTest()/i @Ignore' \
			-e '/utimesTest()/i @Ignore' \
			-e '/utimesPointerTest()/i @Ignore' \
			-e '/utimensatAbsolutePath()/i @Ignore' \
			-e '/futimens()/i @Ignore' \
			-i src/test/java/jnr/posix/FileTest.java || die
		sed \
			-e '/import org.junit.Test/a import org.junit.Ignore;' \
			-e '/ioprioThreadedTest()/i @Ignore' \
			-e '/testPosixFadvise()/i @Ignore' \
			-i src/test/java/jnr/posix/LinuxPOSIXTest.java || die
		sed \
			-e '/import org.junit.Test/a import org.junit.Ignore;' \
			-e '/testSetRlimitPointerLinux()/i @Ignore' \
			-e '/testGetRLimitPointer()/i @Ignore' \
			-i src/test/java/jnr/posix/ProcessTest.java || die
	fi

	JAVA_TEST_EXCLUDES=(
		# https://github.com/jnr/jnr-posix/blob/jnr-posix-3.1.16/pom.xml#L185
		# <exclude>**/windows/*Test.java</exclude>
		"jnr.posix.windows.WindowsFileTest"
		"jnr.posix.windows.WindowsHelpersTest"
	)
	local vm_version="$(java-config -g PROVIDES_VERSION)"
	if [[ "${vm_version}" -ge "17" ]] ; then
		JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.io=ALL-UNNAMED )
		JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.util=ALL-UNNAMED )
		# Some tests in jnr.posix.FileTest fail with jdk-17
		sed \
			-e '/flockTest()/i @Ignore' \
			-e '/dupTest()/i @Ignore' \
			-e '/closeTest()/i @Ignore' \
			-e '/fcntlDupfdWithArgTest()/i @Ignore' \
			-i src/test/java/jnr/posix/FileTest.java || die
	fi
	java-pkg-simple_src_test
}