aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJoshua Nichols <nichoj@gentoo.org>2006-01-03 01:20:27 +0000
committerJoshua Nichols <nichoj@gentoo.org>2006-01-03 01:20:27 +0000
commitd6d59d62ac656e51b88f0493dba0754f9c584bc0 (patch)
treeec9dac8db0327408c46e67c6cab5ebc0a699671a /eclass
parentAdded symlink at /usr/bin/maven (diff)
downloadjava-d6d59d62ac656e51b88f0493dba0754f9c584bc0.tar.gz
java-d6d59d62ac656e51b88f0493dba0754f9c584bc0.tar.bz2
java-d6d59d62ac656e51b88f0493dba0754f9c584bc0.zip
Added a maven-plugin.eclass, and make ebuilds use this.
svn path=/gentoo-java-experimental/; revision=1786
Diffstat (limited to 'eclass')
-rw-r--r--eclass/maven-plugin.eclass104
1 files changed, 104 insertions, 0 deletions
diff --git a/eclass/maven-plugin.eclass b/eclass/maven-plugin.eclass
new file mode 100644
index 00000000..96908002
--- /dev/null
+++ b/eclass/maven-plugin.eclass
@@ -0,0 +1,104 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+#
+# Original Author: nichoj
+# Purpose: To facilitate packaging maven plugins.
+#
+
+inherit java-pkg base
+
+ECLASS="maven-plugin"
+INHERITED="$INHERITED $ECLASS"
+
+HOMEPAGE="http://maven.apache.org"
+SRC_URI="http://gentooexperimental.org/distfiles/${P}-gentoo.tar.bz2"
+LICENSE="Apache-2.0"
+
+RDEPEND=">=virtual/jdk-1.4
+ dev-java/ant-core"
+DEPEND="${RDEPEND}"
+IUSE=""
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install
+
+maven-plugin_populate-jars() {
+ true
+}
+
+maven-plugin_src_unpack() {
+ # Use base, so we get some patching magic
+ base_src_unpack
+
+ cd ${S}
+ # This build.xml was generated by 'maven ant', and fixed slightly.
+ local build_xml
+ if [[ -f ${FILESDIR}/build-${PVR}.xml ]]; then
+ build_xml=${FILESDIR}/build-${PVR}.xml
+ elif [[ -f ${FILESDIR}/build-${PV}.xml ]]; then
+ build_xml=${FILESDIR}/build-${PV}.xml
+ else
+ die "Couldn't find a suitable build.xml"
+ fi
+
+ cp ${build_xml} build.xml
+
+ mkdir -p target/lib
+ cd target/lib
+
+ maven-plugin_populate-jars
+}
+
+maven-plugin_src_compile() {
+ local antflags="jar -Dnoget=true"
+ ant ${antflags} || die "ant failed"
+}
+
+maven-plugin_src_install() {
+ maven_newplugin target/${P}.jar ${PN}.jar
+}
+
+
+function maven_doplugin() {
+ # TODO check args
+ local plugin_jar=${1}
+ local plugin_basename=$(basename ${1})
+
+ java-pkg_dojar ${plugin_jar}
+
+ local jardir
+ if [[ ${SLOT} != "0" ]]; then
+ jardir="/usr/share/${PN}-${SLOT}/lib"
+ else
+ jardir="/usr/share/${PN}/lib"
+ fi
+ local installed_jar="${jardir}/${plugin_basename}"
+
+ dodir "${JAVA_MAVEN_SYSTEM_PLUGINS}"
+ dosym "${installed_jar}" \
+ "${JAVA_MAVEN_SYSTEM_PLUGINS}/${plugin_basename}"
+}
+
+# TODO reduce redunancy of doplugin/newplugin
+
+function maven_newplugin() {
+ # TODO check args
+ local plugin_jar=${1}
+ local plugin_basename=$(basename ${1})
+ local plugin_newjar="${2}"
+
+ java-pkg_newjar ${plugin_jar} ${plugin_newjar}
+
+ local jardir
+ if [[ ${SLOT} != "0" ]]; then
+ jardir="/usr/share/${PN}-${SLOT}/lib"
+ else
+ jardir="/usr/share/${PN}/lib"
+ fi
+ local installed_jar="${jardir}/${plugin_newjar}"
+
+ dodir "${JAVA_MAVEN_SYSTEM_PLUGINS}"
+ dosym "${installed_jar}" \
+ "${JAVA_MAVEN_SYSTEM_PLUGINS}/${plugin_basename}"
+}