Clarify a few scripts
This commit is contained in:
6
akarin
6
akarin
@@ -3,8 +3,6 @@
|
||||
# exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
gitcmd="git -c commit.gpgsign=false"
|
||||
|
||||
source "./scripts/functions.sh"
|
||||
|
||||
failed=0
|
||||
@@ -59,10 +57,10 @@ case "$1" in
|
||||
mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install
|
||||
)
|
||||
;;
|
||||
"up" | "upstream")
|
||||
"up" | "upstream" | "update")
|
||||
(
|
||||
cd "$basedir"
|
||||
scripts/upstream.sh "$2"
|
||||
scripts/upstream.sh "$basedir" $2
|
||||
)
|
||||
;;
|
||||
"r" | "root")
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.15.2--99217db2846f72f0abfcfd07feb393a105293442
|
||||
1.15.2--23ee0a8a889f352889907369b58c361a1b19f7ac
|
||||
|
||||
@@ -7,6 +7,8 @@ PAPER_API_REPO=""
|
||||
PAPER_SERVER_REPO=""
|
||||
MCDEV_REPO=""
|
||||
|
||||
gitcmd="git -c commit.gpgsign=false"
|
||||
|
||||
# DIR configure
|
||||
# resolve shell-specifics
|
||||
case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in
|
||||
@@ -35,6 +37,10 @@ function basedir {
|
||||
cd "$basedir"
|
||||
}
|
||||
|
||||
function paperdir {
|
||||
cd "$basedir/Paper"
|
||||
}
|
||||
|
||||
# COLOUR functions
|
||||
color() {
|
||||
if [ $2 ]; then
|
||||
@@ -94,3 +100,11 @@ function cleanupPatches {
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function containsElement {
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0;
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
44
scripts/generateImports.sh
Normal file
44
scripts/generateImports.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# get base dir regardless of execution location
|
||||
basedir=$1
|
||||
|
||||
source "$basedir/scripts/functions.sh"
|
||||
|
||||
paperVer=$(cat current-paper)
|
||||
|
||||
paperworkdir="$basedir/Paper/work"
|
||||
minecraftversion=$(cat $paperworkdir/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompile="$paperworkdir/Minecraft/$minecraftversion/spigot"
|
||||
|
||||
# create dev dir
|
||||
basedir
|
||||
mkdir -p mc-dev/src/net/minecraft/server
|
||||
cd mc-dev
|
||||
|
||||
# prepare to push
|
||||
if [ ! -d ".git" ]; then
|
||||
gitcmd init
|
||||
fi
|
||||
|
||||
# reset dev files to spigot
|
||||
rm src/net/minecraft/server/*.java
|
||||
cp $decompile/net/minecraft/server/*.java src/net/minecraft/server
|
||||
|
||||
# diff and only preserve new added files
|
||||
paperserver="$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server"
|
||||
cd $basedir/mc-dev/src/net/minecraft/server/
|
||||
|
||||
for file in $(/bin/ls $paperserver)
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
rm -f "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
# push the dev project
|
||||
cd $basedir/mc-dev
|
||||
gitcmd add . -A
|
||||
gitcmd commit . -m "$paperVer"
|
||||
gitcmd tag -a "$paperVer" -m "$paperVer" 2>/dev/null
|
||||
push . $MCDEV_REPO $paperVer
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
. $(dirname $SOURCE)/init.sh
|
||||
|
||||
|
||||
cd $basedir
|
||||
paperVer=$(cat current-paper)
|
||||
|
||||
minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompile="Paper/work/Minecraft/$minecraftversion/spigot"
|
||||
|
||||
mkdir -p mc-dev/src/net/minecraft/server
|
||||
|
||||
cd mc-dev
|
||||
if [ ! -d ".git" ]; then
|
||||
git init
|
||||
fi
|
||||
|
||||
rm src/net/minecraft/server/*.java
|
||||
cp $basedir/$decompile/net/minecraft/server/*.java src/net/minecraft/server
|
||||
|
||||
base="$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server"
|
||||
cd $basedir/mc-dev/src/net/minecraft/server/
|
||||
for file in $(/bin/ls $base)
|
||||
do
|
||||
if [ -f "$file" ]; then
|
||||
rm -f "$file"
|
||||
fi
|
||||
done
|
||||
cd $basedir/mc-dev
|
||||
git add . -A
|
||||
git commit . -m "mc-dev"
|
||||
git tag -a "$paperVer" -m "$paperVer" 2>/dev/null
|
||||
pushRepo . $MCDEV_REPO $paperVer
|
||||
@@ -1,28 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
. $(dirname $SOURCE)/init.sh
|
||||
# get base dir regardless of execution location
|
||||
basedir=$1
|
||||
|
||||
workdir="$basedir"/Paper/work
|
||||
source "$basedir/scripts/functions.sh"
|
||||
|
||||
paperworkdir="$basedir/Paper/work"
|
||||
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompiledir=$workdir/Minecraft/$minecraftversion/spigot
|
||||
decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot
|
||||
|
||||
nms="net/minecraft/server"
|
||||
export MODLOG=""
|
||||
cd "$basedir"
|
||||
|
||||
function containsElement {
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0;
|
||||
done
|
||||
return 1
|
||||
}
|
||||
basedir
|
||||
|
||||
export importedmcdev=""
|
||||
function import {
|
||||
@@ -54,7 +43,7 @@ function importLibrary {
|
||||
target="$basedir/Paper/Paper-Server/src/main/java/$file"
|
||||
targetdir=$(dirname "$target")
|
||||
mkdir -p "${targetdir}"
|
||||
base="$workdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
if [ ! -f "$base" ]; then
|
||||
echo "Missing $base"
|
||||
exit 1
|
||||
@@ -67,7 +56,7 @@ function importLibrary {
|
||||
(
|
||||
cd Paper/Paper-Server/
|
||||
lastlog=$(git log -1 --oneline)
|
||||
if [[ "$lastlog" = *"Tuinity-Extra mc-dev Imports"* ]]; then
|
||||
if [[ "$lastlog" = *"Akarin extra mc-dev Imports"* ]]; then
|
||||
git reset --hard HEAD^
|
||||
fi
|
||||
)
|
||||
@@ -113,6 +102,6 @@ importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
||||
cd Paper/Paper-Server/
|
||||
rm -rf nms-patches
|
||||
git add src -A
|
||||
echo -e "Tuinity-Extra mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
||||
echo -e "Akarin extra mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
||||
exit 0
|
||||
)
|
||||
|
||||
@@ -1,53 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# get base dir regardless of execution location
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
. $(dirname $SOURCE)/init.sh
|
||||
basedir=$1
|
||||
|
||||
source "$basedir/scripts/functions.sh"
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
if [[ "$1" == up* ]]; then
|
||||
(
|
||||
cd "$basedir/Paper/"
|
||||
git fetch && git reset --hard origin/master
|
||||
cd ../
|
||||
git add Paper
|
||||
)
|
||||
if [[ "$2" == reset* ]]; then
|
||||
paperdir
|
||||
gitcmd fetch && gitcmd reset --hard origin/master
|
||||
basedir
|
||||
gitcmd add Paper
|
||||
fi
|
||||
|
||||
# patch paper
|
||||
paperVer=$(gethead Paper)
|
||||
cd "$basedir/Paper/"
|
||||
|
||||
paperdir
|
||||
./paper patch
|
||||
|
||||
cd "Paper-Server"
|
||||
mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }')
|
||||
|
||||
basedir
|
||||
. "$basedir"/scripts/importmcdev.sh
|
||||
"$basedir"/scripts/importmcdev.sh $1
|
||||
|
||||
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev")
|
||||
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')"
|
||||
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $2}')"
|
||||
echo "$tag" > "$basedir"/current-paper
|
||||
|
||||
"$basedir"/scripts/generatesources.sh
|
||||
|
||||
cd Paper/
|
||||
"$basedir"/scripts/generateImports.sh $1
|
||||
paperdir
|
||||
|
||||
function tag {
|
||||
(
|
||||
cd $1
|
||||
if [ "$2" == "1" ]; then
|
||||
cd $2
|
||||
if [ "$3" == "1" ]; then
|
||||
git tag -d "$tag" 2>/dev/null
|
||||
fi
|
||||
echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null
|
||||
)
|
||||
}
|
||||
|
||||
echo "Tagging as $tag"
|
||||
echo -e "$version"
|
||||
|
||||
@@ -59,6 +55,5 @@ fi
|
||||
tag Paper-API $forcetag
|
||||
tag Paper-Server $forcetag
|
||||
|
||||
pushRepo Paper-API $PAPER_API_REPO $tag
|
||||
pushRepo Paper-Server $PAPER_SERVER_REPO $tag
|
||||
|
||||
push Paper-API $PAPER_API_REPO $tag
|
||||
push Paper-Server $PAPER_SERVER_REPO $tag
|
||||
Reference in New Issue
Block a user