diff options
author | Florian Schmaus <flow@gentoo.org> | 2023-03-16 11:45:09 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-03-16 11:45:09 +0100 |
commit | 8cee4d41c1eae351bd98dea5afb310e12b9b20f0 (patch) | |
tree | 2c54f8b4caf5cc32e5a3b0febfcb8a22dd6b7778 | |
parent | metadata: add pkg_desc_index to gitignore (diff) | |
download | java-8cee4d41c1eae351bd98dea5afb310e12b9b20f0.tar.gz java-8cee4d41c1eae351bd98dea5afb310e12b9b20f0.tar.bz2 java-8cee4d41c1eae351bd98dea5afb310e12b9b20f0.zip |
gradle.eclass: add EGRADLE_BUNDLED_VER
Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r-- | eclass/gradle.eclass | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/eclass/gradle.eclass b/eclass/gradle.eclass index 488c265d..e4087f7a 100644 --- a/eclass/gradle.eclass +++ b/eclass/gradle.eclass @@ -9,6 +9,30 @@ # @BLURB: utility functions for the gradle build system. # @DESCRIPTION: # Utility functions for the gradle build system. +# There are currently two approaches to using gradle in ebuilds. You can either +# depend on a gradle system-wide installation from a gradle ebuild, typically +# dev-java/gradle-bin, or, bundle gradle with the ebuild. +# +# To use a system-wide gradle installation, set EGRADLE_MIN and +# EGRADLE_MAX_EXCLUSIVE and declare a BDEPEND on the gradle package. +# @CODE +# inherit gradle +# EGRADLE_MIN=7.3 +# EGRADLE_MAX_EXCLUSIVE=8 +# +# BDEPEND="|| (dev-java/gradle-bin:7.3 dev-java/gradle-bin:7.4) +# @CODE +# +# To use a bundled gradle version, set EGRADLE_BUNDLED_VER and add +# $(gradle_src_uri) to SRC_URI. +# @CODE +# inherit gradle +# EGRADLE_BUNDLED_VER=7.6 +# SRC_URI=" +# ... +# $(gradle_src_uri) +# " +# @CODE case ${EAPI} in 7|8) ;; @@ -35,6 +59,11 @@ inherit edo # @DESCRIPTION: # The exact required gradle version. +# @ECLASS_VARIABLE: EGRADLE_BUNDLED_VER +# @DEFAULT_UNSET +# @DESCRIPTION: +# The gradle version that will be bundled with this package. + # @ECLASS_VARIABLE: EGRADLE_PARALLEL # @DESCRIPTION: # Set to the 'true', the default, to invoke gradle with --parallel. Set @@ -64,6 +93,11 @@ gradle-set_EGRADLE() { return fi + if [[ -n ${EGRADLE_BUNDLED_VER} ]]; then + export EGRADLE="${WORKDIR}/gradle-${EGRADLE_BUNDLED_VER}/bin/gradle" + return + fi + local candidates candidate selected selected_ver candidates=$(compgen -c gradle-) @@ -115,6 +149,16 @@ gradle-set_EGRADLE() { export EGRADLE="${selected}" } +# @FUNCTION: gradle-src_uri +# @DESCRIPTION: +# Generate SRC_URI data from EGRADLE_BUNDLED_VER. +gradle-src_uri() { + if [[ -z ${EGRADLE_BUNDLED_VER} ]]; then + die "Must set EGRADLE_BUNDLED_VER when calling gradle-src_uri" + fi + echo "https://services.gradle.org/distributions/gradle-${EGRADLE_BUNDLED_VER}-bin.zip" +} + # @FUNCTION: egradle # @USAGE: [gradle-args] # @DESCRIPTION: |