Skip to content

Commit 797dc6b

Browse files
committed
refactor: make distribution jar executable
1 parent 0611104 commit 797dc6b

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ FROM openjdk:8-slim
22

33
RUN apt-get update && apt-get install -y python3 python3-pip curl
44

5-
COPY ./build/libs/kafka-gitops-all.jar /usr/local/bin/kafka-gitops-all.jar
6-
COPY ./kafka-gitops /usr/local/bin/kafka-gitops
5+
COPY ./build/output/kafka-gitops /usr/local/bin/kafka-gitops
76

build.gradle

+7-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ jar {
6868
}
6969
}
7070

71+
task buildExecutableJar(type: Exec) {
72+
commandLine "bash", "build.sh"
73+
}
74+
7175
task buildRelease(type: Zip, group: "build") {
72-
from("$buildDir/libs")
73-
from("./kafka-gitops")
76+
from("$buildDir/output")
7477
}
7578

76-
buildRelease.dependsOn shadowJar
79+
buildRelease.dependsOn buildExecutableJar
80+
buildExecutableJar.dependsOn shadowJar

build.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p build/output
4+
5+
cat stub.sh ./build/libs/kafka-gitops-all.jar > build/output/kafka-gitops
6+
chmod +x build/output/kafka-gitops

docs/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installing `kafka-gitops` requires either **Java** or **Docker**.
44

55
## Local
66

7-
Install `kafka-gitops` by downloading the zip file from our [releases][releases] page. Move the `kafka-gitops` file and the `kafka-gitops-all.jar` file to somewhere on your `$PATH`, such as `/usr/local/bin`.
7+
Install `kafka-gitops` by downloading the zip file from our [releases][releases] page. Move the `kafka-gitops` file to somewhere on your `$PATH`, such as `/usr/local/bin`.
88

99

1010
Ensure the command is working by running:

kafka-gitops

-10
This file was deleted.

stub.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
MYSELF=`which "$0" 2>/dev/null`
3+
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
4+
java=java
5+
if test -n "$JAVA_HOME"; then
6+
java="$JAVA_HOME/bin/java"
7+
fi
8+
exec "$java" -jar $MYSELF "$@"
9+
exit 1

0 commit comments

Comments
 (0)