summaryrefslogtreecommitdiff
path: root/dev-java/miglayout/miglayout-5.3.ebuild
blob: 06d13085cba07bcb6dffbfc627d7f5abd7d47aea (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
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="doc source test"
MAVEN_ID="com.miglayout:miglayout-core:5.0 com.miglayout:miglayout-swing:5.0"
JAVA_TESTING_FRAMEWORKS="junit-4"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="MiGLayout - Java Layout Manager for Swing, SWT and JavaFX"
HOMEPAGE="https://miglayout.com/"
SRC_URI="https://github.com/mikaelgrev/miglayout/archive/V${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${P}"

LICENSE="BSD"
SLOT="5"
KEYWORDS="~amd64"

RDEPEND=">=virtual/jre-1.8:*"
DEPEND=">=virtual/jdk-1.8:*"

JAVA_TEST_GENTOO_CLASSPATH="junit-4"
JAVA_TEST_RUN_ONLY="net.miginfocom.swing.MigLayoutTest"
JAVA_TEST_SRC_DIR="swing/src/test/java"

src_compile() {
	einfo "Compiling miglayout-core.jar"
	JAVA_JAR_FILENAME="miglayout-core.jar"
	JAVA_SRC_DIR="core/src/main/java"
	java-pkg-simple_src_compile
	JAVA_GENTOO_CLASSPATH_EXTRA+=":miglayout-core.jar"
	rm -r target || die

	einfo "Compiling miglayout-wingore.jar"
	JAVA_JAR_FILENAME="miglayout-swing.jar"
	JAVA_SRC_DIR="swing/src/main/java"
	java-pkg-simple_src_compile
	JAVA_GENTOO_CLASSPATH_EXTRA+=":miglayout-swing.jar"
	rm -r target || die

	if use doc; then
		einfo "Compiling javadocs"
		JAVA_SRC_DIR=(
			"core/src/main/java"
			"swing/src/main/java"
		)
		JAVA_JAR_FILENAME="ignoreme.jar"
		java-pkg-simple_src_compile
	fi
}

src_test() {
	# There was 1 failure:
	# 1) testDPIScaling(net.miginfocom.swing.MigLayoutTest)
	# java.awt.HeadlessException
	#         at java.desktop/sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:122)
	#         at net.miginfocom.swing.MigLayoutTest.testDPIScaling(MigLayoutTest.java:28)
	sed \
		-e '/import org.junit.Test/a import org.junit.Ignore;' \
		-e '/testDPIScaling()/i @Ignore' \
		-i swing/src/test/java/net/miginfocom/swing/MigLayoutTest.java || die
}

src_install() {
	java-pkg_dojar "miglayout-core.jar"
	java-pkg_dojar "miglayout-swing.jar"

	if use doc; then
		java-pkg_dojavadoc target/api
	fi

	if use source; then
		java-pkg_dosrc "core/src/main/java/*"
		java-pkg_dosrc "swing/src/main/java/*"
	fi
}