2024-04-23 19:47:46 +02:00
|
|
|
#!/bin/bash
|
2024-10-08 03:15:46 +02:00
|
|
|
#
|
|
|
|
# PICKSHADOW SERVER KIT SOURCE FILE
|
|
|
|
# Copyright (c) 2024 The PickShadow Server Kit Contributors
|
|
|
|
# Licensed under the GNU Affero General Public License v3
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
2024-04-23 19:47:46 +02:00
|
|
|
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}"
|