public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-java@lists.gentoo.org
Subject: Re: [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
Date: Sun, 17 Dec 2006 18:44:33 +0200	[thread overview]
Message-ID: <458573F1.4010607@gentoo.org> (raw)
In-Reply-To: <457D7375.4060803@gentoo.org>


[-- Attachment #1.1: Type: text/plain, Size: 1051 bytes --]

Joshua Nichols kirjoitti:
> Vlastimil Babka wrote:
>> I wonder if ebuild using those variables would be more typing than
>> ebuild with own src_compile() :) but not a bad idea anyway.
>>
>>   
> The idea is that you don't end up repeating the same code snippet over
> and over. Instead, you use some variables to configure what targets get
> called. This helps with maintainence, as if we change src_compile, you
> don't have to update it in a trillion places. For example, eant dies by
> itself on error, but a lot of places do eant || die. If we had a default
> src_compile, you'd have to fix it in exactly one place.
>> Yeah check is needed, otherwise you'll be trying to compile current -bin
>> packages without src_compile() in ebuild...
>> Not sure if any ebuild would use the variable, but why not...
>>   
> The answer to 'why not' would be added complexity. But some packages
> would use it, ie, I know some packages have build files at, for example
> 'build/build.xml'.
> 

Committed the attached.

Regards,
Petteri

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: default-src_compile-2.patch --]
[-- Type: text/x-patch; name="default-src_compile-2.patch", Size: 1742 bytes --]

Index: java-pkg-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v
retrieving revision 1.5
diff -u -r1.5 java-pkg-2.eclass
--- java-pkg-2.eclass	8 Dec 2006 12:12:04 -0000	1.5
+++ java-pkg-2.eclass	17 Dec 2006 16:41:21 -0000
@@ -33,7 +33,7 @@
 # ------------------------------------------------------------------------------
 RDEPEND="${DEPEND}"
 
-EXPORT_FUNCTIONS pkg_setup
+EXPORT_FUNCTIONS pkg_setup src_compile
 
 # ------------------------------------------------------------------------------
 # @eclass-pkg_setup
@@ -46,6 +46,27 @@
 }
 
 # ------------------------------------------------------------------------------
+# @eclass-src_compile
+#
+# Default src_compile for java packages
+# variables:
+# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
+# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
+# EANT_DOC_TARGET - the target to build extra docs under the doc use flag
+#                   (default: the one provided by use_doc in
+#                   java-utils-2.eclass)
+# ------------------------------------------------------------------------------
+java-pkg-2_src_compile() {
+	if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
+		local antflags="${EANT_BUILD_TARGET:=jar}"
+		hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
+		eant ${antflags} -f ${EANT_BUILD_XML}
+	else
+		vecho "${FUNCNAME}: No build.xml found so nothing to do."
+	fi
+}
+
+# ------------------------------------------------------------------------------
 # @note
 #
 # We need to initialize the environment in every function because Portage

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

      reply	other threads:[~2006-12-17 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-09 12:19 [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass Petteri Räty
2006-12-11  5:05 ` Joshua Nichols
2006-12-11 10:59   ` Vlastimil Babka
2006-12-11 15:04     ` Joshua Nichols
2006-12-17 16:44       ` Petteri Räty [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=458573F1.4010607@gentoo.org \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-java@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox