mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Update 1.18.1
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# get base dir regardless of execution location
|
||||
# resolve shell-specifics
|
||||
case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in
|
||||
"/bin/zsh")
|
||||
RCPATH="$HOME/.zshrc"
|
||||
SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}"
|
||||
;;
|
||||
*)
|
||||
RCPATH="$HOME/.bashrc"
|
||||
if [[ -f "$HOME/.bash_aliases" ]]; then
|
||||
RCPATH="$HOME/.bash_aliases"
|
||||
fi
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# get base dir regardless of execution location
|
||||
|
||||
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
|
||||
PS1="$"
|
||||
|
||||
paperVer=$(cat current-paper)
|
||||
gpgsign="$(git config commit.gpgsign || echo "false")"
|
||||
echo "Rebuilding Forked projects.... "
|
||||
function applyPatch {
|
||||
what=$1
|
||||
what_name=$(basename $what)
|
||||
target=$2
|
||||
branch=$3
|
||||
patch_folder=$4
|
||||
|
||||
cd "$basedir/$what"
|
||||
git fetch --all
|
||||
git branch -f upstream "$branch" >/dev/null
|
||||
|
||||
cd "$basedir"
|
||||
if [ ! -d "$basedir/$target" ]; then
|
||||
mkdir "$basedir/$target"
|
||||
cd "$basedir/$target"
|
||||
git init
|
||||
git remote add origin "$5"
|
||||
cd "$basedir"
|
||||
fi
|
||||
cd "$basedir/$target"
|
||||
|
||||
# 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.
|
||||
git config commit.gpgsign false
|
||||
|
||||
echo "Resetting $target to $what_name..."
|
||||
git remote rm upstream > /dev/null 2>&1
|
||||
git remote add upstream "$basedir/$what" >/dev/null 2>&1
|
||||
git checkout master 2>/dev/null || git checkout -b master
|
||||
git fetch upstream >/dev/null 2>&1
|
||||
git reset --hard upstream/upstream
|
||||
echo " Applying patches to $target..."
|
||||
git am --abort >/dev/null 2>&1
|
||||
git am --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
|
||||
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"
|
||||
exit 1
|
||||
else
|
||||
echo " Patches applied cleanly to $target"
|
||||
fi
|
||||
}
|
||||
|
||||
function enableCommitSigningIfNeeded {
|
||||
if [[ "$gpgsign" == "true" ]]; then
|
||||
git config commit.gpgsign true
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Importing MC-DEV"
|
||||
./scripts/importmcdev.sh "$basedir" || exit 1
|
||||
(
|
||||
(applyPatch Paper/Paper-API ${FORK_NAME}-API HEAD api $API_REPO &&
|
||||
applyPatch Paper/Paper-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO) || exit 1
|
||||
enableCommitSigningIfNeeded
|
||||
) || (
|
||||
echo "Failed to apply patches"
|
||||
enableCommitSigningIfNeeded
|
||||
exit 1
|
||||
) || exit 1
|
||||
@@ -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
|
||||
|
||||
cd mc-dev
|
||||
if [ ! -d ".git" ]; then
|
||||
git init
|
||||
fi
|
||||
|
||||
rm src/net/minecraft/*.java
|
||||
cp -r $basedir/$decompile/net/minecraft/* src/net/minecraft
|
||||
|
||||
base="$basedir/Paper/Paper-Server/src/main/java/net/minecraft"
|
||||
cd $basedir/mc-dev/src/net/minecraft/
|
||||
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,127 +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
|
||||
|
||||
workdir="$basedir"/Paper/work
|
||||
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompiledir=$workdir/Minecraft/$minecraftversion/spigot
|
||||
|
||||
nms="net/minecraft"
|
||||
export MODLOG=""
|
||||
cd "$basedir"
|
||||
|
||||
function containsElement {
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0;
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
export importedmcdev=""
|
||||
function import {
|
||||
if [ -f "$basedir/Paper/Paper-Server/src/main/java/$nms/$1.java" ]; then
|
||||
echo "ALREADY IMPORTED $1"
|
||||
return 0
|
||||
fi
|
||||
export importedmcdev="$importedmcdev $1"
|
||||
file="${1}.java"
|
||||
target="$basedir/Paper/Paper-Server/src/main/java/$nms/$file"
|
||||
base="$decompiledir/$nms/$file"
|
||||
|
||||
if [[ ! -f "$target" ]]; then
|
||||
export MODLOG="$MODLOG Imported $file from mc-dev\n";
|
||||
mkdir -p "$(dirname "$target")"
|
||||
echo "$(bashColor 1 32) Copying $(bashColor 1 34)$base $(bashColor 1 32)to$(bashColor 1 34) $target $(bashColorReset)"
|
||||
cp "$base" "$target"
|
||||
else
|
||||
echo "$(bashColor 1 33) UN-NEEDED IMPORT STATEMENT:$(bashColor 1 34) $file $(bashColorReset)"
|
||||
fi
|
||||
}
|
||||
|
||||
function importLibrary {
|
||||
group=$1
|
||||
lib=$2
|
||||
prefix=$3
|
||||
shift 3
|
||||
for file in "$@"; do
|
||||
file="$prefix/$file"
|
||||
target="$basedir/Paper/Paper-Server/src/main/java/$file"
|
||||
targetdir=$(dirname "$target")
|
||||
mkdir -p "${targetdir}"
|
||||
base="$workdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
if [ ! -f "$base" ]; then
|
||||
echo "Missing $base"
|
||||
exit 1
|
||||
fi
|
||||
export MODLOG="$MODLOG Imported $file from $lib\n";
|
||||
sed 's/\r$//' "$base" > "$target" || exit 1
|
||||
done
|
||||
}
|
||||
|
||||
(
|
||||
cd Paper/Paper-Server/
|
||||
lastlog=$(git log -1 --oneline)
|
||||
if [[ "$lastlog" = *"Leaves-Extra mc-dev Imports"* ]]; then
|
||||
git reset --hard HEAD^
|
||||
fi
|
||||
)
|
||||
|
||||
|
||||
files=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\///g')
|
||||
|
||||
nonnms=$(grep -R "new file mode" -B 1 "$basedir/patches/server/" | grep -v "new file mode" | grep -oE --color=none "net\/minecraft\/.*.java" | sed 's/.*\/net\/minecraft\///g')
|
||||
|
||||
for f in $files; do
|
||||
containsElement "$f" ${nonnms[@]}
|
||||
if [ "$?" == "1" ]; then
|
||||
if [ ! -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/$f" ]; then
|
||||
f="$(echo "$f" | sed 's/.java//g')"
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||
echo "$(bashColor 1 31) ERROR!!! Missing NMS$(bashColor 1 34) $f $(bashColorReset)";
|
||||
error=true
|
||||
else
|
||||
import $f
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$error" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###############################################################################################
|
||||
###############################################################################################
|
||||
#################### ADD TEMPORARY ADDITIONS HERE #############################################
|
||||
###############################################################################################
|
||||
###############################################################################################
|
||||
|
||||
# import Foo
|
||||
|
||||
########################################################
|
||||
########################################################
|
||||
########################################################
|
||||
# LIBRARY IMPORTS
|
||||
# These must always be mapped manually, no automatic stuff
|
||||
#
|
||||
# # group # lib # prefix # many files
|
||||
|
||||
#importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
||||
importLibrary com.mojang brigadier com/mojang/brigadier CommandDispatcher.java
|
||||
importLibrary com.mojang brigadier com/mojang/brigadier/tree LiteralCommandNode.java
|
||||
importLibrary com.mojang brigadier com/mojang/brigadier/suggestion SuggestionsBuilder.java
|
||||
importLibrary com.mojang brigadier com/mojang/brigadier/arguments BoolArgumentType.java
|
||||
################
|
||||
(
|
||||
cd Paper/Paper-Server/
|
||||
rm -rf nms-patches
|
||||
git add src -A
|
||||
echo -e "Leaves-Extra mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
||||
exit 0
|
||||
)
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BEGIN config
|
||||
FORK_NAME="Leaves"
|
||||
API_REPO=""
|
||||
SERVER_REPO=""
|
||||
PAPER_API_REPO=""
|
||||
PAPER_SERVER_REPO=""
|
||||
MCDEV_REPO=""
|
||||
# END config
|
||||
|
||||
sourceBase=$(dirname $SOURCE)/../
|
||||
cd "${basedir:-$sourceBase}"
|
||||
|
||||
basedir=$(pwd -P)
|
||||
cd -
|
||||
|
||||
|
||||
function bashColor {
|
||||
if [ $2 ]; then
|
||||
echo -e "\e[$1;$2m"
|
||||
else
|
||||
echo -e "\e[$1m"
|
||||
fi
|
||||
}
|
||||
function bashColorReset {
|
||||
echo -e "\e[m"
|
||||
}
|
||||
|
||||
function cleanupPatches {
|
||||
cd "$1"
|
||||
for patch in *.patch; do
|
||||
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
|
||||
diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )")
|
||||
|
||||
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
|
||||
if [ "x$testver" != "x" ]; then
|
||||
diffs=$(echo "$diffs" | tail -n +3)
|
||||
fi
|
||||
|
||||
if [ "x$diffs" == "x" ] ; then
|
||||
git reset HEAD $patch >/dev/null
|
||||
git checkout -- $patch >/dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
function pushRepo {
|
||||
if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then
|
||||
echo "Pushing - $1 ($3) to $2"
|
||||
(
|
||||
cd "$1"
|
||||
git remote rm emc-push > /dev/null 2>&1
|
||||
git remote add emc-push $2 >/dev/null 2>&1
|
||||
git push emc-push $3 -f
|
||||
)
|
||||
fi
|
||||
}
|
||||
function basedir {
|
||||
cd "$basedir"
|
||||
}
|
||||
function gethead {
|
||||
(
|
||||
cd "$1"
|
||||
git log -1 --oneline
|
||||
)
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh
|
||||
# License from Paper applies to this file
|
||||
|
||||
(
|
||||
set -e
|
||||
basedir="$(cd "$1" && pwd -P)"
|
||||
workdir="$basedir/Paper/work"
|
||||
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||
paperjar="$basedir/Leaves-Server/target/leaves-$mcver.jar"
|
||||
vanillajar="$workdir/Minecraft/$mcver/$mcver.jar"
|
||||
|
||||
(
|
||||
cd "$workdir/Paperclip"
|
||||
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar"
|
||||
)
|
||||
cp "$workdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/leaves-paperclip.jar"
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Build success!"
|
||||
echo "Copied final jar to $(cd "$basedir" && pwd -P)/leaves-paperclip.jar"
|
||||
) || exit 1
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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
|
||||
|
||||
minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
|
||||
basedir
|
||||
pushRepo ${FORK_NAME}-API $API_REPO master:$minecraftversion
|
||||
pushRepo ${FORK_NAME}-Server $SERVER_REPO master:$minecraftversion
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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
|
||||
|
||||
PS1="$"
|
||||
echo "Rebuilding patch files from current fork state..."
|
||||
function savePatches {
|
||||
what=$1
|
||||
cd $basedir/$what/
|
||||
|
||||
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 $basedir/patches/$2/*.patch
|
||||
fi
|
||||
|
||||
git format-patch --no-signature --zero-commit --full-index --no-stat -N -o $basedir/patches/$2 upstream/upstream
|
||||
cd $basedir
|
||||
git add -A $basedir/patches/$2
|
||||
echo " Patches saved for $what to patches/$2"
|
||||
}
|
||||
|
||||
savePatches ${FORK_NAME}-API api
|
||||
savePatches ${FORK_NAME}-Server server
|
||||
|
||||
$basedir/scripts/push.sh
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
if [[ "$1" == up* ]]; then
|
||||
(
|
||||
cd "$basedir/Paper/"
|
||||
git fetch origin master && git reset --hard origin/master
|
||||
cd ../
|
||||
git add Paper
|
||||
)
|
||||
fi
|
||||
|
||||
paperVer=$(gethead Paper)
|
||||
cd "$basedir/Paper/"
|
||||
|
||||
./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
|
||||
|
||||
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}')"
|
||||
echo "$tag" > "$basedir"/current-paper
|
||||
|
||||
"$basedir"/scripts/generatesources.sh
|
||||
|
||||
cd Paper/
|
||||
|
||||
function tag {
|
||||
(
|
||||
cd $1
|
||||
if [ "$2" == "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"
|
||||
|
||||
forcetag=0
|
||||
if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then
|
||||
forcetag=1
|
||||
fi
|
||||
|
||||
tag Paper-API $forcetag
|
||||
tag Paper-Server $forcetag
|
||||
|
||||
pushRepo Paper-API $PAPER_API_REPO $tag
|
||||
pushRepo Paper-Server $PAPER_SERVER_REPO $tag
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
(
|
||||
set -e
|
||||
PS1="$"
|
||||
|
||||
function changelog() {
|
||||
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
|
||||
cd $1 && git log --oneline ${base}...HEAD
|
||||
}
|
||||
paper=$(changelog Paper)
|
||||
|
||||
updated=""
|
||||
logsuffix=""
|
||||
if [ ! -z "$paper" ]; then
|
||||
logsuffix="$logsuffix\n\nPaper Changes:\n$paper"
|
||||
if [ -z "$updated" ]; then updated="Paper"; else updated="$updated/Paper"; fi
|
||||
fi
|
||||
disclaimer="Upstream has released updates that appears to apply and compile correctly"
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
disclaimer="$@"
|
||||
fi
|
||||
|
||||
log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
|
||||
|
||||
echo -e "$log" | git commit -F -
|
||||
|
||||
) || exit 1
|
||||
Reference in New Issue
Block a user