Improvements to javadoc handling

Petteri Räty <[email protected]>
Newsgroups gmane.linux.gentoo.java
Message-ID <[email protected]>
With the attached patch that I just committed dojavadoc will create an
api symlink to /usr/share/<pkg>-<slot> if you have USE="doc" and the
package installs javadocs using dojavadoc. This way it stays the same
between revisions which is easier for ides like Netbeans and Eclipse.
You could also do this with the Portage DOC_SYMLINKS_DIR feature but I
find it quite nice to provide everything Java in the same directory for
the package so you have to browse only one directory in your IDE. The
same patch also adds support for --symlink for ebuild writes. That way
we don't have to break html links that expect the api directory to be
named in some specific way.

Regards,
Petteri
dojavadoc.patch (text/plain, 1.7 KB)
Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.98
diff -u -r1.98 java-utils-2.eclass
--- java-utils-2.eclass	26 Nov 2007 21:00:59 -0000	1.98
+++ java-utils-2.eclass	28 Nov 2007 01:40:47 -0000
@@ -559,15 +559,27 @@
 #
 # Installs javadoc documentation. This should be controlled by the doc use flag.
 #
-# @param $1: - The javadoc root directory.
+# @param $1: optional --symlink creates to symlink like this for html
+#            documentation bundles.
+# @param $2: - The javadoc root directory.
 #
 # @example:
 #	java-pkg_dojavadoc docs/api
+#   java-pkg_dojavadoc --symlink apidocs docs/api
 #
 # ------------------------------------------------------------------------------
 java-pkg_dojavadoc() {
 	debug-print-function ${FUNCNAME} $*
+
+	# For html documentation bundles that link to Javadoc
+	local symlink
+	if [[ ${1} = --symlink ]]; then
+		symlink=${2}
+		shift 2
+	fi
+
 	local dir="$1"
+	local dest=/usr/share/doc/${PF}/html
 
 	# QA checks
 
@@ -581,6 +593,11 @@
 		is-java-strict && die "${msg}"
 	fi
 
+	if [[ -e ${D}/${dest}/api ]]; then
+		eerror "${dest} already exists. Will not overwrite."
+		die "${dest}"
+	fi
+
 	# Renaming to match our directory layout
 
 	local dir_to_install="${dir}"
@@ -592,7 +609,14 @@
 
 	# Actual installation
 
-	java-pkg_dohtml -r ${dir_to_install}
+	java-pkg_dohtml -r "${dir_to_install}"
+
+	# Let's make a symlink to the directory we have everything else under
+	dosym ${dest} "${JAVA_PKG_SHAREPATH}/api" || die
+
+	if [[ ${symlink} ]]; then
+		dosym ${dest}/{api,${symlink}} || die
+	fi
 }
 
 # ------------------------------------------------------------------------------
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTMm7cxLzpIGCsLQRAiLHAJ9mFc76nPWzENUMce++eRe65PmkLgCfYnkE
oJQtrrDMO99EoK6yugOiNyQ=
=8jae
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.