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

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Thu Dec 25 00:39:03 2008 UTC (5 years, 8 months ago) by caster
Branch: MAIN
Changes since 1.6: +7 -1 lines
Add a blocker on dev-java/ant-tasks for tasks with version >=1.7.1 to solve bug #252324.

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.6 2008/07/14 21:38:14 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} == *beta2* ]]; then
72 MY_PV=${PV/_beta2/beta}
73 UPSTREAM_PREFIX="http://people.apache.org/dist/ant/v1.7.1beta2/src"
74 GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
75 ANT_TASK_PV=$(get_version_component_range 1-3)
76 elif [[ ${PV} == *_rc* ]]; then
77 MY_PV=${PV/_rc/RC}
78 UPSTREAM_PREFIX="http://dev.gentoo.org/~caster/distfiles"
79 GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
80 ANT_TASK_PV=$(get_version_component_range 1-3)
81 else
82 # default for final releases
83 MY_PV=${PV}
84 UPSTREAM_PREFIX="mirror://apache/ant/source"
85 GENTOO_PREFIX="mirror://gentoo"
86 fi
87
88 # source/workdir name
89 MY_P="apache-ant-${MY_PV}"
90
91 # -----------------------------------------------------------------------------
92 # Default values for standard ebuild variables, can be overriden from ebuild.
93 # -----------------------------------------------------------------------------
94 DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
95 HOMEPAGE="http://ant.apache.org/"
96 SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
97 ${GENTOO_PREFIX}/ant-${PV}-gentoo.tar.bz2"
98 LICENSE="Apache-2.0"
99 SLOT="0"
100 IUSE=""
101
102 RDEPEND=">=virtual/jre-${ANT_TASK_JREVER}
103 ~dev-java/ant-core-${PV}"
104 DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER}
105 ${RDEPEND}"
106
107 # we need direct blockers with old ant-tasks for file collisions - bug #252324
108 if version_is_at_least 1.7.1 ; then
109 DEPEND="${DEPEND}
110 !dev-java/ant-tasks"
111 fi
112
113 # Would run the full ant test suite for every ant task
114 RESTRICT="test"
115
116 S="${WORKDIR}/${MY_P}"
117
118 # ------------------------------------------------------------------------------
119 # @eclass-src_unpack
120 #
121 # Is split into two parts, defaults to both of them ('all').
122 # base: performs the unpack, build.xml replacement and symlinks ant.jar from
123 # ant-core
124 # jar-dep: symlinks the jar file(s) from dependency package
125 # ------------------------------------------------------------------------------
126 ant-tasks_src_unpack() {
127 [[ -z "${1}" ]] && ant-tasks_src_unpack all
128
129 while [[ -n "${1}" ]]; do
130 case ${1} in
131 base)
132 unpack ${A}
133 cd "${S}"
134
135 # replace build.xml with our modified for split building
136 mv -f ${WORKDIR}/build.xml .
137
138 cd lib
139 # remove bundled xerces
140 rm -f *.jar
141
142 # ant.jar to build against
143 java-pkg_jar-from --build-only ant-core ant.jar;;
144 jar-dep)
145 # get jar from the dependency package
146 if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
147 java-pkg_jar-from ${ANT_TASK_DEPNAME}
148 fi;;
149 all)
150 ant-tasks_src_unpack base jar-dep;;
151 esac
152 shift
153 done
154
155 }
156
157 # ------------------------------------------------------------------------------
158 # @eclass-src_compile
159 #
160 # Compiles the jar with installed ant-core.
161 # ------------------------------------------------------------------------------
162 ant-tasks_src_compile() {
163 ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
164 }
165
166 # ------------------------------------------------------------------------------
167 # @eclass-src_install
168 #
169 # Installs the jar and registers its presence for the ant launcher script.
170 # Version param ensures it won't get loaded (thus break) when ant-core is
171 # updated to newer version.
172 # ------------------------------------------------------------------------------
173 ant-tasks_src_install() {
174 java-pkg_dojar build/lib/${PN}.jar
175 java-pkg_register-ant-task --version "${ANT_TASK_PV}"
176
177 # create the compatibility symlink
178 if version_is_at_least 1.7.1_beta2; then
179 dodir /usr/share/ant/lib
180 dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
181 fi
182 }

  ViewVC Help
Powered by ViewVC 1.1.20