[Build-common-hackers] Bug#757386: cdbs: Gradle support
Emmanuel Bourg
ebourg at apache.org
Thu Aug 7 15:38:07 UTC 2014
Package: cdbs
Severity: wishlist
Tags: patch
Hi,
Gradle [1] is a build tool increasingly used by Java projects, but CDBS
doesn't support it yet. I implemented the Gradle support by deriving the
.mk files for Ant:
https://github.com/ebourg/cdbs/commit/0e15474
The following variables are available to tweak the build:
GRADLE_ARGS
DEB_GRADLE_BUILD_TASK
DEB_GRADLE_INSTALL_TASK
DEB_GRADLE_CHECK_TASK
DEB_GRADLE_CLEAN_TASK
DEB_GRADLE_BUILDFILE
DEB_GRADLE_PROPERTYFILE
Could you please consider merging this patch?
Thank you,
Emmanuel Bourg
[1] http://www.gradle.org
-------------- next part --------------
From 0e154745d988209b2cb3fc7572b0c4a083a87515 Mon Sep 17 00:00:00 2001
From: Emmanuel Bourg <ebourg at apache.org>
Date: Thu, 7 Aug 2014 17:13:08 +0200
Subject: [PATCH] Added Gradle support
---
1/class/gradle-vars.mk.in | 56 +++++++++++++++++++++++++++++++++++++++++++++++
1/class/gradle.mk.in | 55 ++++++++++++++++++++++++++++++++++++++++++++++
Makefile.in | 2 ++
3 files changed, 113 insertions(+)
create mode 100644 1/class/gradle-vars.mk.in
create mode 100644 1/class/gradle.mk.in
diff --git a/1/class/gradle-vars.mk.in b/1/class/gradle-vars.mk.in
new file mode 100644
index 0000000..d0597bd
--- /dev/null
+++ b/1/class/gradle-vars.mk.in
@@ -0,0 +1,56 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003 Stefan Gybas <sgybas at debian.org>
+# Description: Defines useful variables for packages which use Gradle
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#PATH_RULES#
+
+ifndef _cdbs_class_gradle_vars
+_cdbs_class_gradle_vars = 1
+
+# Gradle home directory. Doesn't need to be changed except when using
+# nonstandard Gradle installations.
+GRADLE_HOME ?= /usr/share/gradle
+
+# The home directory of the Java Runtime Environment (JRE) or Java Development
+# Kit (JDK). You can either directly set JAVA_HOME in debian/rules or set
+# JAVA_HOME_DIRS to multiple possible home directories. The first existing
+# directory from this list is used for JAVA_HOME. You can also override
+# JAVACMD in case you don't want to use the default JAVA_HOME/bin/java.
+JAVA_HOME ?= $(shell for jh in $(JAVA_HOME_DIRS); do if [ -x "$$jh/bin/java" ]; then \
+ echo $${jh}; exit 0; fi; done)
+JAVACMD ?= $(JAVA_HOME)/bin/java
+
+# Property file for Gradle, defaults to debian/gradle.properties if it exists.
+# You may define additional properties that are referenced from build.gradle so
+# you don't have to modify upstream's build.gradle.
+DEB_GRADLE_PROPERTYFILE ?= $(shell test -f $(CURDIR)/debian/gradle.properties && echo $(CURDIR)/debian/gradle.properties)
+
+# You can specify additional arguments in GRADLE_ARGS
+DEB_GRADLE_INVOKE ?= cd $(DEB_BUILDDIR) && gradle --info --offline --stacktrace --refresh-dependencies --gradle-user-home $(CURDIR)/.gradle \
+ $(if $(GRADLE_ARGS),$(GRADLE_ARGS),) \
+ $(if $(DEB_GRADLE_BUILDFILE),--build-file $(DEB_GRADLE_BUILDFILE),) \
+ $(if $(DEB_GRADLE_PROPERTYFILE),--settings-file $(DEB_GRADLE_PROPERTYFILE),)
+
+# Targets to invoke for building, installing, testing and cleaning up.
+# Building uses the default target from build.xml, installing and testing is
+# only called if the corresponding variable is set. You can also specify
+# multiple targets for each step.
+#DEB_GRADLE_BUILD_TASK =
+#DEB_GRADLE_INSTALL_TASK =
+#DEB_GRADLE_CHECK_TASK =
+DEB_GRADLE_CLEAN_TASK ?= clean
+
+endif
diff --git a/1/class/gradle.mk.in b/1/class/gradle.mk.in
new file mode 100644
index 0000000..bb558a9
--- /dev/null
+++ b/1/class/gradle.mk.in
@@ -0,0 +1,55 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003 Stefan Gybas <sgybas at debian.org>
+# Description: Builds and cleans packages which have an build.gradle file
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#PATH_RULES#
+
+ifndef _cdbs_class_gradle
+_cdbs_class_gradle = 1
+
+include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
+include $(_cdbs_class_path)/gradle-vars.mk$(_cdbs_makefile_suffix)
+
+testsanity::
+ @if ! test -x "$(firstword $(JAVACMD))"; then \
+ echo "You must specify a valid JAVA_HOME or JAVACMD!"; \
+ exit 1; \
+ fi
+
+common-build-arch common-build-indep:: debian/stamp-gradle-build
+debian/stamp-gradle-build:
+ $(DEB_GRADLE_INVOKE) $(DEB_GRADLE_BUILD_TASK)
+ touch debian/stamp-gradle-build
+
+clean::
+ -$(DEB_GRADLE_INVOKE) $(DEB_GRADLE_CLEAN_TASK)
+ rm -f debian/stamp-gradle-build
+
+common-install-arch common-install-indep:: common-install-impl
+common-install-impl::
+ $(if $(DEB_GRADLE_INSTALL_TASK),$(DEB_GRADLE_INVOKE) $(DEB_GRADLE_INSTALL_TASK), at echo "DEB_GRADLE_INSTALL_TASK unset, skipping default gradle.mk common-install target")
+
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+common-build-arch common-build-indep:: debian/stamp-gradle-check
+debian/stamp-gradle-check: debian/stamp-gradle-build
+ $(if $(DEB_GRADLE_CHECK_TASK),$(DEB_GRADLE_INVOKE) $(DEB_GRADLE_CHECK_TASK), at echo "DEB_GRADLE_CHECK_TASK unset, not running checks")
+ $(if $(DEB_GRADLE_CHECK_TASK),touch $@)
+
+clean::
+ $(if $(DEB_GRADLE_CHECK_TASK),rm -f debian/stamp-gradle-check)
+endif
+
+endif
diff --git a/Makefile.in b/Makefile.in
index 0a01457..65218ee 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -291,6 +291,8 @@ all_mk_files = 1/rules/buildvars.mk \
1/class/cmake.mk \
1/class/docbookxml.mk \
1/class/gnome.mk \
+ 1/class/gradle-vars.mk \
+ 1/class/gradle.mk \
1/class/kde.mk \
1/class/langcore.mk \
1/class/makefile-vars.mk \
--
2.0.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/build-common-hackers/attachments/20140807/344b43f2/attachment.sig>
More information about the Build-common-hackers
mailing list