mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-02-16 12:21:37 +01:00
Cleanup scripts
Also added a few more commands and a new script.
This commit is contained in:
parent
337a6f46f3
commit
6866737d61
@ -19,105 +19,74 @@ echo "----------------------------------------"
|
||||
# SCRIPT HEADER end
|
||||
|
||||
needimport=$2
|
||||
function enableCommitSigningIfNeeded {
|
||||
if [[ "$gpgsign" == "true" ]]; then
|
||||
$gitcmd config commit.gpgsign true
|
||||
fi
|
||||
function enableCommitSigningIfNeeded() {
|
||||
if [[ "$gpgsign" == "true" ]]; then
|
||||
$gitcmd config commit.gpgsign true
|
||||
fi
|
||||
}
|
||||
function applyPatch {
|
||||
baseproject=$1
|
||||
basename=$(basename $baseproject)
|
||||
target=$2
|
||||
branch=$3
|
||||
patch_folder=$4
|
||||
cd $basedir/$2
|
||||
# Skip if that software have no patch
|
||||
haspatch=-f "$basedir/patches/$patch_folder/"*.patch >/dev/null 2>&1 # too many files
|
||||
if [ ! haspatch ]; then
|
||||
echo " $(bashcolor 1 33)($5/$6) Skipped$(bashcolorend) - No patch found for $target under patches/$patch_folder"
|
||||
return
|
||||
fi
|
||||
|
||||
# Disable GPG signing before AM, slows things down and doesn't play nicely.
|
||||
# There is also zero rational or logical reason to do so for these sub-repo AMs.
|
||||
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
|
||||
$gitcmd config commit.gpgsign false
|
||||
|
||||
if [[ $needimport != "1" ]]; then
|
||||
if [ $baseproject != "Tuinity/Tuinity-API" ]; then
|
||||
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
|
||||
#cd $basedir/Yatopia-Server/
|
||||
#branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
#branch_name=${branch_name:-9}
|
||||
#cd $basedir
|
||||
basedir && $scriptdir/importSources.sh $basedir "Yatopia" || exit 1
|
||||
fi
|
||||
function applyPatch() {
|
||||
baseproject=$1
|
||||
basename=$(basename $baseproject)
|
||||
target=$2
|
||||
branch=$3
|
||||
patch_folder=$4
|
||||
cd $basedir/$2
|
||||
# Skip if that software have no patch
|
||||
haspatch=-f "$basedir/patches/$patch_folder/"*.patch >/dev/null 2>&1 # too many files
|
||||
if [ ! haspatch ]; then
|
||||
echo " $(bashcolor 1 33)($5/$6) Skipped$(bashcolorend) - No patch found for $target under patches/$patch_folder"
|
||||
return
|
||||
fi
|
||||
|
||||
# Disable GPG signing before AM, slows things down and doesn't play nicely.
|
||||
# There is also zero rational or logical reason to do so for these sub-repo AMs.
|
||||
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
|
||||
$gitcmd config commit.gpgsign false
|
||||
|
||||
if [[ $needimport != "1" ]]; then
|
||||
if [ $baseproject != "Tuinity/Tuinity-API" ]; then
|
||||
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
|
||||
basedir && $scriptdir/importSources.sh $basedir "Yatopia" || exit 1
|
||||
fi
|
||||
#$gitcmd branch $target
|
||||
|
||||
echo " "
|
||||
fi
|
||||
|
||||
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.."
|
||||
# Abort previous applying operation
|
||||
#$gitcmd am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
#$gitcmd am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
|
||||
|
||||
cd $basedir/$2
|
||||
git branch -d $2
|
||||
git branch $2
|
||||
git checkout $2
|
||||
# for filename in $basedir/patches/$patch_folder/*.patch; do
|
||||
# # Abort previous applying operation
|
||||
# git am --abort >/dev/null 2>&1
|
||||
# # Apply our patches on top Paper in our dirs
|
||||
# git am --reject --whitespace=fix --no-utf8 --3way --ignore-whitespace $filename || (
|
||||
# files=`$gitcmd diff --name-only | grep -E '.rej$' `
|
||||
# if [[ files != null ]]; then
|
||||
# for filerej in files; do
|
||||
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
|
||||
# rm -f filerej
|
||||
# done
|
||||
# fi
|
||||
# filenamend="${filename##*/}"
|
||||
# filenamens=${filenamend%/*}
|
||||
# filenameedited=${filenamens%.*} # retain the part before the period
|
||||
# filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
# git add .
|
||||
# git commit -m $filenameedited
|
||||
# )
|
||||
# done
|
||||
echo " "
|
||||
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.."
|
||||
|
||||
$gitcmd am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
$gitcmd am --reject --3way --whitespace=fix "$basedir/patches/$patch_folder/"*.patch
|
||||
cd $basedir
|
||||
cd $basedir/$2
|
||||
git branch -d $2
|
||||
git branch $2
|
||||
git checkout $2
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
echo " Something did not apply cleanly to $target."
|
||||
echo " Please review above details and finish the apply then"
|
||||
echo " save the changes with rebuildPatches.sh"
|
||||
echo " or use 'git am --abort' to cancel this applying."
|
||||
echo " $(bashcolor 1 33)($5/$6) Suspended$(bashcolorend) - Resolve the conflict or abort the apply"
|
||||
echo " "
|
||||
cd "$basedir/$target"
|
||||
exit 1
|
||||
else
|
||||
echo " $(bashcolor 1 32)($6/$6) Succeed$(bashcolorend) - Patches applied cleanly to $target"
|
||||
echo " "
|
||||
fi
|
||||
$gitcmd am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
$gitcmd am --reject --3way --whitespace=fix "$basedir/patches/$patch_folder/"*.patch
|
||||
cd $basedir
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
echo " Something did not apply cleanly to $target."
|
||||
echo " Please review above details and finish the apply then"
|
||||
echo " save the changes with rebuildPatches.sh"
|
||||
echo " or use 'git am --abort' to cancel this applying."
|
||||
echo " $(bashcolor 1 33)($5/$6) Suspended$(bashcolorend) - Resolve the conflict or abort the apply"
|
||||
echo " "
|
||||
cd "$basedir/$target"
|
||||
exit 1
|
||||
else
|
||||
echo " $(bashcolor 1 32)($6/$6) Succeed$(bashcolorend) - Patches applied cleanly to $target"
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
rm -rf $basedir/Yatopia/Yatopia-Server
|
||||
|
||||
rm -rf $basedir/Yatopia/Yatopia-API
|
||||
|
||||
|
||||
$1/scripts/resetToUpstream.sh $1
|
||||
$1/scripts/getUpstream.sh $1
|
||||
|
||||
(applyPatch Yatopia/Yatopia-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
|
||||
applyPatch Yatopia/Yatopia-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2 && enableCommitSigningIfNeeded) || (
|
||||
enableCommitSigningIfNeeded
|
||||
exit 1 )
|
||||
|
||||
applyPatch Yatopia/Yatopia-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2 && enableCommitSigningIfNeeded) || (
|
||||
enableCommitSigningIfNeeded
|
||||
exit 1
|
||||
)
|
||||
|
@ -2,10 +2,10 @@
|
||||
searchtxts=(Server API)
|
||||
gpgsign="$(git config commit.gpgsign || echo "false")"
|
||||
scriptdir=$1/scripts
|
||||
function enableCommitSigningIfNeeded {
|
||||
if [[ "$gpgsign" == "true" ]]; then
|
||||
git config commit.gpgsign true
|
||||
fi
|
||||
function enableCommitSigningIfNeeded() {
|
||||
if [[ "$gpgsign" == "true" ]]; then
|
||||
git config commit.gpgsign true
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $2 == "removed" ]; then
|
||||
@ -16,42 +16,32 @@ fi
|
||||
# There is also zero rational or logical reason to do so for these sub-repo AMs.
|
||||
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
|
||||
git config commit.gpgsign false
|
||||
cd $1/patches/$2
|
||||
cd "$1"/patches/"$2"
|
||||
for D in ${searchtxts[@]}; do
|
||||
if [ -d $1/patches/$2/$dnoslashlower ]; then
|
||||
echo $D
|
||||
dnoslash=$D
|
||||
cd $1/Yatopia-$dnoslash
|
||||
echo "Appyling $2 $dnoslash files!"
|
||||
dnoslashlower="${dnoslash,,}"
|
||||
#git branch $2-upstream
|
||||
#git checkout $2-upstream
|
||||
if [ $dnoslashlower != "api" ]; then
|
||||
echo "$"
|
||||
echo "Import new introduced NMS files.. test"
|
||||
$scriptdir/importSources.sh $1 $2 || exit 1
|
||||
fi
|
||||
for filename in $1/patches/$2/$dnoslashlower/*.patch; do
|
||||
# Abort previous applying operation
|
||||
git am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
git am --reject --3way --whitespace=fix $filename || (
|
||||
#files=`$gitcmd diff --name-only | grep -E '.rej$' `
|
||||
#if [[ files != null ]]; then
|
||||
# for filerej in files; do
|
||||
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
|
||||
# rm -f filerej
|
||||
# done
|
||||
#fi
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
git add .
|
||||
git commit -m $filenameedited
|
||||
)
|
||||
done
|
||||
fi
|
||||
if [ -d $1/patches/$2/$dnoslashlower ]; then
|
||||
echo $D
|
||||
dnoslash=$D
|
||||
cd "$1"/Yatopia-"$dnoslash"
|
||||
echo "Appyling $2 $dnoslash files!"
|
||||
dnoslashlower="${dnoslash,,}"
|
||||
if [ $dnoslashlower != "api" ]; then
|
||||
echo "$"
|
||||
echo "Import new introduced NMS files.. test"
|
||||
$scriptdir/importSources.sh $1 $2 || exit 1
|
||||
fi
|
||||
for filename in $1/patches/$2/$dnoslashlower/*.patch; do
|
||||
# Abort previous applying operation
|
||||
git am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
git am --reject --3way --whitespace=fix $filename || (
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
git add .
|
||||
git commit -m $filenameedited
|
||||
)
|
||||
done
|
||||
fi
|
||||
done
|
||||
#git am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
|
||||
enableCommitSigningIfNeeded
|
||||
|
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "[Yatopia] State: Commit Upstream"
|
||||
|
||||
(
|
||||
set -e
|
||||
|
||||
@ -9,21 +7,46 @@ function changeLog() {
|
||||
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
|
||||
cd $1 && git log --oneline ${base}...HEAD
|
||||
}
|
||||
paper=$(changeLog Tuinity)
|
||||
tuinity=$(changeLog Tuinity)
|
||||
akarin=$(changeLog Akarin)
|
||||
empirecraft=$(changeLog Empirecraft)
|
||||
origami=$(changeLog Origami)
|
||||
purpur=$(changeLog Purpur)
|
||||
rainforest=$(changeLog Rainforest)
|
||||
|
||||
updated=""
|
||||
logsuffix=""
|
||||
if [ ! -z "$paper" ]; then
|
||||
logsuffix="$logsuffix\nTuinity Changes:\n$paper"
|
||||
if [ -z "$updated" ]; then updated="Tuinity"; else updated="$updated/Tuinity"; fi
|
||||
if [ ! -z "$tuinity" ]; then
|
||||
logsuffix="$logsuffix\nTuinity Changes:\n$tuinity"
|
||||
updated="Tuinity"
|
||||
fi
|
||||
disclaimer="Upstream has released updates that appears to apply and compile correctly"
|
||||
if [ ! -z "$akarin" ]; then
|
||||
logsuffix="$logsuffix\n\nAkarin Changes:\n$akarin"
|
||||
if [ -z "$updated" ]; then updated="Akarin"; else updated="$updated/Akarin"; fi
|
||||
fi
|
||||
if [ ! -z "$empirecraft" ]; then
|
||||
logsuffix="$logsuffix\n\nEMC Changes:\n$empirecraft"
|
||||
if [ -z "$updated" ]; then updated="EMC"; else updated="$updated/EMC"; fi
|
||||
fi
|
||||
if [ ! -z "$origami" ]; then
|
||||
logsuffix="$logsuffix\n\nOrigami Changes:\n$origami"
|
||||
if [ -z "$updated" ]; then updated="Origami"; else updated="$updated/Origami"; fi
|
||||
fi
|
||||
if [ ! -z "$purpur" ]; then
|
||||
logsuffix="$logsuffix\n\nPurpur Changes:\n$purpur"
|
||||
if [ -z "$updated" ]; then updated="Purpur"; else updated="$updated/Purpur"; fi
|
||||
fi
|
||||
if [ ! -z "$rainforest" ]; then
|
||||
logsuffix="$logsuffix\n\nRainforest Changes:\n$rainforest"
|
||||
if [ -z "$updated" ]; then updated="Rainforest"; else updated="$updated/Rainforest"; fi
|
||||
fi
|
||||
disclaimer="Upstream/An Sidestream has released updates that appears to apply and compile correctly\nThis update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing."
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
disclaimer="$@"
|
||||
fi
|
||||
|
||||
log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
|
||||
log="Updated Upstream and Sidestream(s) ($updated)\n\n${disclaimer}${logsuffix}"
|
||||
|
||||
echo -e "$log" | git commit -F -
|
||||
|
||||
|
@ -1,30 +1,23 @@
|
||||
cd Yatopia-$2
|
||||
for filename in $1/patches/$2/*.patch; do
|
||||
# Abort previous applying operation
|
||||
git am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
git am --reject --whitespace=fix --no-utf8 --3way --ignore-whitespace $filename || (
|
||||
#files=`$gitcmd diff --name-only | grep -E '.rej$' `
|
||||
#if [[ files != null ]]; then
|
||||
# for filerej in files; do
|
||||
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
|
||||
# rm -f filerej
|
||||
# done
|
||||
#fi
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
git add .
|
||||
git commit -m $filenameedited
|
||||
)
|
||||
echo "Press any key to continue"
|
||||
while [ true ] ; do
|
||||
read -t 3 -n 1
|
||||
if [ $? = 0 ] ; then
|
||||
exit ;
|
||||
else
|
||||
echo "waiting for the keypress"
|
||||
fi
|
||||
done
|
||||
# Abort previous applying operation
|
||||
git am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
git am --reject --whitespace=fix --3way --ignore-whitespace $filename || (
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
git add .
|
||||
git commit -m $filenameedited
|
||||
)
|
||||
echo "Press any key to continue"
|
||||
while [ true ]; do
|
||||
read -t 3 -n 1
|
||||
if [ $? = 0 ]; then
|
||||
exit
|
||||
else
|
||||
echo "waiting for the keypress"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
@ -20,7 +20,7 @@ cd mc-dev
|
||||
|
||||
# prepare to push
|
||||
if [ ! -d ".git" ]; then
|
||||
$gitcmd init
|
||||
$gitcmd init
|
||||
fi
|
||||
|
||||
# reset dev files to raw nms in spigot naming
|
||||
@ -31,11 +31,10 @@ cp $decompile/net/minecraft/server/*.java src/net/minecraft/server
|
||||
paperserver="$basedir/Tuinity/Tuinity-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
|
||||
for file in $(/bin/ls $paperserver); do
|
||||
if [ -f "$file" ]; then
|
||||
rm -f "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
# push the dev project
|
||||
|
@ -6,47 +6,44 @@ i=0
|
||||
echo "Starting Upstream Patching!"
|
||||
cd $patchdir
|
||||
for D in */; do
|
||||
if [ -d "${D}" ]; then
|
||||
dnoslash=${D%/*}
|
||||
if [[ $dnoslash != "server" ]]; then
|
||||
if [[ $dnoslash != "api" ]]; then
|
||||
echo "Found $dnoslash directory!"
|
||||
for file in ${searchtxts[@]}; do
|
||||
if [ -f "$1/patches/$dnoslash/$file.txt" ]; then
|
||||
i=0
|
||||
rm -rf -f "$1/patches/$dnoslash/$file/"
|
||||
echo "Looking for $file file!"
|
||||
IFS='&'
|
||||
read -ra ADDR <<< $(cat $patchdir/$dnoslash/$file.txt)
|
||||
for patch in ${ADDR[@]}; do
|
||||
echo "Found $patch in $file!"
|
||||
echo $1/$dnoslash/patches/$file
|
||||
for filename in $1/$dnoslash/patches/$file/*.patch; do
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
#filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenamens::-6}
|
||||
#echo $filenameedited
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
if [[ $filenameedited == $patch ]]; then
|
||||
echo "Found Matching file!"
|
||||
if [[ $i == 0 ]]; then
|
||||
echo "Making $file dir in $dnoslash patch dir"
|
||||
mkdir $1/patches/$dnoslash/$file
|
||||
fi
|
||||
((i=i+1))
|
||||
printf -v num "%04d" $i
|
||||
echo "Making ${num}-${patch}.patch file for Yatopia"
|
||||
cp $1/$dnoslash/patches/$file/$filenamens $1/patches/$dnoslash/$file/"${num}-${patch}.patch"
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=' '
|
||||
fi
|
||||
done
|
||||
$1/scripts/applyUpstream.sh $1 $dnoslash || exit 1
|
||||
fi
|
||||
fi
|
||||
if [ -d "${D}" ]; then
|
||||
dnoslash=${D%/*}
|
||||
if [[ $dnoslash != "server" ]]; then
|
||||
if [[ $dnoslash != "api" ]]; then
|
||||
echo "Found $dnoslash directory!"
|
||||
for file in ${searchtxts[@]}; do
|
||||
if [ -f "$1/patches/$dnoslash/$file.txt" ]; then
|
||||
i=0
|
||||
rm -rf -f "$1/patches/$dnoslash/$file/"
|
||||
echo "Looking for $file file!"
|
||||
IFS='&'
|
||||
read -ra ADDR <<<$(cat $patchdir/$dnoslash/$file.txt)
|
||||
for patch in ${ADDR[@]}; do
|
||||
echo "Found $patch in $file!"
|
||||
echo $1/$dnoslash/patches/$file
|
||||
for filename in $1/$dnoslash/patches/$file/*.patch; do
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens::-6}
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
if [[ $filenameedited == $patch ]]; then
|
||||
echo "Found Matching file!"
|
||||
if [[ $i == 0 ]]; then
|
||||
echo "Making $file dir in $dnoslash patch dir"
|
||||
mkdir $1/patches/$dnoslash/$file
|
||||
fi
|
||||
((i = i + 1))
|
||||
printf -v num "%04d" $i
|
||||
echo "Making ${num}-${patch}.patch file for Yatopia"
|
||||
cp $1/$dnoslash/patches/$file/$filenamens $1/patches/$dnoslash/$file/"${num}-${patch}.patch"
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=' '
|
||||
fi
|
||||
done
|
||||
$1/scripts/applyUpstream.sh $1 $dnoslash || exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -26,11 +26,11 @@ papersrcdir="$basedir/Yatopia-Server/src/main/java"
|
||||
papernmsdir="$papersrcdir/net/minecraft/server"
|
||||
|
||||
(
|
||||
# fast-fail if Paper not set
|
||||
if [ ! -d "$papernmsdir" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup."
|
||||
exit 1
|
||||
fi
|
||||
# fast-fail if Paper not set
|
||||
if [ ! -d "$papernmsdir" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup."
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
minecraftversion=$(cat "$basedir"/Tuinity/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
@ -40,123 +40,108 @@ nms="net/minecraft/server"
|
||||
export IMPORT_LOG="" # for commit message, list all files and source for libs
|
||||
basedir
|
||||
|
||||
function importToPaperWorkspace {
|
||||
if [ -f "$papernmsdir/$1.java" ]; then
|
||||
# echo " $(bashcolor 1 33)Skipped$(bashcolorend) - Already imported $1.java"
|
||||
return 0
|
||||
fi
|
||||
function importToPaperWorkspace() {
|
||||
if [ -f "$papernmsdir/$1.java" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
file="$1.java"
|
||||
target="$papernmsdir/$file"
|
||||
base="$decompiledir/$nms/$file"
|
||||
file="$1.java"
|
||||
target="$papernmsdir/$file"
|
||||
base="$decompiledir/$nms/$file"
|
||||
|
||||
if [[ ! -f "$target" ]]; then
|
||||
export IMPORT_LOG="$IMPORT_LOG Import: $file\n";
|
||||
echo "Import: $file"
|
||||
cp "$base" "$target"
|
||||
fi
|
||||
if [[ ! -f "$target" ]]; then
|
||||
export IMPORT_LOG="$IMPORT_LOG Import: $file\n"
|
||||
echo "Import: $file"
|
||||
cp "$base" "$target"
|
||||
fi
|
||||
}
|
||||
|
||||
function importLibraryToPaperWorkspace {
|
||||
group=$1
|
||||
lib=$2
|
||||
prefix=$3
|
||||
shift 3
|
||||
for file in "$@"; do
|
||||
file="$prefix/$file"
|
||||
target="$papersrcdir/$file"
|
||||
targetdir=$(dirname "$target")
|
||||
mkdir -p "${targetdir}"
|
||||
|
||||
base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
if [ ! -f "$base" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find file $file.java of lib $lib in group $group to import, re-decomplie or remove the import."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export IMPORT_LOG="$IMPORT_LOG Import: $file from lib $lib\n";
|
||||
echo "Import: $file ($lib)"
|
||||
sed 's/\r$//' "$base" > "$target" || exit 1
|
||||
done
|
||||
function importLibraryToPaperWorkspace() {
|
||||
group=$1
|
||||
lib=$2
|
||||
prefix=$3
|
||||
shift 3
|
||||
for file in "$@"; do
|
||||
file="$prefix/$file"
|
||||
target="$papersrcdir/$file"
|
||||
targetdir=$(dirname "$target")
|
||||
mkdir -p "${targetdir}"
|
||||
|
||||
base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
if [ ! -f "$base" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find file $file.java of lib $lib in group $group to import, re-decomplie or remove the import."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export IMPORT_LOG="$IMPORT_LOG Import: $file from lib $lib\n"
|
||||
echo "Import: $file ($lib)"
|
||||
sed 's/\r$//' "$base" >"$target" || exit 1
|
||||
done
|
||||
}
|
||||
|
||||
(
|
||||
# Reset to last NORMAL commit if already have imported before
|
||||
cd "$paperserverdir"
|
||||
lastcommit=$(git log -1 --pretty=oneline --abbrev-commit)
|
||||
if [[ "$lastcommit" = *"Extra dev imports of $forkname"* ]]; then
|
||||
git reset --hard HEAD^
|
||||
fi
|
||||
# Reset to last NORMAL commit if already have imported before
|
||||
cd "$paperserverdir"
|
||||
lastcommit=$(git log -1 --pretty=oneline --abbrev-commit)
|
||||
if [[ "$lastcommit" == *"Extra dev imports of $forkname"* ]]; then
|
||||
git reset --hard HEAD^
|
||||
fi
|
||||
)
|
||||
|
||||
# Filter and import every files which have patch to modify
|
||||
|
||||
if [[ $forkname != "Yatopia" ]]; then
|
||||
if [[ $forkname != null ]]; then
|
||||
echo "test: $forkname == Purpur"
|
||||
patchedFiles=$(cat patches/$forkname/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
patchedFilesNonNMS=$(cat patches/$forkname/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')
|
||||
else
|
||||
echo "test: $forkname == Yatopia"
|
||||
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
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')
|
||||
fi
|
||||
else
|
||||
if [[ $forkname != null ]]; then
|
||||
echo "test: $forkname == Purpur"
|
||||
patchedFiles=$(cat patches/$forkname/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
patchedFilesNonNMS=$(cat patches/$forkname/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')
|
||||
else
|
||||
echo "test: $forkname == Yatopia"
|
||||
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
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')
|
||||
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
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')
|
||||
fi
|
||||
else
|
||||
echo "test: $forkname == Yatopia"
|
||||
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
||||
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')
|
||||
fi
|
||||
(
|
||||
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
|
||||
#if [[ $3 != "Yatopia" ]]; then
|
||||
#if [[ $3 != null ]]; then
|
||||
#$gitcmd branch -D ${3}-upstream &>/dev/null
|
||||
#$gitcmd branch -f ${3}-upstream HEAD && $gitcmd checkout ${3}-upstream
|
||||
#else
|
||||
#$gitcmd branch -D upstream &>/dev/null
|
||||
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
|
||||
#fi
|
||||
#else
|
||||
#$gitcmd branch -D upstream &>/dev/null
|
||||
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
|
||||
#fi
|
||||
cd "$paperserverdir"
|
||||
)
|
||||
|
||||
basedir
|
||||
for f in $patchedFiles; do
|
||||
containsElement "$f" ${patchedFilesNonNMS[@]}
|
||||
if [ "$?" == "1" ]; then
|
||||
if [ ! -f "$papersrcdir/$nms/$f.java" ]; then
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find NMS file $f.java to import, re-decomplie or remove the import."
|
||||
exit 1
|
||||
else
|
||||
importToPaperWorkspace $f
|
||||
fi
|
||||
fi
|
||||
containsElement "$f" ${patchedFilesNonNMS[@]}
|
||||
if [ "$?" == "1" ]; then
|
||||
if [ ! -f "$papersrcdir/$nms/$f.java" ]; then
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find NMS file $f.java to import, re-decomplie or remove the import."
|
||||
exit 1
|
||||
else
|
||||
importToPaperWorkspace $f
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# NMS import format:
|
||||
# importToPaperWorkspace MinecraftServer
|
||||
|
||||
# Library import format (multiple files are supported):
|
||||
# NOTE: Imported libraries aren't a temporary change, YOU NEED TO LEAVE THEM AS IS!!!!
|
||||
# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
||||
# Submit imports by commit with file descriptions
|
||||
(
|
||||
cd "$paperserverdir"
|
||||
# rm -rf nms-patches
|
||||
git add . &> /dev/null
|
||||
echo -e "Extra dev imports of $forkname\n\n$IMPORT_LOG"
|
||||
git commit -m "Extra dev imports of $forkname"
|
||||
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
|
||||
cd "$paperserverdir"
|
||||
# rm -rf nms-patches
|
||||
git add . &>/dev/null
|
||||
echo -e "Extra dev imports of $forkname\n\n$IMPORT_LOG"
|
||||
git commit -m "Extra dev imports of $forkname"
|
||||
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
|
||||
)
|
||||
|
0
scripts/initUpstream.sh
Executable file → Normal file
0
scripts/initUpstream.sh
Executable file → Normal file
23
scripts/instRemappedJar.sh
Normal file
23
scripts/instRemappedJar.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# SCRIPT HEADER start
|
||||
echo " "
|
||||
echo "----------------------------------------"
|
||||
echo " $(bashcolor 1 32)Task$(bashcolorend) - Install remapped jar"
|
||||
echo " This will install the minecraft-server dependency in your maven local repository"
|
||||
echo " Use this only if you have dependency issues with it"
|
||||
echo "----------------------------------------"
|
||||
# SCRIPT HEADER end
|
||||
|
||||
PS1=$
|
||||
basedir=$(pwd)
|
||||
|
||||
minecraftversion=$(cat "$basedir/Tuinity/Paper/work/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||
jarpath="$basedir/Tuinity/Paper/work/Minecraft/$minecraftversion"
|
||||
|
||||
cd "$basedir/Tuinity/Paper/work/CraftBukkit" || exit 1 # Need to be in a directory with a valid POM otherwise maven complains
|
||||
mvn install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=io.papermc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to install minecraft-server dependency"
|
||||
exit 1
|
||||
fi
|
@ -21,8 +21,8 @@ serverjar="$basedir/Yatopia-Server/target/yatopia-$mcver.jar"
|
||||
vanillajar="$paperworkdir/Minecraft/$mcver/$mcver.jar"
|
||||
|
||||
(
|
||||
cd "$paperworkdir/Paperclip"
|
||||
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$serverjar" "-Dvanillajar=$vanillajar"
|
||||
cd "$paperworkdir/Paperclip"
|
||||
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$serverjar" "-Dvanillajar=$vanillajar"
|
||||
)
|
||||
mkdir -p "$basedir/target"
|
||||
cp "$paperworkdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/yatopia-${mcver}-paperclip.jar"
|
||||
|
@ -14,31 +14,30 @@ echo " - $(bashcolor 1 32)2$(bashcolorend) : Server"
|
||||
echo "----------------------------------------"
|
||||
# SCRIPT HEADER end
|
||||
|
||||
function savePatches {
|
||||
targetname=$1
|
||||
basedir
|
||||
mkdir -p $basedir/patches/$2
|
||||
if [ -d ".git/rebase-apply" ]; then
|
||||
# in middle of a rebase, be smarter
|
||||
echo "REBASE DETECTED - PARTIAL SAVE"
|
||||
last=$(cat ".git/rebase-apply/last")
|
||||
next=$(cat ".git/rebase-apply/next")
|
||||
declare -a files=("$basedir/patches/$2/"*.patch)
|
||||
for i in $(seq -f "%04g" 1 1 $last)
|
||||
do
|
||||
if [ $i -lt $next ]; then
|
||||
rm "${files[`expr $i - 1`]}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
rm -rf $basedir/patches/$2/*.patch
|
||||
fi
|
||||
function savePatches() {
|
||||
targetname=$1
|
||||
basedir
|
||||
mkdir -p $basedir/patches/$2
|
||||
if [ -d ".git/rebase-apply" ]; then
|
||||
# in middle of a rebase, be smarter
|
||||
echo "REBASE DETECTED - PARTIAL SAVE"
|
||||
last=$(cat ".git/rebase-apply/last")
|
||||
next=$(cat ".git/rebase-apply/next")
|
||||
declare -a files=("$basedir/patches/$2/"*.patch)
|
||||
for i in $(seq -f "%04g" 1 1 $last); do
|
||||
if [ $i -lt $next ]; then
|
||||
rm "${files[$(expr $i - 1)]}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
rm -rf $basedir/patches/$2/*.patch
|
||||
fi
|
||||
|
||||
cd "$basedir/$targetname"
|
||||
$gitcmd format-patch --no-signature --zero-commit --full-index --no-stat -N -o "$basedir/patches/$2" master >/dev/null
|
||||
basedir
|
||||
$gitcmd add -A "$basedir/patches/$2"
|
||||
echo " $(bashcolor 1 32)($3/$4)$(bashcolorend) - Patches saved for $targetname to patches/$2"
|
||||
cd "$basedir/$targetname"
|
||||
$gitcmd format-patch --no-signature --zero-commit --full-index --no-stat -N -o "$basedir/patches/$2" master >/dev/null
|
||||
basedir
|
||||
$gitcmd add -A "$basedir/patches/$2"
|
||||
echo " $(bashcolor 1 32)($3/$4)$(bashcolorend) - Patches saved for $targetname to patches/$2"
|
||||
}
|
||||
|
||||
savePatches ${FORK_NAME}-API api 1 2
|
||||
|
@ -5,37 +5,36 @@ basedir=$1
|
||||
basename=$(basename $baseproject)
|
||||
branch=HEAD
|
||||
for type in ${searchtxts[@]}; do
|
||||
baseproject=Tuinity/Tuinity-$type
|
||||
target=Yatopia-$type
|
||||
echo "$baseproject, $target, $branch, $basedir, $type, $basename"
|
||||
echo "Setup upstream project.."
|
||||
echo "$basedir/$baseproject"
|
||||
cd "$basedir/$baseproject"
|
||||
git fetch --all &> /dev/null
|
||||
# Create the upstream branch in Paper project with current state
|
||||
git checkout master >/dev/null 2>&1 # possibly already in
|
||||
git branch -D upstream &> /dev/null
|
||||
git branch -f upstream "$branch" &> /dev/null && git checkout upstream &> /dev/null
|
||||
cd $basedir
|
||||
# Create source project dirs
|
||||
if [ ! -d "$basedir/$target" ]; then
|
||||
mkdir "$basedir/$target"
|
||||
cd "$basedir/$target"
|
||||
# git remote add origin "$5"
|
||||
fi
|
||||
echo "$basedir/$target"
|
||||
baseproject=Tuinity/Tuinity-$type
|
||||
target=Yatopia-$type
|
||||
echo "$baseproject, $target, $branch, $basedir, $type, $basename"
|
||||
echo "Setup upstream project.."
|
||||
echo "$basedir/$baseproject"
|
||||
cd "$basedir/$baseproject"
|
||||
git fetch --all &>/dev/null
|
||||
# Create the upstream branch in Paper project with current state
|
||||
git checkout master >/dev/null 2>&1 # possibly already in
|
||||
git branch -D upstream &>/dev/null
|
||||
git branch -f upstream "$branch" &>/dev/null && git checkout upstream &>/dev/null
|
||||
cd $basedir
|
||||
# Create source project dirs
|
||||
if [ ! -d "$basedir/$target" ]; then
|
||||
mkdir "$basedir/$target"
|
||||
cd "$basedir/$target"
|
||||
git init > /dev/null 2>&1
|
||||
# git remote add origin "$5"
|
||||
fi
|
||||
echo "$basedir/$target"
|
||||
cd "$basedir/$target"
|
||||
git init >/dev/null 2>&1
|
||||
|
||||
echo " "
|
||||
echo "Reset $target to $basename.."
|
||||
# Add the generated Paper project as the upstream remote of subproject
|
||||
git remote rm upstream &> /dev/null
|
||||
git remote add upstream "$basedir/$baseproject" &> /dev/null
|
||||
# Ensure that we are in the branch we want so not overriding things
|
||||
git checkout master &> /dev/null || git checkout -b master &> /dev/null
|
||||
git fetch upstream &> /dev/null
|
||||
# Reset our source project to Paper
|
||||
cd "$basedir/$target" && git reset --hard upstream/upstream &> /dev/null
|
||||
echo " "
|
||||
echo "Reset $target to $basename.."
|
||||
# Add the generated Paper project as the upstream remote of subproject
|
||||
git remote rm upstream &>/dev/null
|
||||
git remote add upstream "$basedir/$baseproject" &>/dev/null
|
||||
# Ensure that we are in the branch we want so not overriding things
|
||||
git checkout master &>/dev/null || git checkout -b master &>/dev/null
|
||||
git fetch upstream &>/dev/null
|
||||
# Reset our source project to Paper
|
||||
cd "$basedir/$target" && git reset --hard upstream/upstream &>/dev/null
|
||||
done
|
||||
|
||||
|
@ -26,18 +26,6 @@ echo "----------------------------------------"
|
||||
set -e
|
||||
|
||||
subtasks=1
|
||||
#if [ "$updatepaper" == "1" ]; then
|
||||
#echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.."
|
||||
#$gitcmd submodule update --init --remote
|
||||
#fi
|
||||
|
||||
#if [[ "$2" == "--resetPaper" ]]; then
|
||||
#echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Reset Paper submodule.."
|
||||
#paperdir
|
||||
#$gitcmd fetch && $gitcmd reset --hard origin/master
|
||||
#basedir
|
||||
#$gitcmd add Paper
|
||||
#fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
$basedir/scripts/fetchUpstream.sh
|
||||
@ -56,41 +44,5 @@ paperVer=$(gethead Tuinity)
|
||||
paperdir
|
||||
./tuinity patch
|
||||
|
||||
#cd "Paper-Server"
|
||||
#mcVer=$($mvncmd -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }')
|
||||
|
||||
#echo " $(bashcolor 1 32)(1/$subtasks)$(bashcolorend) - Import necessary sources.."
|
||||
#basedir
|
||||
#"$basedir"/scripts/importSources.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 $2}')"
|
||||
#echo "$tag" > "$basedir"/current-paper
|
||||
|
||||
# "$basedir"/scripts/generateImports.sh $1 # unused
|
||||
|
||||
#echo " $(bashcolor 1 32)(1/$subtasks)$(bashcolorend) - Tagging Paper submodules.."
|
||||
#function tag {
|
||||
# paperdir && cd $1
|
||||
# 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 -e "$version"
|
||||
|
||||
#forcetag=0
|
||||
#if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then
|
||||
# forcetag=1
|
||||
#fi
|
||||
|
||||
#tag Paper-API $forcetag
|
||||
#tag Paper-Server $forcetag
|
||||
|
||||
echo " $(bashcolor 1 32)($subtasks/$subtasks) Succeed$(bashcolorend) - Submodules have been updated, regenerated and imported, run 'Yatopia patch' to test/fix patches, and by 'Yatopia rbp' to rebuild patches that fixed with the updated upstream."
|
||||
echo " "
|
||||
|
||||
# gitpush Paper-API $PAPER_API_REPO $tag
|
||||
# gitpush Paper-Server $PAPER_SERVER_REPO $tag
|
||||
|
362
yatopia
362
yatopia
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# Yatopia Build Script
|
||||
|
||||
############################################################################
|
||||
@ -15,191 +15,197 @@ set -e
|
||||
|
||||
source "./scripts/functions.sh"
|
||||
|
||||
JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
|
||||
JAVA_VERSION=$(java -version 2>&1 | awk 'NR==1{ gsub(/"/,""); print $3 }')
|
||||
|
||||
failed=0
|
||||
case "$1" in
|
||||
"reset")
|
||||
"reset")
|
||||
(
|
||||
$scriptdir/resetToUpstream.sh "$basedir"
|
||||
) || failed=1
|
||||
;;
|
||||
"i" | "in" | "init" | "initsubmodules")
|
||||
(
|
||||
set -e
|
||||
basedir
|
||||
$scriptdir/initUpstream.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"r" | "rb" | "rbp" | "rebuild")
|
||||
(
|
||||
set -e
|
||||
basedir
|
||||
$scriptdir/rebuildPatches.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"a" | "p" | "patch" | "apply")
|
||||
(
|
||||
set -e
|
||||
$scriptdir/applyPatches.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"b" | "bu" | "build" | "install")
|
||||
(
|
||||
echo "$JAVA_VERSION"
|
||||
basedir
|
||||
$mvncmd -N install surefire-report:report
|
||||
cd ${FORK_NAME}-API
|
||||
$mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install
|
||||
) || failed=1
|
||||
;;
|
||||
"j" | "launcher" | "jar" | "paperclip")
|
||||
(
|
||||
basedir
|
||||
$scriptdir/installLauncher.sh "$basedir"
|
||||
) || failed=1
|
||||
;;
|
||||
"u" | "up" | "upstream" | "update")
|
||||
(
|
||||
basedir
|
||||
$scriptdir/updateUpstream.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"tu" | "tup" | "tupstream" | "tupdate")
|
||||
(
|
||||
$scriptdir/updateUpstream.sh "$basedir" true
|
||||
)
|
||||
;;
|
||||
"r" | "root")
|
||||
basedir
|
||||
;;
|
||||
"a" | "api")
|
||||
cd "$basedir/Yatopia-API"
|
||||
;;
|
||||
"s" | "server")
|
||||
cd "$basedir/Yatopia-Server"
|
||||
;;
|
||||
"c" | "clean")
|
||||
rm -rf Yatopia-API
|
||||
rm -rf Yatopia-Server
|
||||
rm -rf Paper
|
||||
echo "Cleaned build files"
|
||||
;;
|
||||
"clear")
|
||||
rm -rf Yatopia-API
|
||||
rm -rf Yatopia-Server
|
||||
;;
|
||||
"fp" | "fpatch" | "fixpatch")
|
||||
$scriptdir/fixPatch.sh "$basedir" $2 || exit 1
|
||||
;;
|
||||
"f" | "fu" | "full" | "fullbuild")
|
||||
(
|
||||
echo "$JAVA_VERSION"
|
||||
basedir
|
||||
$scriptdir/updateUpstream.sh "$basedir" false true || exit 1
|
||||
set -e
|
||||
$scriptdir/applyPatches.sh "$basedir" || exit 1
|
||||
basedir
|
||||
$mvncmd -N install surefire-report:report
|
||||
cd ${FORK_NAME}-API
|
||||
($mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install surefire-report:report) || exit 1
|
||||
$scriptdir/installLauncher.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"e" | "edit")
|
||||
case "$2" in
|
||||
"s" | "server")
|
||||
export Yatopia_LAST_EDIT="$basedir/Yatopia-Server"
|
||||
cd "$basedir/Yatopia-Server"
|
||||
(
|
||||
$scriptdir/resetToUpstream.sh "$basedir"
|
||||
) || failed=1
|
||||
;;
|
||||
"i" | "in" | "init" | "initsubmodules")
|
||||
(
|
||||
set -e
|
||||
basedir
|
||||
$scriptdir/initUpstream.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"r" | "rb" | "rbp" | "rebuild")
|
||||
(
|
||||
set -e
|
||||
basedir
|
||||
#$scriptdir/importSources.sh "$basedir" || exit 1
|
||||
$scriptdir/rebuildPatches.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"a" | "p" | "patch" | "apply")
|
||||
(
|
||||
set -e
|
||||
$scriptdir/applyPatches.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
;;
|
||||
"b" | "bu" | "build" | "install")
|
||||
(
|
||||
echo "$JAVA_VERSION"
|
||||
basedir
|
||||
$mvncmd -N install surefire-report:report
|
||||
cd ${FORK_NAME}-API
|
||||
$mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install
|
||||
) || failed=1
|
||||
;;
|
||||
"j" | "launcher" | "jar" | "paperclip")
|
||||
(
|
||||
basedir
|
||||
$scriptdir/installLauncher.sh "$basedir"
|
||||
) || failed=1
|
||||
;;
|
||||
"u" | "up" | "upstream" | "update")
|
||||
(
|
||||
basedir
|
||||
$scriptdir/updateUpstream.sh "$basedir"
|
||||
set -e
|
||||
gitstash
|
||||
cd "$basedir/Paper/Paper-Server"
|
||||
$gitcmd fetch --all
|
||||
# Create the upstream branch in Paper project with current state
|
||||
$gitcmd checkout master # possibly already in
|
||||
$gitcmd branch -D upstream || true
|
||||
$gitcmd branch -f upstream HEAD
|
||||
cd "$basedir/Yatopia-Server"
|
||||
$gitcmd rebase -i upstream/upstream
|
||||
gitunstash
|
||||
)
|
||||
;;
|
||||
"tu" | "tup" | "tupstream" | "tupdate")
|
||||
"a" | "api")
|
||||
export Yatopia_LAST_EDIT="$basedir/Yatopia-API"
|
||||
cd "$basedir/Yatopia-API"
|
||||
(
|
||||
$scriptdir/updateUpstream.sh "$basedir" true
|
||||
set -e
|
||||
gitstash
|
||||
cd "$basedir/Paper/Paper-API"
|
||||
$gitcmd fetch --all
|
||||
# Create the upstream branch in Paper project with current state
|
||||
$gitcmd checkout master # possibly already in
|
||||
$gitcmd branch -D upstream || true
|
||||
$gitcmd branch -f upstream HEAD
|
||||
cd "$basedir/Yatopia-API"
|
||||
$gitcmd rebase -i upstream/upstream
|
||||
gitunstash
|
||||
)
|
||||
;;
|
||||
"r" | "root")
|
||||
basedir
|
||||
;;
|
||||
"a" | "api")
|
||||
cd "$basedir/Yatopia-API"
|
||||
;;
|
||||
"s" | "server")
|
||||
cd "$basedir/Yatopia-Server"
|
||||
;;
|
||||
"fup" | "fetchupstream")
|
||||
$scriptdir/fetchUpstream.sh "$basedir" || exit 1
|
||||
;;
|
||||
"c" | "clean")
|
||||
rm -rf Yatopia-API
|
||||
rm -rf Yatopia-Server
|
||||
rm -rf Paper
|
||||
echo "Cleaned build files"
|
||||
;;
|
||||
"fp" | "fpatch" | "fixpatch")
|
||||
$scriptdir/fixPatch.sh "$basedir" $2 || exit 1
|
||||
;;
|
||||
"f" | "fu" | "full" | "fullbuild")
|
||||
"c" | "continue")
|
||||
cd "$Yatopia_LAST_EDIT"
|
||||
unset Yatopia_LAST_EDIT
|
||||
(
|
||||
echo "$JAVA_VERSION"
|
||||
basedir
|
||||
$scriptdir/updateUpstream.sh "$basedir" false true || exit 1
|
||||
set -e
|
||||
$scriptdir/applyPatches.sh "$basedir" || exit 1
|
||||
basedir
|
||||
$mvncmd -N install surefire-report:report
|
||||
cd ${FORK_NAME}-API
|
||||
($mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install surefire-report:report) || exit 1
|
||||
$scriptdir/installLauncher.sh "$basedir" || exit 1
|
||||
) || failed=1
|
||||
set -e
|
||||
$gitcmd add .
|
||||
$gitcmd commit --amend
|
||||
$gitcmd rebase --continue
|
||||
basedir
|
||||
$scriptdir/rebuildPatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"e" | "edit")
|
||||
case "$2" in
|
||||
"s" | "server")
|
||||
export Yatopia_LAST_EDIT="$basedir/Yatopia-Server"
|
||||
cd "$basedir/Yatopia-Server"
|
||||
(
|
||||
set -e
|
||||
gitstash
|
||||
cd "$basedir/Paper/Paper-Server"
|
||||
$gitcmd fetch --all
|
||||
# Create the upstream branch in Paper project with current state
|
||||
$gitcmd checkout master # possibly already in
|
||||
$gitcmd branch -D upstream || true
|
||||
$gitcmd branch -f upstream HEAD
|
||||
cd "$basedir/Yatopia-Server"
|
||||
$gitcmd rebase -i upstream/upstream
|
||||
gitunstash
|
||||
)
|
||||
;;
|
||||
"a" | "api")
|
||||
export Yatopia_LAST_EDIT="$basedir/Yatopia-API"
|
||||
cd "$basedir/Yatopia-API"
|
||||
(
|
||||
set -e
|
||||
gitstash
|
||||
cd "$basedir/Paper/Paper-API"
|
||||
$gitcmd fetch --all
|
||||
# Create the upstream branch in Paper project with current state
|
||||
$gitcmd checkout master # possibly already in
|
||||
$gitcmd branch -D upstream || true
|
||||
$gitcmd branch -f upstream HEAD
|
||||
cd "$basedir/Yatopia-API"
|
||||
$gitcmd rebase -i upstream/upstream
|
||||
gitunstash
|
||||
)
|
||||
;;
|
||||
"c" | "continue")
|
||||
cd "$Yatopia_LAST_EDIT"
|
||||
unset Yatopia_LAST_EDIT
|
||||
(
|
||||
set -e
|
||||
$gitcmd add .
|
||||
$gitcmd commit --amend
|
||||
$gitcmd rebase --continue
|
||||
basedir
|
||||
$scriptdir/rebuildPatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
*)
|
||||
echo "You must edit either the api or server."
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"setup")
|
||||
if [[ -f ~/.bashrc ]] ; then
|
||||
NAME="Yatopia"
|
||||
if [[ ! -z "${2+x}" ]] ; then
|
||||
NAME="$2"
|
||||
fi
|
||||
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
|
||||
alias "$NAME=. $SOURCE"
|
||||
echo "You can now just type '$NAME' at any time to access the Yatopia tool."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Yatopia build tool command. This provides a variety of commands to build and manage the Yatopia build"
|
||||
echo "environment. For all of the functionality of this command to be available, you must first run the"
|
||||
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
|
||||
echo ""
|
||||
echo " Normal commands:"
|
||||
echo " * r, rebuild | Rebuild patches, can be called from anywhere."
|
||||
echo " * p, patch | Apply all patches to top of Paper without building it. Can be run from anywhere."
|
||||
echo " * u, update | Updates all submodules. Can be run from anywhere."
|
||||
echo " * b, build | Build the projects, including the API and the Server. Can be ran anywhere."
|
||||
echo " * j, jar | Build the projects and build the launcher jar. Can be ran anywhere."
|
||||
echo " * d, deploy | Build the projects and deploy through Maven. Can be ran anywhere."
|
||||
echo " * tupstream | Updates only tuinity submodule. Can be ran everywhere."
|
||||
echo ""
|
||||
echo " These commands require the setup command before use:"
|
||||
echo " * r, root | Change directory to the root of the project."
|
||||
echo " * a. api | Move to the Yatopia-API directory."
|
||||
echo " * s, server | Move to the Yatopia-Server directory."
|
||||
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
|
||||
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
|
||||
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
|
||||
echo ""
|
||||
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
|
||||
echo " | . ./Yatopia setup"
|
||||
echo " | After you run this command you'll be able to just run 'Yatopia' from anywhere."
|
||||
echo " | The default name for the resulting alias is 'Yatopia', you can give an argument to override"
|
||||
echo " | this default, such as:"
|
||||
echo " | . ./Yatopia setup example"
|
||||
echo " | Which will allow you to run 'example' instead."
|
||||
*)
|
||||
echo "You must edit either the api or server."
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"setup")
|
||||
if [[ -f ~/.bashrc ]]; then
|
||||
NAME="Yatopia"
|
||||
if [[ ! -z "${2+x}" ]]; then
|
||||
NAME="$2"
|
||||
fi
|
||||
(grep "alias $NAME=" ~/.bashrc >/dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >>~/.bashrc)
|
||||
alias "$NAME=. $SOURCE"
|
||||
echo "You can now just type '$NAME' at any time to access the Yatopia tool."
|
||||
fi
|
||||
;;
|
||||
"mcserverdep")
|
||||
./scripts/instRemappedJar.sh
|
||||
;;
|
||||
"commitUpstream" | "cu" | "commitUp" | "commerge")
|
||||
./scripts/commitUpstream.sh
|
||||
;;
|
||||
*)
|
||||
echo "Yatopia build tool command. This provides a variety of commands to build and manage the Yatopia build"
|
||||
echo "environment. For all of the functionality of this command to be available, you must first run the"
|
||||
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
|
||||
echo ""
|
||||
echo " Normal commands:"
|
||||
echo " * r, rebuild | Rebuild patches, can be called from anywhere."
|
||||
echo " * p, patch | Apply all patches to top of Paper without building it. Can be run from anywhere."
|
||||
echo " * u, update | Updates all submodules. Can be run from anywhere."
|
||||
echo " * b, build | Build the projects, including the API and the Server. Can be ran anywhere."
|
||||
echo " * j, jar | Build the projects and build the launcher jar. Can be ran anywhere."
|
||||
echo " * d, deploy | Build the projects and deploy through Maven. Can be ran anywhere."
|
||||
echo " * tupstream | Updates only tuinity submodule. Can be ran everywhere."
|
||||
echo ""
|
||||
echo " These commands require the setup command before use:"
|
||||
echo " * r, root | Change directory to the root of the project."
|
||||
echo " * a. api | Move to the Yatopia-API directory."
|
||||
echo " * s, server | Move to the Yatopia-Server directory."
|
||||
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
|
||||
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
|
||||
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
|
||||
echo ""
|
||||
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
|
||||
echo " | . ./Yatopia setup"
|
||||
echo " | After you run this command you'll be able to just run 'Yatopia' from anywhere."
|
||||
echo " | The default name for the resulting alias is 'Yatopia', you can give an argument to override"
|
||||
echo " | this default, such as:"
|
||||
echo " | . ./Yatopia setup example"
|
||||
echo " | Which will allow you to run 'example' instead."
|
||||
;;
|
||||
esac
|
||||
|
||||
unset RCPATH
|
||||
@ -210,9 +216,9 @@ unset -f colorend
|
||||
unset -f gitstash
|
||||
unset -f gitunstash
|
||||
if [[ "$failed" == "1" ]]; then
|
||||
unset failed
|
||||
false
|
||||
unset failed
|
||||
false
|
||||
else
|
||||
unset failed
|
||||
true
|
||||
unset failed
|
||||
true
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user