Remove stream and simplify op in pathfinder & fix scripts

This commit is contained in:
Sotr
2020-04-15 18:57:08 +07:00
parent 790aedb67b
commit 4d0ea06a78
28 changed files with 176 additions and 101 deletions

View File

@@ -37,12 +37,12 @@ function applyPatch {
cd "$basedir/$baseproject"
$gitcmd fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
$gitcmd checkout master >/dev/null # possibly already in
$gitcmd branch -D upstream >/dev/null &> /dev/null
$gitcmd checkout master >/dev/null 2>&1 # possibly already in
$gitcmd branch -D upstream &> /dev/null
$gitcmd branch -f upstream "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null
if [[ $needimport != "1" ]]; then
if [ $baseproject != "${FORK_NAME}-API" ]; then
if [ $baseproject != "Paper/Paper-API" ]; then
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
basedir && $scriptdir/importSources.sh $basedir 1 || exit 1
fi
@@ -58,15 +58,17 @@ function applyPatch {
cd "$basedir/$target"
$gitcmd init > /dev/null 2>&1
echo " "
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Reset $target to $basename.."
# Add the generated Paper project as the upstream remote of subproject
$gitcmd remote rm upstream >/dev/null 2>&1
$gitcmd remote add upstream "$basedir/$baseproject" >/dev/null 2>&1
$gitcmd remote rm upstream &> /dev/null
$gitcmd remote add upstream "$basedir/$baseproject" &> /dev/null
# Ensure that we are in the branch we want so not overriding things
$gitcmd checkout master 2>/dev/null || $gitcmd checkout -b master
$gitcmd fetch upstream >/dev/null 2>&1
$gitcmd checkout master &> /dev/null || $gitcmd checkout -b master &> /dev/null
$gitcmd fetch upstream &> /dev/null
# Reset our source project to Paper
cd "$basedir/$target" && $gitcmd reset --hard upstream/upstream
cd "$basedir/$target" && $gitcmd reset --hard upstream/upstream &> /dev/null
echo " "
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.."
# Abort previous applying operation

View File

@@ -40,7 +40,7 @@ basedir
function importToPaperWorkspace {
if [ -f "$papernmsdir/$1.java" ]; then
echo " $(bashcolor 1 33)Skipped$(bashcolorend) - Already imported $1.java"
# echo " $(bashcolor 1 33)Skipped$(bashcolorend) - Already imported $1.java"
return 0
fi
@@ -92,6 +92,16 @@ patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/se
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
(
cd "$paperserverdir"
$gitcmd fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
$gitcmd checkout master >/dev/null 2>&1 # possibly already in
$gitcmd branch -D upstream &>/dev/null
$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
)
basedir
for f in $patchedFiles; do
containsElement "$f" ${patchedFilesNonNMS[@]}
if [ "$?" == "1" ]; then
@@ -107,7 +117,10 @@ for f in $patchedFiles; do
done
# NMS import format:
# importToPaperWorkspace MinecraftServer.java
# importToPaperWorkspace MinecraftServer
importToPaperWorkspace CommandGive
importToPaperWorkspace PathDestination
# Library import format (multiple files are supported):
# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
@@ -118,12 +131,11 @@ done
# rm -rf nms-patches
git add . &> /dev/null
echo -e "Extra dev imports of Akarin\n\n$IMPORT_LOG" | git commit src -F - &> /dev/null
echo " $(bashcolor 1 32)Succeed$(bashcolorend) - Sources have been imported to Paper/Paper-Server"
echo " $(bashcolor 1 32)Succeed$(bashcolorend) - Sources have been imported to Paper/Paper-Server (branch upstream)"
if [[ $maintask != "0" ]]; then # this is magical
echo "----------------------------------------"
echo " Subtask finished"
echo "----------------------------------------"
fi
echo " "
)

View File

@@ -29,7 +29,7 @@ subtasks=1
updatepaper=$2
if [ "$updatepaper" == "1" ]; then
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.."
$gitcmd submodule update --init --recursive
$gitcmd submodule update --init --remote
fi
if [[ "$2" == "--resetPaper" ]]; then