Hi jdugan,
I also use ‘gradle’ as my build tool and like your plugin.
‘Suggestion Box Time’:
- a flag or bool to use a projects
./gradlew
instead of the system-wide gradle
command.
- ability to verify gradle-wrapper.jar or grab one with additional positional arguments (see my script below).
verify-gradle-wrapper.zsh
#! /usr/bin/env zsh
# ----------------------------------------------------------------------------------------------------------- #
# Version control repositories that allow users to include binary files:
# gradle/wrapper/gradle-wrapper.jar
#
# Gradle 2021, Verifying the integrity of the Gradle Wrapper JAR, The Gradle Wrapper, viewed 04 February 2021,
# <https://docs.gradle.org/current/userguide/gradle_wrapper.html#wrapper_checksum_verification>
# ----------------------------------------------------------------------------------------------------------- #
function print_help(){
cat << EOF
Usage: ${${(%):-%x}:t} [-h|-help|--help]|[[-g|-get|--get] <version> <checksum>]|[[-c|-check|--check] <version>]
-g, -get, --get
VERSION="\$2" CHECKSUM="\$3"
$ gradle wrapper \\
--gradle-version "\$VERSION" \\
--distribution-type all \\
--gradle-distribution-sha256-sum "\$CHECKSUM"
# ------------------------------------------------------------------- #
Gradle 2021, Gradle distribution and wrapper JAR checksum reference,
viewed 04 February 2021, <https://gradle.org/release-checksums/>
# ------------------------------------------------------------------- #
Integrated Development Environment (IDE) pulls:
Complete (-all|-bin) ZIP Checksum
gradle/wrapper/gradle.wrapper.properties
# ------------------------------------------------------------------- #
Command Line Interface (CLI) pulls:
Wrapper JAR Checksum
$ ./gradlew tasks
# ------------------------------------------------------------------- #
-c, -check, --check
VERSION="\$2"
$ cd \$PWD/gradle/wrapper
$ curl --fail --no-progress-meter --show-error --location \\
--output gradle-wrapper.jar.sha256 \\
https://services.gradle.org/distributions/gradle-"\$VERSION"-wrapper.jar.sha256
$ echo " gradle-wrapper.jar" >> gradle-wrapper.jar.sha256
$ sha256sum --check gradle-wrapper.jar.sha256
EOF
}
# -------------------------------------------------------------------------------------------------- #
if [ $# -eq 0 ]; then print_help; exit 1; fi
# -------------------------------------------------------------------------------------------------- #
function check_dependency() {
if ! (builtin command -V "$1" > /dev/null 2>& 1); then
echo "ERROR: missing dependency can't find $1" 1>& 2
exit 1
fi
}
# -------------------------------------------------------------------------------------------------- #
function curl_check_gradle_wrapper() {
local version="$1"
# ------------------------------------------------------------------------------------------------ #
cd gradle/wrapper || { echo "cd: no such file or directory: gradle/wrapper"; exit 1; }
# ------------------------------------------------------------------------------------------------ #
echo "Downloading $version of gradle-wrapper.jar.sha256..."
# ------------------------------------------------------------------------------------------------ #
curl --fail --no-progress-meter \
--show-error --location \
--output gradle-wrapper.jar.sha256 \
https://services.gradle.org/distributions/gradle-"$version"-wrapper.jar.sha256
}
# -------------------------------------------------------------------------------------------------- #
function gradle_get_wrapper() {
local version="$1"
local checksum="$2"
# ------------------------------------------------------------------------------------------------ #
echo "Wrapper JAR Checksum: $checksum"
echo "Downloading $version of gradle-wrapper.jar..."
# ------------------------------------------------------------------------------------------------ #
gradle wrapper \
--gradle-version "$version" \
--distribution-type all \
--gradle-distribution-sha256-sum "$checksum"
}
# -------------------------------------------------------------------------------------------------- #
function shasum_gradle_wrapper() {
echo "checking sha256 of gradle-wrapper.jar..."
# ------------------------------------------------------------------------------------------------ #
echo " gradle-wrapper.jar" >> gradle-wrapper.jar.sha256
# ------------------------------------------------------------------------------------------------ #
sha256sum --check gradle-wrapper.jar.sha256
# ------------------------------------------------------------------------------------------------ #
SHA256=$(cat gradle-wrapper.jar.sha256)
SHA256SUM=$(sha256sum gradle-wrapper.jar)
# ------------------------------------------------------------------------------------------------ #
printf %s%s\\n "1) sha256: " "$SHA256"
printf %s%s\\n "2) sha256sum: " "$SHA256SUM"
# ------------------------------------------------------------------------------------------------ #
rm gradle-wrapper.jar.sha256
}
# -------------------------------------------------------------------------------------------------- #
case "$1" in
-h | -help | --help | -\? )
print_help >&2
;;
-g | -get | --get )
if [ "$2" ] && [ "$3" ]; then
printf %s\\n "running: get gradle wrapper" >&2
check_dependency gradle
gradle_get_wrapper "$2" "$3"
else
printf %s\\n "Option requires two arguments: $1 <version> <checksum>" >&2
fi
;;
-c | -check | --check )
if [ "$2" ]; then
printf %s\\n "running: curl check gradle wrapper" >&2
check_dependency curl
check_dependency sha256sum
curl_check_gradle_wrapper "$2"
shasum_gradle_wrapper
else
printf %s\\n "Option requires an argument: $1 <version>" >&2
fi
;;
*)
printf %s\\n "Option $1 invalid argument." >&2
exit 1
;;
esac
# -------------------------------------------------------------------------------------------------- #
exit $?
No, I have no idea how to implement this either in kak. But I do plan to tackle it. If you get there first let me know and I’ll do like wise. Bye 
TODO:
upgrade the gradle-wrapper.jar
$./gradlew wrapper --gradle-version VERSION --distribution-type TYPE --gradle-distribution-sha256-sum CHECKSUM
Thinking out loud with no research done. Could we use .editorconfig or .git to find the root directories. Maybe, maybe not duncan. Why don’t you go and do some frig’n research duncan. Your a hard man jdugan, I’ll be back with answers 
A bit of research and something to dwell on.
Lenormf has ‘kakmerge’ which is a great example of a shell script interfacing with a local binary and kakoune. Likewise a Gradle integration with the shell could be implemented via a ‘gradle task’ from a ‘build.gradle’ file similar to Lenormf and your gradle_wrap.sh
does with kakoune. See example below of a Gradle task with shell script.
This could potentially work for a verify-gradle-wrapper.sh task.
login.sh
#!/bin/bash
echo Enter username:
read username
echo Enter password:
if [ -t 0 ] ; then # if connected to a terminal, do not echo the password input
stty -echo
read password
stty echo
echo
else
read password
fi
if [ "$username" = "secret-user" ] && [ "$password" = "secret-password" ] ; then
echo "Welcome, $username!"
else
echo "Bad credentials!"
exit 1
fi
build.gradle
def login = tasks.register('login', Exec) {
def loginProvider = providers.credentials(PasswordCredentials, 'login')
inputs.property('credentials', loginProvider)
commandLine = ['sh', 'login.sh']
doFirst {
def loginCredentials = loginProvider.get()
standardInput = new ByteArrayInputStream("$loginCredentials.username\n$loginCredentials.password".getBytes())
}
}
tasks.register('doAuthenticated') {
dependsOn(login)
doLast {
println 'Doing authenticated task'
}
}
Finally, the gradle-completion repository states: ‘[The] ./gradlew
may not work on Linux if you don’t have .
on your $PATH, so I recommend adding it in your [kakoune script] file: export PATH=".:$PATH"
’. Setting a simple environment variable inside kak-gradle could be the answer.
Lenormf 2021, ‘kakmerge: merge tool for git’, Github, viewed 26 February 2021, GitHub - lenormf/kakmerge: A Kakoune-based mergetool for Git
Gradle 2021, ‘Supply credentials to external tool Sample’, Gradle v6.8.3, viewed 26 February 2021, Supply credentials to external tool Sample
Gradle 2021, ‘Troubleshooting’, Gradle Completion, viewed 26 February 2021, GitHub - gradle/gradle-completion: Gradle tab completion for bash and zsh
NOTE Gradle also does: C++, Swift, etc…
Gradle 2021, Sample Index, Gradle v6.8.3, viewed 26 February 2021, Sample Index
I’m going to see if I can get the task working with the verify script in the next week or so. Cya.
Perfect timing jdugan, I’m getting back into the projects and hitting the gradle manual for custom task creation. Definitely will give you some feedback based on my usage.
Cool buddy, bye 
build.gradle.kts - jlink task
/* ilya-g 2020, build.gradle.kts, kotlin-jlink-examples, gradle, viewed 01 March 2021,
* https://github.com/ilya-g/kotlin-jlink-examples/blob/master/gradle/app/build.gradle.kts
*/
register<Exec>("jlink") {
description = "Build kowsky.kak module jar with an optimised custom runtime image"
val outputDir by extra("$buildDir/jrt-kowsky-kak")
inputs.files(configurations.runtimeClasspath)
inputs.files(jar)
outputs.dir(outputDir)
doFirst {
val modulePath = files(jar) + configurations.runtimeClasspath.get()
logger.lifecycle(modulePath.joinToString("\n", "jlink module path:\n"))
delete(outputDir)
commandLine("$javaHome/bin/jlink",
"--module-path",
listOf("$javaHome/jmods/", modulePath.asPath).joinToString(File.pathSeparator),
"--add-modules", moduleName,
"--output", outputDir
)
}
}