summaryrefslogtreecommitdiff
blob: 75d527a5e6ee937f505f53628873d686c5a42041 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/groovy/groovy-1.5.4-r1.ebuild,v 1.2 2009/03/29 16:40:07 betelgeuse Exp $

# Groovy's build system is Ant based, but they use Maven for fetching the dependencies.
# We just have to remove the fetch dependencies target, and then we can use Ant for this ebuild.
#
# Note that in the previous 1.0 ebuild, we used the Ant Maven plugin. We don't do that anymore.

# We currently do not build the embeddable jar (which is created using JarJar). Maybe we should...
# We also don't use automatic build rewriting as there seems to be already some level of support
# in the upstream build system
#

# TODO: We should implement the doc USE flag properly
#

EAPI="2"
WANT_ANT_TASKS="ant-antlr ant-trax"

inherit versionator java-pkg-2 java-ant-2

JAVA_PKG_IUSE="doc"
MY_PV=${PV/_rc/-RC-}
MY_P="${PN}-${MY_PV}"

DESCRIPTION="Groovy is a high-level dynamic language for the JVM"
HOMEPAGE="http://groovy.codehaus.org/"

SRC_URI="http://dist.groovy.codehaus.org/distributions/${PN}-src-${PV}.zip"
LICENSE="codehaus-groovy"
SLOT="1"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="test"

CDEPEND="
	dev-java/asm:2.2
	>=dev-java/antlr-2.7.7:0[java]
	>=dev-java/xstream-1.1.1
	>=dev-java/junit-3.8.2:0
	>=dev-java/jline-0.9.91
	>=dev-java/ant-core-1.7.0
	>=dev-java/commons-cli-1.0
	>=dev-java/mockobjects-0.09
	~dev-java/servletapi-2.4
	=dev-java/mx4j-core-3.0*
	>=dev-java/bsf-2.4
	java-virtuals/jmx

	test? (
		dev-java/jmock
		dev-java/xmlunit
		dev-db/hsqldb
		dev-java/ant-junit
	)

	dev-java/qdox
	"

RDEPEND=">=virtual/jre-1.4
	${CDEPEND}"

DEPEND=">=virtual/jdk-1.4
	app-arch/unzip
	${CDEPEND}"

S="${WORKDIR}/${MY_P}"

JAVA_PKG_BSFIX=""

java_prepare() {
	epatch "${FILESDIR}/${PN}-build.xml.patch"
	java-ant_xml-rewrite -f build.xml --delete -e junit -a fork

	rm -rf bootstrap
	rm -rf security

	mkdir -p target/lib && cd target/lib

	mkdir compile && mkdir runtime && mkdir tools

	cd compile

	java-pkg_jar-from commons-cli-1
	java-pkg_jar-from ant-core
	java-pkg_jar-from antlr
	java-pkg_jar-from asm-2.2
	java-pkg_jar-from xstream
	java-pkg_jar-from mockobjects
	java-pkg_jar-from jline
	java-pkg_jar-from junit
	java-pkg_jar-from servletapi-2.4
	java-pkg_jar-from bsf-2.3
	java-pkg_jar-from --virtual jmx

	# Following is for documentation only

	java-pkg_jar-from qdox-1.6
}

src_compile() {
	eant -DskipTests="true" -DruntimeLibDirectory="target/lib/compile" \
		-DtoolsLibDirectory="target/lib/compile" createJars

	# This works

	#ANT_TASKS="none" eant -Dno.grammars -DruntimeLibDirectory="target/lib/compile" \
	# -DtoolsLibDirectory="target/lib/compile" doc
	#use doc && eant doc
}

src_test() {
	cd "${S}/target/lib" && mkdir test && cd compile

	java-pkg_jar-from jmock-1.0
	java-pkg_jar-from xmlunit-1
	java-pkg_jar-from hsqldb

	cd "${S}"
	ANT_TASKS="ant-junit ant-antlr ant-trax" eant test -DruntimeLibDirectory="target/lib/compile" \
		-DtestLibDirectory="target/lib/compile"
}

src_install() {
	java-pkg_newjar "target/dist/${P}.jar"
	java-pkg_dolauncher "groovyc" --main org.codehaus.groovy.tools.FileSystemCompiler
	java-pkg_dolauncher "groovy" --main groovy.ui.GroovyMain
	java-pkg_dolauncher "groovysh" --main groovy.ui.InteractiveShell
	java-pkg_dolauncher "groovyConsole" --main groovy.ui.Console

	# java-pkg_dolauncher "grok" --main org.codehaus.groovy.tools.Grok Grok does not exist anymore
}