PickShadow/build.sh
2024-10-08 03:15:46 +02:00

40 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
#
# 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/>.
#
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}"