/[gentoo-x86]/eclass/ant-tasks.eclass
Gentoo

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Fri Feb 2 22:59:53 2007 UTC (7 years, 7 months ago) by caster
Branch: MAIN
Changes since 1.3: +6 -2 lines
Add java-ant-2 to inherit, thanks to Betelgeuse. But disable its generic ant-core dep and make
it rewrite only the one build.xml used.

1 # Eclass for building dev-java/ant-* packages
2 #
3 # Copyright 2007 Gentoo Foundation
4 # Distributed under the terms of the GNU General Public License, v2 or later
5 # Author Vlastimil Babka <caster@gentoo.org>
6 # $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.3 2007/01/21 21:37:02 caster Exp $
7
8 # we set ant-core dep ourselves, restricted
9 JAVA_ANT_DISABLE_ANT_CORE_DEP=true
10 # rewriting build.xml for are the testcases has no reason atm
11 JAVA_PKG_BSFIX_ALL=no
12 inherit versionator java-pkg-2 java-ant-2
13
14 EXPORT_FUNCTIONS src_unpack src_compile src_install
15
16 # -----------------------------------------------------------------------------
17 # @eclass-begin
18 # @eclass-shortdesc Eclass for building dev-java/ant-* packages
19 # @eclass-maintainer java@gentoo.org
20 #
21 # This eclass provides functionality and default ebuild variables for building
22 # dev-java/ant-* packages easily.
23 #
24 # -----------------------------------------------------------------------------
25
26 # -----------------------------------------------------------------------------
27 # @variable-preinherit ANT_TASK_JDKVER
28 # @variable-default 1.4
29 #
30 # Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can
31 # be overriden from ebuild BEFORE inheriting this eclass.
32 # -----------------------------------------------------------------------------
33 ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4}
34
35 # -----------------------------------------------------------------------------
36 # @variable-preinherit ANT_TASK_JREVER
37 # @variable-default 1.4
38 #
39 # Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can
40 # be overriden from ebuild BEFORE inheriting this eclass.
41 # -----------------------------------------------------------------------------
42 ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4}
43
44 # -----------------------------------------------------------------------------
45 # @variable-internal ANT_TASK_NAME
46 # @variable-default the rest of $PN after "ant-"
47 #
48 # The name of this ant task as recognized by ant's build.xml, derived from $PN.
49 # -----------------------------------------------------------------------------
50 ANT_TASK_NAME="${PN#ant-}"
51
52 # -----------------------------------------------------------------------------
53 # @variable-preinherit ANT_TASK_DEPNAME
54 # @variable-default $ANT_TASK_NAME
55 #
56 # Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
57 # that this one depends on. Defaults to the name of ant task, ebuild can
58 # override it before inheriting this eclass.
59 # -----------------------------------------------------------------------------
60 ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
61
62 # -----------------------------------------------------------------------------
63 # @variable-internal ANT_TASK_PV
64 # @variable-default Just the number in $PV without any beta/RC suffixes
65 #
66 # Version of ant-core this task is intended to register and thus load with.
67 # -----------------------------------------------------------------------------
68 ANT_TASK_PV="${PV}"
69
70 # special care for beta/RC releases
71 if [[ ${PV} == *beta* ]]; then
72 MY_PV=${PV/_beta/Beta}
73 SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
74 ANT_TASK_PV=$(get_version_component_range 1-3)
75 elif [[ ${PV} == *_rc* ]]; then
76 MY_PV=${PV/_rc/RC}
77 SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
78 ANT_TASK_PV=$(get_version_component_range 1-3)
79 else
80 # default for final releases
81 MY_PV=${PV}
82 SRC_URI_PREFIX="mirror://apache/ant/source"
83 fi
84
85 # source/workdir name
86 MY_P="apache-ant-${MY_PV}"
87
88 # -----------------------------------------------------------------------------
89 # Default values for standard ebuild variables, can be overriden from ebuild.
90 # -----------------------------------------------------------------------------
91 DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
92 HOMEPAGE="http://ant.apache.org/"
93 SRC_URI="${SRC_URI_PREFIX}/${MY_P}-src.tar.bz2
94 mirror://gentoo/ant-${PV}-gentoo.tar.bz2"
95 LICENSE="Apache-2.0"
96 SLOT="0"
97 IUSE=""
98
99 RDEPEND=">=virtual/jre-${ANT_TASK_JREVER}
100 ~dev-java/ant-core-${PV}"
101 DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER}
102 ${RDEPEND}"
103
104 S="${WORKDIR}/${MY_P}"
105
106 # ------------------------------------------------------------------------------
107 # @eclass-src_unpack
108 #
109 # Is split into two parts, defaults to both of them ('all').
110 # base: performs the unpack, build.xml replacement and symlinks ant.jar from
111 # ant-core
112 # jar-dep: symlinks the jar file(s) from dependency package
113 # ------------------------------------------------------------------------------
114 ant-tasks_src_unpack() {
115 [[ -z "${1}" ]] && ant-tasks_src_unpack all
116
117 while [[ -n "${1}" ]]; do
118 case ${1} in
119 base)
120 unpack ${A}
121 cd "${S}"
122
123 # replace build.xml with our modified for split building
124 mv -f ${WORKDIR}/build.xml .
125
126 cd lib
127 # remove bundled xerces
128 rm -f *.jar
129
130 # ant.jar to build against
131 java-pkg_jar-from --build-only ant-core ant.jar;;
132 jar-dep)
133 # get jar from the dependency package
134 java-pkg_jar-from ${ANT_TASK_DEPNAME};;
135 all)
136 ant-tasks_src_unpack base jar-dep;;
137 esac
138 shift
139 done
140
141 }
142
143 # ------------------------------------------------------------------------------
144 # @eclass-src_compile
145 #
146 # Compiles the jar with installed ant-core.
147 # ------------------------------------------------------------------------------
148 ant-tasks_src_compile() {
149 ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
150 }
151
152 # ------------------------------------------------------------------------------
153 # @eclass-src_install
154 #
155 # Installs the jar and registers its presence for the ant launcher script.
156 # Version param ensures it won't get loaded (thus break) when ant-core is
157 # updated to newer version.
158 # ------------------------------------------------------------------------------
159 ant-tasks_src_install() {
160 java-pkg_dojar build/lib/${PN}.jar
161 java-pkg_register-ant-task --version "${ANT_TASK_PV}"
162 }

  ViewVC Help
Powered by ViewVC 1.1.20