Skip to content

Commit 2c362e6

Browse files
committed
Use custom path for tools
1 parent eec5643 commit 2c362e6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/install-format-tools.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
3+
set -e
4+
25
if [[ "$DETEKT_VERSION" == "" ]]; then
36
echo "Privide detekt version in DETEKT_VERSION env variable"
47
exit 1
@@ -7,19 +10,22 @@ if [[ "$KTLINT_VERSION" == "" ]]; then
710
echo "Provide ktlint version in KTLINT_VERSION env variable"
811
exit 1
912
fi
10-
mkdir -p ${HOME}/.local/bin
13+
TOOLS="$(pwd)/tools"
14+
mkdir -p ${TOOLS}
1115
echo "Installing detekt $DETEKT_VERSION"
12-
jar_destination="${HOME}/.local/lib/detekt"
16+
jar_destination="${TOOLS}/lib/detekt"
1317
mkdir -p ${jar_destination}
1418
curl -sSL -o ${jar_destination}/detekt-cli.jar "https://github.com/detekt/detekt/releases/download/v${DETEKT_VERSION}/detekt-cli-${DETEKT_VERSION}-all.jar"
1519

16-
entrypoint_script="${HOME}/.local/bin/detekt-cli"
20+
entrypoint_script="${TOOLS}/detekt-cli"
1721
cat > "$entrypoint_script" << EOM
1822
java -jar ${jar_destination}/detekt-cli.jar \$@
1923
EOM
2024
chmod +x "$entrypoint_script"
2125
detekt-cli --version
2226

2327
echo "Installing ktlint $KTLINT_VERSION"
24-
curl -sSLO "https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint" && chmod a+x ktlint && mv ktlint ${HOME}/.local/bin/
25-
ktlint --version
28+
curl -sSLO "https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint" && chmod a+x ktlint && mv ktlint ${TOOLS}/
29+
ktlint --version
30+
31+
export PATH="$PATH:$TOOLS"

0 commit comments

Comments
 (0)