Skip to content
This repository was archived by the owner on Jan 26, 2021. It is now read-only.

Commit ebe14f1

Browse files
authored
Merge pull request #28 from gzoritchak/kotlin-support
Add support kotlin-dsl : build.gradle.kts #26
2 parents e2e9c61 + 49a65f4 commit ebe14f1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bin/gw

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
GRADLE="${GRADLE:-gradle}"
55
GRADLEW="${GRADLEW:-gradlew}"
66
GRADLE_BUILDFILE="${GRADLE_BUILDFILE:-build.gradle}"
7+
GRADLE_KTS_BUILDFILE="${GRADLE_KTS_BUILDFILE:-build.gradle.kts}"
78

89
err() {
910
echo -e "${@}" >&2
@@ -53,14 +54,21 @@ select_gradle() {
5354

5455
execute_gradle() {
5556
local build_gradle=$(lookup "${GRADLE_BUILDFILE}")
57+
local build_gradle_kts=$(lookup "${GRADLE_KTS_BUILDFILE}")
5658
local gradle=$(select_gradle "${working_dir}")
5759
local build_args=( ${BUILD_ARG} "$@" )
5860

59-
if [[ -n "${build_gradle}" ]]; then
61+
if [ -n "${build_gradle}" ] || [ -n "${build_gradle_kts}" ]; then
62+
local ktsDirName="$(dirname "${build_gradle_kts}")"
63+
local dirName="$(dirname "${build_gradle}")"
64+
if (( ${#ktsDirName} > ${#dirName} ))
65+
then
66+
build_gradle=${build_gradle_kts}
67+
fi
6068
# We got a good build file, start gradlew there.
6169
cd "$(dirname "${build_gradle}")"
6270
else
63-
err "Unable to find a gradle build file named ${GRADLE_BUILDFILE}."
71+
err "Unable to find a gradle build file named ${GRADLE_BUILDFILE} or ${GRADLE_KTS_BUILDFILE}."
6472
fi
6573

6674
# Say what we are gonna do, then do it.

0 commit comments

Comments
 (0)