mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 22:23:50 +01:00
Merge pull request #17 from budgidiere/patch-3
Better, Faster Build Piepline
This commit is contained in:
commit
1d7115db60
41
.github/workflows/build.yml
vendored
41
.github/workflows/build.yml
vendored
@ -2,6 +2,7 @@ name: CI
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
@ -9,7 +10,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [11, 8]
|
java: [11, 8, 14]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -17,30 +18,34 @@ jobs:
|
|||||||
uses: actions/setup-java@v1.3.0
|
uses: actions/setup-java@v1.3.0
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
|
- name: Pull Maven Cache
|
||||||
- uses: actions/cache@v1.1.2
|
uses: actions/cache@v1.1.2
|
||||||
|
id: maven-cache
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: ${{ runner.os }}-maven-
|
restore-keys: ${{ runner.os }}-maven-
|
||||||
|
- uses: s4u/maven-settings-action@v2.1.0
|
||||||
|
name: Use ${{ matrix.java }} as the java target
|
||||||
|
with:
|
||||||
|
properties: '[{"maven.compiler.target": "${{ matrix.java }}"}]'
|
||||||
|
- name: Setup YAPFA Project
|
||||||
|
run: |
|
||||||
|
git submodule update --init --recursive -f
|
||||||
|
git config --global user.email "ci@github.com"
|
||||||
|
git config --global user.name "Github CI"
|
||||||
|
sudo chmod -R -f 777 scripts
|
||||||
|
- name: Build Maven Depends
|
||||||
|
if: steps.maven-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd Tuinity
|
||||||
|
./tuinity jar
|
||||||
|
cd ..//
|
||||||
- name: Build YAPFA
|
- name: Build YAPFA
|
||||||
run: |
|
run: |
|
||||||
git submodule init
|
./yapfa full
|
||||||
git submodule update --init --recursive
|
|
||||||
git config --global user.email "ci@github.com"
|
|
||||||
git config --global user.name "Github CI"
|
|
||||||
yapfaDir=`pwd`
|
|
||||||
./patchPaper.sh
|
|
||||||
cd Tuinity
|
|
||||||
mvn -N install
|
|
||||||
./tuinity patch
|
|
||||||
cd $yapfaDir
|
|
||||||
./yapfa patch
|
|
||||||
./yapfa build
|
|
||||||
./yapfa paperclip
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2-preview
|
uses: actions/upload-artifact@v2-preview
|
||||||
with:
|
with:
|
||||||
name: YAPFA-${{ matrix.java }}
|
name: YAPFA-${{ matrix.java }}
|
||||||
path: yapfa-paperclip.jar
|
path: target/YAPFA-1.16.1-paperclip.jar
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ mc-dev
|
|||||||
.project
|
.project
|
||||||
.idea
|
.idea
|
||||||
yapfa-paperclip.jar
|
yapfa-paperclip.jar
|
||||||
|
|
||||||
|
target/site/surefire-report.html
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,4 @@
|
|||||||
[submodule "Tuinity"]
|
[submodule "Tuinity"]
|
||||||
path = Tuinity
|
path = Tuinity
|
||||||
url = https://github.com/Spottedleaf/Tuinity
|
url = https://github.com/tsao-chi/Tuinity-autoupstreamupdate.git
|
||||||
|
branch = ver/1.16
|
||||||
|
@ -47,11 +47,8 @@ ## Building and setting up
|
|||||||
Run the following commands in the root directory:
|
Run the following commands in the root directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
git submodule init
|
git submodule update --init --recursive --force
|
||||||
git submodule update
|
./yapfa jar
|
||||||
./fetchUpstream.sh
|
|
||||||
./yapfa build
|
|
||||||
./yapfa paperclip
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
@ -1 +1 @@
|
|||||||
1.15.2--055421230a1bb70eefcf15d57ad8551e1e9d47b1
|
1.16.1--8c602452d2ded22cb7322c41de5c78395b5f1348
|
@ -1,12 +0,0 @@
|
|||||||
cd Tuinity
|
|
||||||
git clean -fx
|
|
||||||
git clean -fd
|
|
||||||
git fetch
|
|
||||||
git reset --hard origin/ver/1.16
|
|
||||||
git submodule update --init --recursive -f
|
|
||||||
cd ..
|
|
||||||
sh patchPaper.sh
|
|
||||||
cd Tuinity
|
|
||||||
./tuinity paperclip
|
|
||||||
cd ..
|
|
||||||
./yapfa patch
|
|
@ -1 +0,0 @@
|
|||||||
cp -f ./scripts/importmcdev_paper.sh ./Tuinity/Paper/scripts/importmcdev.sh
|
|
@ -1,79 +0,0 @@
|
|||||||
#!/bin/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="$"
|
|
||||||
|
|
||||||
tuinityVer=$(cat current-tuinity)
|
|
||||||
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 am --abort ; git rebase --abort) 1>&2 2>/dev/null || true
|
|
||||||
git checkout master 2>/dev/null
|
|
||||||
git fetch upstream >/dev/null 2>&1
|
|
||||||
git reset --hard upstream/upstream
|
|
||||||
echo " Applying patches to $target..."
|
|
||||||
statusfile=".git/patch-apply-failed"
|
|
||||||
rm -f "$statusfile"
|
|
||||||
git am --abort >/dev/null 2>&1
|
|
||||||
git am --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
echo 1 > "$statusfile"
|
|
||||||
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
|
|
||||||
rm -f "$statusfile"
|
|
||||||
echo " Patches applied cleanly to $target"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
function enableCommitSigningIfNeeded {
|
|
||||||
if [[ "$gpgsign" == "true" ]]; then
|
|
||||||
git config commit.gpgsign true
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
(
|
|
||||||
(applyPatch Tuinity/Tuinity-API ${FORK_NAME}-API HEAD api $API_REPO &&
|
|
||||||
applyPatch Tuinity/Tuinity-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO) || exit 1
|
|
||||||
enableCommitSigningIfNeeded
|
|
||||||
) || (
|
|
||||||
echo "Failed to apply patches"
|
|
||||||
enableCommitSigningIfNeeded
|
|
||||||
exit 1
|
|
||||||
) || exit 1
|
|
95
scripts/applyPatches.sh
Normal file
95
scripts/applyPatches.sh
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# SCRIPT HEADER start
|
||||||
|
basedir=$1
|
||||||
|
source "$basedir/scripts/functions.sh"
|
||||||
|
echo " "
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - Apply Patches"
|
||||||
|
echo " This will apply all of YAPFA patches on top of the Paper."
|
||||||
|
echo " "
|
||||||
|
echo " $(bashcolor 1 32)Subtask:$(bashcolorend)"
|
||||||
|
echo " - Import Sources"
|
||||||
|
echo " "
|
||||||
|
echo " $(bashcolor 1 32)Modules:$(bashcolorend)"
|
||||||
|
echo " - $(bashcolor 1 32)1$(bashcolorend) : API"
|
||||||
|
echo " - $(bashcolor 1 32)2$(bashcolorend) : Server"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# SCRIPT HEADER end
|
||||||
|
|
||||||
|
needimport=$2
|
||||||
|
|
||||||
|
function applyPatch {
|
||||||
|
baseproject=$1
|
||||||
|
basename=$(basename $baseproject)
|
||||||
|
target=$2
|
||||||
|
branch=$3
|
||||||
|
patch_folder=$4
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Setup upstream project.."
|
||||||
|
cd "$basedir/$baseproject"
|
||||||
|
$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 "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null
|
||||||
|
|
||||||
|
if [[ $needimport != "1" ]]; 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir
|
||||||
|
# Create source project dirs
|
||||||
|
if [ ! -d "$basedir/$target" ]; then
|
||||||
|
mkdir "$basedir/$target"
|
||||||
|
cd "$basedir/$target"
|
||||||
|
# $gitcmd remote add origin "$5"
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
$gitcmd remote add upstream "$basedir/$baseproject" &> /dev/null
|
||||||
|
# Ensure that we are in the branch we want so not overriding things
|
||||||
|
$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 &> /dev/null
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
(applyPatch Tuinity/Tuinity-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
|
||||||
|
applyPatch Tuinity/Tuinity-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2) || exit 1
|
30
scripts/commitUpstream.sh
Normal file
30
scripts/commitUpstream.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "[YAPFA] State: Commit Upstream"
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function changeLog() {
|
||||||
|
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
|
||||||
|
cd $1 && git log --oneline ${base}...HEAD
|
||||||
|
}
|
||||||
|
paper=$(changeLog Tuinity)
|
||||||
|
|
||||||
|
updated=""
|
||||||
|
logsuffix=""
|
||||||
|
if [ ! -z "$paper" ]; then
|
||||||
|
logsuffix="$logsuffix\nTuinity Changes:\n$paper"
|
||||||
|
if [ -z "$updated" ]; then updated="Tuinity"; else updated="$updated/Tuinity"; fi
|
||||||
|
fi
|
||||||
|
disclaimer="Upstream has released updates that appears to apply and compile correctly"
|
||||||
|
|
||||||
|
if [ ! -z "$1" ]; then
|
||||||
|
disclaimer="$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
|
||||||
|
|
||||||
|
echo -e "$log" | git commit -F -
|
||||||
|
|
||||||
|
) || exit 1
|
@ -1,16 +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
|
|
||||||
}
|
|
||||||
tuinity=$(changelog Tuinity)
|
|
||||||
|
|
||||||
log="Updated Tuinity \n\nUpdating our baseline Tuinity reference\n\nTuinity changes since last:\n$tuinity"
|
|
||||||
|
|
||||||
echo -e "$log" | git commit -F -
|
|
||||||
|
|
||||||
) || exit 1
|
|
8
scripts/fetchUpstream.sh
Normal file
8
scripts/fetchUpstream.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
cd $1
|
||||||
|
cd Tuinity
|
||||||
|
git clean -fx
|
||||||
|
git clean -fd
|
||||||
|
git fetch
|
||||||
|
git reset --hard origin/ver/1.16
|
||||||
|
git submodule update --init --recursive -f
|
131
scripts/functions.sh
Normal file
131
scripts/functions.sh
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# CONFIG set
|
||||||
|
FORK_NAME="YAPFA"
|
||||||
|
API_REPO=""
|
||||||
|
SERVER_REPO=""
|
||||||
|
PAPER_API_REPO=""
|
||||||
|
PAPER_SERVER_REPO=""
|
||||||
|
MCDEV_REPO=""
|
||||||
|
|
||||||
|
# Added Multithreading to builds
|
||||||
|
# By JosephWorks
|
||||||
|
mvncmd="mvn -T 1.5C"
|
||||||
|
|
||||||
|
gitcmd="git -c commit.gpgsign=false -c core.quotepath=false -c core.safecrlf=false -c i18n.commit.encoding=UTF-8 -c i18n.logoutputencoding=UTF-8"
|
||||||
|
|
||||||
|
# DIR configure
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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
|
||||||
|
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
|
||||||
|
scriptdir=$(dirname "$SOURCE")
|
||||||
|
basedir=$(dirname "$scriptdir")
|
||||||
|
|
||||||
|
function basedir {
|
||||||
|
cd "$basedir"
|
||||||
|
}
|
||||||
|
|
||||||
|
function paperdir {
|
||||||
|
cd "$basedir/Tuinity"
|
||||||
|
}
|
||||||
|
|
||||||
|
gitcmd() {
|
||||||
|
$gitcmd "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# COLOUR functions
|
||||||
|
color() {
|
||||||
|
if [ $2 ]; then
|
||||||
|
echo -e "\e[$1;$2m"
|
||||||
|
else
|
||||||
|
echo -e "\e[$1m"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
colorend() {
|
||||||
|
echo -e "\e[m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function bashcolor {
|
||||||
|
if [ $2 ]; then
|
||||||
|
echo -e "\e[$1;$2m"
|
||||||
|
else
|
||||||
|
echo -e "\e[$1m"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function bashcolorend {
|
||||||
|
echo -e "\e[m"
|
||||||
|
}
|
||||||
|
|
||||||
|
# GIT functions
|
||||||
|
gitstash() {
|
||||||
|
STASHED=$($gitcmd stash 2>/dev/null|| return 0) # errors are ok
|
||||||
|
}
|
||||||
|
|
||||||
|
gitunstash() {
|
||||||
|
if [[ "$STASHED" != "No local changes to save" ]] ; then
|
||||||
|
$gitcmd stash pop 2>/dev/null|| return 0 # errors are ok
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gethead {
|
||||||
|
basedir
|
||||||
|
git log -1 --oneline
|
||||||
|
}
|
||||||
|
|
||||||
|
function gitpush {
|
||||||
|
if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then
|
||||||
|
echo "Push - $1 ($3) to $2"
|
||||||
|
(
|
||||||
|
basedir
|
||||||
|
git remote rm script-push > /dev/null 2>&1
|
||||||
|
git remote add script-push $2 >/dev/null 2>&1
|
||||||
|
git push script-push $3 -f
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# PATCH functions
|
||||||
|
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 containsElement {
|
||||||
|
local e
|
||||||
|
for e in "${@:2}"; do
|
||||||
|
[[ "$e" == "$1" ]] && return 0;
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
46
scripts/generateImports.sh
Normal file
46
scripts/generateImports.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "[YAPFA] State: Generate Imports"
|
||||||
|
|
||||||
|
# For a description of this script, see updateUpstream.sh.
|
||||||
|
|
||||||
|
# get base dir regardless of execution location
|
||||||
|
basedir=$1
|
||||||
|
|
||||||
|
source "$basedir/scripts/functions.sh"
|
||||||
|
|
||||||
|
paperworkdir="$basedir/Tuinity/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 raw nms in spigot naming
|
||||||
|
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/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
|
||||||
|
done
|
||||||
|
|
||||||
|
# push the dev project
|
||||||
|
cd $basedir/mc-dev
|
||||||
|
$gitcmd add . -A
|
||||||
|
$gitcmd commit . -m "YAPFA-base"
|
||||||
|
$gitcmd tag -a "YAPFA-base" -m "YAPFA-base" 2>/dev/null
|
||||||
|
# gitpush . $MCDEV_REPO $paperVer
|
@ -1,43 +0,0 @@
|
|||||||
#!/bin/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
|
|
||||||
tuinityVer=$(cat current-tuinity)
|
|
||||||
|
|
||||||
minecraftversion=$(cat $basedir/Tuinity/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
decompile="Tuinity/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
|
|
||||||
for i in $basedir/$decompile/net/minecraft/server/*.java;
|
|
||||||
do
|
|
||||||
cp "$i" src/net/minecraft/server
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
base="$basedir/Tuinity/Tuinity-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 "$tuinityVer" -m "$tuinityVer" 2>/dev/null
|
|
140
scripts/importSources.sh
Normal file
140
scripts/importSources.sh
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
maintask=$2
|
||||||
|
if [[ $maintask == "0" ]]; then
|
||||||
|
TASKTITLE="Import Sources"
|
||||||
|
else
|
||||||
|
TASKTITLE="Import Sources (Subtask)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SCRIPT HEADER start
|
||||||
|
basedir=$1
|
||||||
|
source "$basedir/scripts/functions.sh"
|
||||||
|
echo " "
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - $TASKTITLE"
|
||||||
|
echo " This will import unimported newly added/mod sources to Paper workspace"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# SCRIPT HEADER end
|
||||||
|
|
||||||
|
# For a description of this script, see updateUpstream.sh.
|
||||||
|
paperworkdir="$basedir/Tuinity/Paper/work"
|
||||||
|
paperserverdir="$basedir/Tuinity/Tuinity-Server"
|
||||||
|
papersrcdir="$paperserverdir/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
|
||||||
|
)
|
||||||
|
|
||||||
|
minecraftversion=$(cat "$basedir"/Tuinity/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
|
decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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 YAPFA"* ]]; then
|
||||||
|
git reset --hard HEAD^
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
# Filter and import every files which have patch to modify
|
||||||
|
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')
|
||||||
|
|
||||||
|
(
|
||||||
|
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
|
||||||
|
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
|
||||||
|
importToPaperWorkspace PistonExtendsChecker
|
||||||
|
importToPaperWorkspace EnumDirection
|
||||||
|
# Library import format (multiple files are supported):
|
||||||
|
# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
||||||
|
importLibraryToPaperWorkspace com.mojang authlib com/mojang/authlib yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
|
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 YAPFA\n\n$IMPORT_LOG" | git commit src -F - &> /dev/null
|
||||||
|
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
|
||||||
|
)
|
@ -1,122 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
(
|
|
||||||
set -e
|
|
||||||
nms="net/minecraft/server"
|
|
||||||
export MODLOG=""
|
|
||||||
PS1="$"
|
|
||||||
basedir="$(cd "$1" && pwd -P)"
|
|
||||||
source "$basedir/scripts/functions.sh"
|
|
||||||
gitcmd="git -c commit.gpgsign=false"
|
|
||||||
|
|
||||||
workdir="$basedir/work"
|
|
||||||
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
decompiledir="$workdir/Minecraft/$minecraftversion/forge"
|
|
||||||
# replace for now
|
|
||||||
decompiledir="$workdir/Minecraft/$minecraftversion/spigot"
|
|
||||||
export importedmcdev=""
|
|
||||||
function import {
|
|
||||||
export importedmcdev="$importedmcdev $1"
|
|
||||||
file="${1}.java"
|
|
||||||
target="$workdir/Spigot/Spigot-Server/src/main/java/$nms/$file"
|
|
||||||
base="$decompiledir/$nms/$file"
|
|
||||||
|
|
||||||
if [[ ! -f "$target" ]]; then
|
|
||||||
export MODLOG="$MODLOG Imported $file from mc-dev\n";
|
|
||||||
#echo "Copying $base to $target"
|
|
||||||
cp "$base" "$target" || exit 1
|
|
||||||
else
|
|
||||||
echo "UN-NEEDED IMPORT: $file"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function importLibrary {
|
|
||||||
group=$1
|
|
||||||
lib=$2
|
|
||||||
prefix=$3
|
|
||||||
shift 3
|
|
||||||
for file in "$@"; do
|
|
||||||
file="$prefix/$file"
|
|
||||||
target="$workdir/Spigot/Spigot-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 "$workdir/Spigot/Spigot-Server/"
|
|
||||||
lastlog=$($gitcmd log -1 --oneline)
|
|
||||||
if [[ "$lastlog" = *"mc-dev Imports"* ]]; then
|
|
||||||
$gitcmd reset --hard HEAD^
|
|
||||||
fi
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
files=$(cat "$basedir/Spigot-Server-Patches/"* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
||||||
|
|
||||||
nonnms=$(grep -R "new file mode" -B 1 "$basedir/Spigot-Server-Patches/" | grep -v "new file mode" | grep -oE "net\/minecraft\/server\/.*.java" | grep -oE "[A-Za-z]+?.java$" --color=none | sed 's/.java//g')
|
|
||||||
function containsElement {
|
|
||||||
local e
|
|
||||||
for e in "${@:2}"; do
|
|
||||||
[[ "$e" == "$1" ]] && return 0;
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
set +e
|
|
||||||
for f in $files; do
|
|
||||||
containsElement "$f" ${nonnms[@]}
|
|
||||||
if [ "$?" == "1" ]; then
|
|
||||||
if [ ! -f "$workdir/Spigot/Spigot-Server/src/main/java/net/minecraft/server/$f.java" ]; then
|
|
||||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
|
||||||
echo "$(color 1 31) ERROR!!! Missing NMS$(color 1 34) $f $(colorend)";
|
|
||||||
else
|
|
||||||
import $f
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
# NMS IMPORTS
|
|
||||||
# Temporarily add new NMS dev imports here before you run paper patch
|
|
||||||
# but after you have paper rb'd your changes, remove the line from this file before committing.
|
|
||||||
# we do not need any lines added to this file for NMS
|
|
||||||
|
|
||||||
import PistonExtendsChecker
|
|
||||||
import EnumDirection
|
|
||||||
#import EnumAxisCycle # doesn't compile without fixes, copied into patch
|
|
||||||
# import TileEntityPiston # doesn't compile without fixes, copied into patch
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
# LIBRARY IMPORTS
|
|
||||||
# These must always be mapped manually, no automatic stuff
|
|
||||||
#
|
|
||||||
# # group # lib # prefix # many files
|
|
||||||
|
|
||||||
# dont forget \ at end of each line but last
|
|
||||||
importLibrary com.mojang authlib com/mojang/authlib yggdrasil/YggdrasilGameProfileRepository.java
|
|
||||||
importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
########################################################
|
|
||||||
set -e
|
|
||||||
cd "$workdir/Spigot/Spigot-Server/"
|
|
||||||
rm -rf nms-patches applyPatches.sh makePatches.sh >/dev/null 2>&1
|
|
||||||
$gitcmd add . -A >/dev/null 2>&1
|
|
||||||
echo -e "mc-dev Imports\n\n$MODLOG" | $gitcmd commit . -F -
|
|
||||||
)
|
|
@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
sourceBase=$(dirname $SOURCE)/../
|
|
||||||
cd "${basedir:-$sourceBase}"
|
|
||||||
|
|
||||||
basedir=$(pwd -P)
|
|
||||||
cd -
|
|
||||||
|
|
||||||
FORK_NAME="YAPFA"
|
|
||||||
|
|
||||||
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 basedir {
|
|
||||||
cd "$basedir"
|
|
||||||
}
|
|
||||||
function gethead {
|
|
||||||
(
|
|
||||||
cd "$1"
|
|
||||||
git log -1 --oneline
|
|
||||||
)
|
|
||||||
}
|
|
31
scripts/installLauncher.sh
Normal file
31
scripts/installLauncher.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# SCRIPT HEADER start
|
||||||
|
basedir=$1
|
||||||
|
source "$basedir/scripts/functions.sh"
|
||||||
|
echo " "
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - Install Launcher"
|
||||||
|
echo " This will build a launcher that similar to Paperclip by the server jar."
|
||||||
|
echo " "
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# SCRIPT HEADER end
|
||||||
|
|
||||||
|
# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh
|
||||||
|
# License from Paper applies to this file
|
||||||
|
|
||||||
|
set -e
|
||||||
|
paperworkdir="$basedir/Tuinity/Paper/work"
|
||||||
|
mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
|
serverjar="$basedir/YAPFA-Server/target/yapfa-$mcver.jar"
|
||||||
|
vanillajar="$paperworkdir/Minecraft/$mcver/$mcver.jar"
|
||||||
|
|
||||||
|
(
|
||||||
|
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/target/YAPFA-${mcver}-paperclip.jar"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo " $(bashcolor 1 32)Success$(bashcolorend) - Saved launcher jar to target/YAPFA-${mcver}-launcher.jar"
|
@ -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/Tuinity/Paper/work"
|
|
||||||
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
paperjar="$basedir/YAPFA-Server/target/yapfa-$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/yapfa-paperclip.jar"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "Build success!"
|
|
||||||
echo "Copied final jar to $(cd "$basedir" && pwd -P)/yapfa-paperclip.jar"
|
|
||||||
) || exit 1
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/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/Tuinity/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
|
|
||||||
basedir
|
|
@ -1,51 +1,46 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# get base dir regardless of execution location
|
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
# SCRIPT HEADER start
|
||||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
basedir=$1
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
source "$basedir/scripts/functions.sh"
|
||||||
SOURCE="$(readlink "$SOURCE")"
|
echo " "
|
||||||
[[ ${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
|
echo "----------------------------------------"
|
||||||
done
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - Rebuild Patches"
|
||||||
. $(dirname ${SOURCE})/init.sh
|
echo " This will diff the sources of YAPFA and Paper to build patches."
|
||||||
|
echo " "
|
||||||
|
echo " $(bashcolor 1 32)Modules:$(bashcolorend)"
|
||||||
|
echo " - $(bashcolor 1 32)1$(bashcolorend) : API"
|
||||||
|
echo " - $(bashcolor 1 32)2$(bashcolorend) : Server"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# SCRIPT HEADER end
|
||||||
|
|
||||||
PS1="$"
|
|
||||||
echo "Rebuilding patch files from current fork state..."
|
|
||||||
function savePatches {
|
function savePatches {
|
||||||
what=$1
|
targetname=$1
|
||||||
cd ${basedir}/${what}/
|
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
|
||||||
|
|
||||||
mkdir -p ${basedir}/patches/$2
|
cd "$basedir/$targetname"
|
||||||
if [ -d ".git/rebase-apply" ]; then
|
$gitcmd format-patch --no-signature --zero-commit --full-index --no-stat -N -o "$basedir/patches/$2" upstream/upstream >/dev/null
|
||||||
# in middle of a rebase, be smarter
|
basedir
|
||||||
echo "REBASE DETECTED - PARTIAL SAVE"
|
$gitcmd add -A "$basedir/patches/$2"
|
||||||
last=$(cat ".git/rebase-apply/last")
|
echo " $(bashcolor 1 32)($3/$4)$(bashcolorend) - Patches saved for $targetname to patches/$2"
|
||||||
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 --quiet -N -o ${basedir}/patches/$2 upstream/upstream
|
|
||||||
cd ${basedir}
|
|
||||||
git add -A ${basedir}/patches/$2
|
|
||||||
cleanupPatches ${basedir}/patches/$2/
|
|
||||||
echo " Patches saved for $what to patches/$2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
savePatches ${FORK_NAME}-API api
|
savePatches ${FORK_NAME}-API api 1 2
|
||||||
if [ -f "$basedir/${FORK_NAME}-API/.git/patch-apply-failed" ]; then
|
savePatches ${FORK_NAME}-Server server 2 2
|
||||||
echo "$(bashColor 1 31)[[[ WARNING ]]] $(bashColor 1 33)- Not saving Tuinity-Server as it appears ${FORK_NAME}-API did not apply clean.$(bashColorReset)"
|
# gitpushproject
|
||||||
echo "$(bashColor 1 33)If this is a mistake, delete $(bashColor 1 34)${FORK_NAME}-API/.git/patch-apply-failed$(bashColor 1 33) and run rebuild again.$(bashColorReset)"
|
|
||||||
echo "$(bashColor 1 33)Otherwise, rerun ./tuinity patch to have a clean Tuinity-API apply so the latest Tuinity-Server can build.$(bashColorReset)"
|
|
||||||
else
|
|
||||||
savePatches ${FORK_NAME}-Server server
|
|
||||||
${basedir}/scripts/push.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
87
scripts/updateUpstream.sh
Normal file
87
scripts/updateUpstream.sh
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# SCRIPT HEADER start
|
||||||
|
basedir=$1
|
||||||
|
source "$basedir/scripts/functions.sh"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - Update Upstream"
|
||||||
|
echo " This will update and patch Paper, importing necessary sources for patching."
|
||||||
|
#echo " "
|
||||||
|
#echo " $(bashcolor 1 32)Subtask:$(bashcolorend)"
|
||||||
|
#echo " - Import Sources"
|
||||||
|
echo " "
|
||||||
|
echo " $(bashcolor 1 32)Projects:$(bashcolorend)"
|
||||||
|
echo " - $(bashcolor 1 32)1$(bashcolorend) : Paper"
|
||||||
|
echo " - $(bashcolor 1 32)2$(bashcolorend) : YAPFA"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# SCRIPT HEADER end
|
||||||
|
|
||||||
|
# This script are capable of patching paper which have the same effect with renewing the source codes of paper to its corresponding remote/official state, and also are able to reset the patches of paper to its head commit to override dirty changes which needs a argument with --resetPaper.
|
||||||
|
|
||||||
|
# After the patching, it will copying sources that do no exist in the YAPFA workspace but referenced in YAPFA patches into our workspace, depending on the content of our patches, this will be addressed by calling importSources.sh.
|
||||||
|
|
||||||
|
# Following by invoking generateImports.sh, it will generate new added/imported files of paper compared to the original decompiled sources into mc-dev folder under the root dir of the project, whose intention is unclear yet.
|
||||||
|
|
||||||
|
# exit immediately if a command exits with a non-zero status
|
||||||
|
set -e
|
||||||
|
|
||||||
|
subtasks=1
|
||||||
|
updatepaper=$2
|
||||||
|
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
|
||||||
|
|
||||||
|
# patch paper
|
||||||
|
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Apply patches of Tuinity.."
|
||||||
|
echo " "
|
||||||
|
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 'YAPFA patch' to test/fix patches, and by 'YAPFA 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
|
@ -1,60 +0,0 @@
|
|||||||
#!/bin/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
|
|
||||||
|
|
||||||
if [[ "$1" == up* ]]; then
|
|
||||||
(
|
|
||||||
cd "$basedir/Tuinity/"
|
|
||||||
git fetch && git reset --hard origin/ver/1.14
|
|
||||||
cd ../
|
|
||||||
git add Tuinity
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
tuinityVer=$(gethead Tuinity)
|
|
||||||
cd "$basedir/Tuinity/"
|
|
||||||
|
|
||||||
./tuinity patch
|
|
||||||
|
|
||||||
cd "Tuinity-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/Tuinity/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
version=$(echo -e "Tuinity: $tuinityVer\nmc-dev:$importedmcdev")
|
|
||||||
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')"
|
|
||||||
echo "$tag" > $basedir/current-tuinity
|
|
||||||
git add "$basedir/current-tuinity"
|
|
||||||
|
|
||||||
$basedir/scripts/generatesources.sh
|
|
||||||
|
|
||||||
cd Tuinity/
|
|
||||||
|
|
||||||
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-tuinity)" != "$tag" ]; then
|
|
||||||
forcetag=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
tag Tuinity-API $forcetag
|
|
||||||
tag Tuinity-Server $forcetag
|
|
||||||
|
|
@ -1,33 +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}...ORIGIN/ver/1.16
|
|
||||||
}
|
|
||||||
tuinity=$(changelog Tuinity)
|
|
||||||
#paper=$(changelog Tuinity/Paper)
|
|
||||||
|
|
||||||
updated=""
|
|
||||||
logsuffix=""
|
|
||||||
if [ ! -z "$tuinity" ]; then
|
|
||||||
logsuffix="$logsuffix\n\nTuinity Changes:\n$tuinity"
|
|
||||||
if [ -z "$updated" ]; then updated="Tuinity"; else updated="$updated/Tuinity"; fi
|
|
||||||
fi
|
|
||||||
#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"
|
|
||||||
|
|
||||||
) || exit 1
|
|
296
yapfa
296
yapfa
@ -1,132 +1,194 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# get base dir regardless of execution location
|
# YAPFA Build Script
|
||||||
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
|
|
||||||
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
|
|
||||||
basedir=$(dirname "$SOURCE")
|
|
||||||
. "$basedir"/scripts/init.sh
|
|
||||||
|
|
||||||
paperstash() {
|
############################################################################
|
||||||
STASHED=$(git stash)
|
# Multicore building #
|
||||||
}
|
# By JosephWorks #
|
||||||
|
# -------------------------------------------------------------------------#
|
||||||
|
# To use multicore building, use "$mvncmd" instead of "maven" #
|
||||||
|
# 20-50% speed improvement is quite common. #
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# Exit immediately if a command exits with a non-zero status
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source "./scripts/functions.sh"
|
||||||
|
|
||||||
|
JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
|
||||||
|
|
||||||
paperunstash() {
|
|
||||||
if [[ "$STASHED" != "No local changes to save" ]] ; then
|
|
||||||
git stash pop
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
failed=0
|
failed=0
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"rb" | "rbp" | "rebuild")
|
"r" | "rb" | "rbp" | "rebuild")
|
||||||
(
|
|
||||||
set -e
|
|
||||||
cd "$basedir"
|
|
||||||
scripts/rebuildpatches.sh "$basedir" || exit 1
|
|
||||||
) || failed=1
|
|
||||||
;;
|
|
||||||
"p" | "patch" | "apply")
|
|
||||||
(
|
|
||||||
set -e
|
|
||||||
cd "$basedir"
|
|
||||||
scripts/apply.sh "$basedir" || exit 1
|
|
||||||
) || failed=1
|
|
||||||
;;
|
|
||||||
"b" | "bu" | "build")
|
|
||||||
(
|
|
||||||
basedir
|
|
||||||
mvn -N install
|
|
||||||
cd ${FORK_NAME}-API
|
|
||||||
mvn clean install && cd ../${FORK_NAME}-Server && mvn clean install
|
|
||||||
) || failed=1
|
|
||||||
;;
|
|
||||||
"jar" | "paperclip")
|
|
||||||
(
|
(
|
||||||
basedir
|
set -e
|
||||||
cd "$basedir"
|
basedir
|
||||||
./scripts/paperclip.sh
|
$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 surefire-report:report
|
||||||
|
) || failed=1
|
||||||
|
;;
|
||||||
|
"j" | "launcher" | "jar" | "paperclip")
|
||||||
|
(
|
||||||
|
basedir
|
||||||
|
$scriptdir/installLauncher.sh "$basedir"
|
||||||
|
) || failed=1
|
||||||
|
;;
|
||||||
|
"u" | "up" | "upstream" | "update")
|
||||||
|
(
|
||||||
|
basedir
|
||||||
|
$scriptdir/updateUpstream.sh "$basedir" 1
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
"d" | "de" | "deploy")
|
"r" | "root")
|
||||||
(
|
basedir
|
||||||
basedir
|
;;
|
||||||
mvn -N install
|
"a" | "api")
|
||||||
cd ${FORK_NAME}-API
|
cd "$basedir/YAPFA-API"
|
||||||
mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install
|
;;
|
||||||
|
"s" | "server")
|
||||||
|
cd "$basedir/YAPFA-Server"
|
||||||
|
;;
|
||||||
|
"fup" | "fetchupstream")
|
||||||
|
$scriptdir/fetchUpstream.sh "$basedir" || exit 1
|
||||||
|
;;
|
||||||
|
"c" | "clean")
|
||||||
|
rm -rf YAPFA-API
|
||||||
|
rm -rf YAPFA-Server
|
||||||
|
rm -rf Paper
|
||||||
|
echo "Cleaned build files"
|
||||||
|
;;
|
||||||
|
"f" | "fu" | "full" | "fullbuild")
|
||||||
|
(
|
||||||
|
echo "$JAVA_VERSION"
|
||||||
|
basedir
|
||||||
|
$scriptdir/updateUpstream.sh "$basedir" || 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
|
||||||
|
$scriptdir/installLauncher.sh "$basedir" || exit 1
|
||||||
) || failed=1
|
) || failed=1
|
||||||
;;
|
;;
|
||||||
"up" | "upstream")
|
"e" | "edit")
|
||||||
(
|
case "$2" in
|
||||||
cd "$basedir"
|
"s" | "server")
|
||||||
scripts/upstream.sh "$2" || exit 1
|
export YAPFA_LAST_EDIT="$basedir/YAPFA-Server"
|
||||||
if [ "$2" == "up" ]; then
|
cd "$basedir/YAPFA-Server"
|
||||||
(scripts/apply.sh "$basedir" && scripts/rebuildpatches.sh "$basedir" && scripts/commitup.sh) || exit 1
|
(
|
||||||
fi
|
set -e
|
||||||
) || failed=1
|
gitstash
|
||||||
;;
|
cd "$basedir/Paper/Paper-Server"
|
||||||
"cup" | "commitup" | "upc" | "upcommit")
|
$gitcmd fetch --all
|
||||||
(
|
# Create the upstream branch in Paper project with current state
|
||||||
cd "$basedir"
|
$gitcmd checkout master # possibly already in
|
||||||
scripts/commitup.sh || exit 1
|
$gitcmd branch -D upstream || true
|
||||||
) || failed=1
|
$gitcmd branch -f upstream HEAD
|
||||||
;;
|
cd "$basedir/YAPFA-Server"
|
||||||
"r" | "root")
|
$gitcmd rebase -i upstream/upstream
|
||||||
cd "$basedir"
|
gitunstash
|
||||||
;;
|
)
|
||||||
"a" | "api")
|
;;
|
||||||
cd "$basedir/YAPFA-API"
|
"a" | "api")
|
||||||
;;
|
export YAPFA_LAST_EDIT="$basedir/YAPFA-API"
|
||||||
"s" | "server")
|
cd "$basedir/YAPFA-API"
|
||||||
cd "$basedir/YAPFA-Server"
|
(
|
||||||
;;
|
set -e
|
||||||
"setup")
|
gitstash
|
||||||
if [[ -f ~/.bashrc ]] ; then
|
cd "$basedir/Paper/Paper-API"
|
||||||
NAME="ec"
|
$gitcmd fetch --all
|
||||||
if [[ ! -z "${2+x}" ]] ; then
|
# Create the upstream branch in Paper project with current state
|
||||||
NAME="$2"
|
$gitcmd checkout master # possibly already in
|
||||||
fi
|
$gitcmd branch -D upstream || true
|
||||||
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
|
$gitcmd branch -f upstream HEAD
|
||||||
alias "$NAME=. $SOURCE"
|
cd "$basedir/YAPFA-API"
|
||||||
echo "You can now just type '$NAME' at any time to access the paper tool."
|
$gitcmd rebase -i upstream/upstream
|
||||||
fi
|
gitunstash
|
||||||
;;
|
)
|
||||||
*)
|
;;
|
||||||
echo "YAPFA build tool command. This provides a variety of commands to build and manage the PaperMC build"
|
"c" | "continue")
|
||||||
echo "environment. For all of the functionality of this command to be available, you must first run the"
|
cd "$YAPFA_LAST_EDIT"
|
||||||
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
|
unset YAPFA_LAST_EDIT
|
||||||
echo ""
|
(
|
||||||
echo " Normal commands:"
|
set -e
|
||||||
echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
|
$gitcmd add .
|
||||||
echo " * p, patch | Apply all patches to top of Paper without building it. Can be run from anywhere."
|
$gitcmd commit --amend
|
||||||
echo " * up, upstream | Build Paper upstream, pass arg up to update paper. Can be run from anywhere."
|
$gitcmd rebase --continue
|
||||||
echo " * b, build | Build API and Server but no deploy. Can be ran anywhere."
|
basedir
|
||||||
echo " * d, deploy | Build and Deploy API jar and build Server. Can be ran anywhere."
|
$scriptdir/rebuildPatches.sh "$basedir"
|
||||||
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 Paper-API directory."
|
echo "You must edit either the api or server."
|
||||||
echo " * s, server | Move to the Paper-Server directory."
|
;;
|
||||||
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
|
esac
|
||||||
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."
|
"setup")
|
||||||
echo ""
|
if [[ -f ~/.bashrc ]] ; then
|
||||||
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
|
NAME="YAPFA"
|
||||||
echo " | . ./paper setup"
|
if [[ ! -z "${2+x}" ]] ; then
|
||||||
echo " | After you run this command you'll be able to just run 'paper' from anywhere."
|
NAME="$2"
|
||||||
echo " | The default name for the resulting alias is 'paper', you can give an argument to override"
|
fi
|
||||||
echo " | this default, such as:"
|
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
|
||||||
echo " | . ./paper setup example"
|
alias "$NAME=. $SOURCE"
|
||||||
echo " | Which will allow you to run 'example' instead."
|
echo "You can now just type '$NAME' at any time to access the YAPFA tool."
|
||||||
;;
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "YAPFA build tool command. This provides a variety of commands to build and manage the YAPFA 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 | Update and patch the Paper submodule. 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 ""
|
||||||
|
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 YAPFA-API directory."
|
||||||
|
echo " * s, server | Move to the YAPFA-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 " | . ./YAPFA setup"
|
||||||
|
echo " | After you run this command you'll be able to just run 'YAPFA' from anywhere."
|
||||||
|
echo " | The default name for the resulting alias is 'YAPFA', you can give an argument to override"
|
||||||
|
echo " | this default, such as:"
|
||||||
|
echo " | . ./YAPFA setup example"
|
||||||
|
echo " | Which will allow you to run 'example' instead."
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
unset -f paperstash
|
unset RCPATH
|
||||||
unset -f paperunstash
|
unset SOURCE
|
||||||
if [ "$failed" == "1" ]; then
|
unset basedir
|
||||||
|
unset -f color
|
||||||
|
unset -f colorend
|
||||||
|
unset -f gitstash
|
||||||
|
unset -f gitunstash
|
||||||
|
if [[ "$failed" == "1" ]]; then
|
||||||
unset failed
|
unset failed
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user