22 lines
900 B
Bash
22 lines
900 B
Bash
|
#!/bin/bash
|
||
|
set -euo pipefail
|
||
|
echo ":: Renaming GitHead.java to GitHead.javabak"
|
||
|
mv src/main/java/de/pickshadow/plugin/GitHead.java src/main/java/de/pickshadow/plugin/GitHead.javabak
|
||
|
echo ":: Writing new GitHead.java"
|
||
|
cat << EOF >> src/main/java/de/pickshadow/plugin/GitHead.java
|
||
|
package de.pickshadow.plugin;
|
||
|
|
||
|
public class GitHead {
|
||
|
public static String commitSha = "$(git rev-parse HEAD)";
|
||
|
public static String commitShaShort = "$(git rev-parse --short HEAD)";
|
||
|
public static String commitMessage = "$(PAGER= git log --format=%B -n 1 $(git rev-parse HEAD)|head -1|sed "s/\\\/\\\\/g"|sed "s/\"/\\\\\"/g")";
|
||
|
}
|
||
|
EOF
|
||
|
echo ":: Compiling plugin"
|
||
|
./gradlew shadowJar
|
||
|
EXITCODE="${?}"
|
||
|
echo ":: Renaming GitHead.javabak to GitHead.java"
|
||
|
mv src/main/java/de/pickshadow/plugin/GitHead.javabak src/main/java/de/pickshadow/plugin/GitHead.java
|
||
|
echo ":: Exiting with code ${EXITCODE}"
|
||
|
exit "${EXITCODE}"
|