* [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
@ 2006-12-09 12:19 Petteri Räty
2006-12-11 5:05 ` Joshua Nichols
0 siblings, 1 reply; 5+ messages in thread
From: Petteri Räty @ 2006-12-09 12:19 UTC (permalink / raw
To: gentoo-java
[-- Attachment #1.1: Type: text/plain, Size: 149 bytes --]
I was looking at the output of qgrep eant to see how our ebuilds usually
call eant and came up with the attached src_compile.
Regards,
Petteri
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: default-src_compile.patch --]
[-- Type: text/x-patch; name="default-src_compile.patch", Size: 1195 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 9 Dec 2006 12:16:15 -0000
@@ -33,7 +33,7 @@
# ------------------------------------------------------------------------------
RDEPEND="${DEPEND}"
-EXPORT_FUNCTIONS pkg_setup
+EXPORT_FUNCTIONS pkg_setup src_compile
# ------------------------------------------------------------------------------
# @eclass-pkg_setup
@@ -46,6 +46,17 @@
}
# ------------------------------------------------------------------------------
+# @eclass-src_compile
+#
+# Default src_compile for java packages
+# ------------------------------------------------------------------------------
+java-pkg-2_src_compile() {
+ local antflags="jar"
+ hasq doc ${IUSE} && antflags="${antflags} $(use_doc)"
+ eant ${antflags}
+}
+
+# ------------------------------------------------------------------------------
# @note
#
# We need to initialize the environment in every function because Portage
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
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
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Nichols @ 2006-12-11 5:05 UTC (permalink / raw
To: gentoo-java
How many packages would benefit from this?
Some ways to improve it... maybe have two variables, ie
EANT_BUILD_TARGET, EANT_DOC_TARGET, which could be set and respected by
src_compile, ie:
java-pkg-2_src_compile() {
local antflags="${EANT_BUILD_TARGET:=jar}"
hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
eant ${antflags}
}
By adding that, I think more ebuilds would be able to take advantage of it.
One other thing... should definately check for the existence of a
build.xml... and additionally, could have a variable to specify where
the build file lives.
Petteri Räty wrote:
> I was looking at the output of qgrep eant to see how our ebuilds usually
> call eant and came up with the attached src_compile.
>
> Regards,
> Petteri
>
> ------------------------------------------------------------------------
>
> 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 9 Dec 2006 12:16:15 -0000
> @@ -33,7 +33,7 @@
> # ------------------------------------------------------------------------------
> RDEPEND="${DEPEND}"
>
> -EXPORT_FUNCTIONS pkg_setup
> +EXPORT_FUNCTIONS pkg_setup src_compile
>
> # ------------------------------------------------------------------------------
> # @eclass-pkg_setup
> @@ -46,6 +46,17 @@
> }
>
> # ------------------------------------------------------------------------------
> +# @eclass-src_compile
> +#
> +# Default src_compile for java packages
> +# ------------------------------------------------------------------------------
> +java-pkg-2_src_compile() {
> + local antflags="jar"
> + hasq doc ${IUSE} && antflags="${antflags} $(use_doc)"
> + eant ${antflags}
> +}
> +
> +# ------------------------------------------------------------------------------
> # @note
> #
> # We need to initialize the environment in every function because Portage
>
--
Joshua Nichols
Gentoo/Java Project Lead
--
gentoo-java@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
2006-12-11 5:05 ` Joshua Nichols
@ 2006-12-11 10:59 ` Vlastimil Babka
2006-12-11 15:04 ` Joshua Nichols
0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka @ 2006-12-11 10:59 UTC (permalink / raw
To: gentoo-java
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Joshua Nichols wrote:
> How many packages would benefit from this?
>
> Some ways to improve it... maybe have two variables, ie
> EANT_BUILD_TARGET, EANT_DOC_TARGET, which could be set and respected by
> src_compile, ie:
>
> java-pkg-2_src_compile() {
> local antflags="${EANT_BUILD_TARGET:=jar}"
> hasq doc ${IUSE} && antflags="${antflags} $(use_doc
> ${EANT_DOC_TARGET})"
> eant ${antflags}
> }
>
> By adding that, I think more ebuilds would be able to take advantage of it.
>
I wonder if ebuild using those variables would be more typing than
ebuild with own src_compile() :) but not a bad idea anyway.
> One other thing... should definately check for the existence of a
> build.xml... and additionally, could have a variable to specify where
> the build file lives.
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...
- --
Vlastimil Babka (Caster)
Gentoo/Java
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFfToKtbrAj05h3oQRAjklAJ95WFKtG/l9BXPwA3CvFwbprYXEVACaArRY
nVl3h/IW+wfgYx0hyvUWvqc=
=d2lM
-----END PGP SIGNATURE-----
--
gentoo-java@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
2006-12-11 10:59 ` Vlastimil Babka
@ 2006-12-11 15:04 ` Joshua Nichols
2006-12-17 16:44 ` Petteri Räty
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Nichols @ 2006-12-11 15:04 UTC (permalink / raw
To: gentoo-java
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'.
--
Joshua Nichols
Gentoo/Java - Project Lead
--
gentoo-java@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-java] RFC: Default src_compile for java-pkg-2.eclass
2006-12-11 15:04 ` Joshua Nichols
@ 2006-12-17 16:44 ` Petteri Räty
0 siblings, 0 replies; 5+ messages in thread
From: Petteri Räty @ 2006-12-17 16:44 UTC (permalink / raw
To: gentoo-java
[-- 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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-12-17 16:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox