changeset 653:2503f7226fe1

Added wrapper to run gradlew from any subproject.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 26 Mar 2020 17:25:24 +0200
parents 58c2aea237ad
children 17e4bd5926d2
files misc/Makefile misc/mygradle.bash
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/misc/Makefile	Thu Mar 26 17:06:43 2020 +0200
+++ b/misc/Makefile	Thu Mar 26 17:25:24 2020 +0200
@@ -53,7 +53,9 @@
 ################################################################
 # Files definitions.
 
-FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-term-ascii my-term-colors my-term-strip-ansi
+FILES := trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) \
+  mymake.sh mygradle.bash \
+  my-term-ascii my-term-colors my-term-strip-ansi
 
 ################################################################
 # Build targets.
@@ -69,6 +71,7 @@
 	[ -d $(bindir) ] || mkdir -p $(bindir)
 	for file in $(FILES); do \
 		filenoext=$${file%.sh}; \
+		filenoext=$${filenoext%.bash}; \
 		filenoext=$${filenoext%.py}; \
 		$(INSTALL_PROGRAM) $$file $(bindir)/$$filenoext; \
 	done
@@ -77,6 +80,7 @@
 uninstall:
 	for file in $(FILES); do \
 		filenoext=$${file%.sh}; \
+		filenoext=$${filenoext%.bash}; \
 		filenoext=$${filenoext%.py}; \
 		[ -e $(bindir)/$$file ] && if rm $(bindir)/$$file; then :; else echo Unable to delete $(bindir)/$$file; exit 1; fi || :; \
 		[ -e $(bindir)/$$filenoext ] && if rm $(bindir)/$$filenoext; then :; else echo Unable to delete $(bindir)/$$filenoext; exit 1; fi || :; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/mygradle.bash	Thu Mar 26 17:25:24 2020 +0200
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+__find_cmd() {
+  local dir="$PWD"
+  while [[ -n "$dir" ]]; do
+    if [[ -x "$dir"/gradlew ]]; then
+      echo "$dir"/gradlew
+      return
+    fi
+    dir=${dir%/*}
+  done
+  command -v gradle
+}
+
+gradle_cmd=$(__find_cmd)
+if [[ ! -x "$gradle_cmd" ]]; then
+  echo Cannot find gradle executable.
+  exit 1
+fi
+
+echo "** EXEC: $gradle_cmd"
+echo "** ARGS: $@"
+"$gradle_cmd" "$@"