Fixes shell typo

This commit is contained in:
Sotr
2020-04-13 04:59:43 +07:00
parent 7aa8eb6363
commit 6b125ec995
6 changed files with 57 additions and 457 deletions

61
akarin
View File

@@ -3,32 +3,36 @@
# exit immediately if a command exits with a non-zero status
set -e
basedir=$(cd "$(dirname "$0")" && pwd -P)
source "./scripts/functions.sh"
function updateAndPatch {
basedir
if [ "$1" != "skipPaper" ]; then
$scriptdir/updateUpstream.sh "$basedir" || exit 1
fi
$scriptdir/applyPatches.sh "$basedir" || exit 1
}
failed=0
case "$1" in
"rb" | "rbp" | "rebuild")
"r" | "rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir" || exit 1
basedir
$scriptdir/rebuildPatches.sh "$basedir" || exit 1
) || failed=1
;;
"p" | "patch" | "apply")
"a" | "p" | "patch" | "apply")
(
set -e
cd "$basedir"
if [ "$2" != "fast" ]; then
scripts/upstream.sh "$basedir" || exit 1
fi
scripts/apply.sh "$basedir" || exit 1
updateAndPatch $2
) || failed=1
;;
"b" | "bu" | "build")
(
set -e
cd "$basedir"
updateAndPatch $2
basedir
mvn -N install || exit 1
cd ${FORK_NAME}-API
mvn -e clean install && cd ../${FORK_NAME}-Server && mvn -e clean install || exit 1
@@ -36,35 +40,30 @@ case "$1" in
;;
"jar" | "paperclip")
(
cd "$basedir"
if [ "$2" != "fast" ]; then
scripts/upstream.sh "$basedir"
fi
./scripts/apply.sh "$basedir"
cd "$basedir"
basedir
mvn -N install
cd ${FORK_NAME}-API
mvn -e clean install && cd ../${FORK_NAME}-Server && mvn -e clean install
cd "$basedir"
./scripts/paperclip.sh
basedir
$scriptdir/paperclip.sh
)
;;
"d" | "de" | "deploy")
(
cd "$basedir"
basedir
mvn -N install
cd ${FORK_NAME}-API
mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install
)
;;
"up" | "upstream" | "update")
"u" | "up" | "upstream" | "update")
(
cd "$basedir"
scripts/upstream.sh "$basedir" $2
basedir
$scriptdir/updateUpstream.sh "$basedir" $2
)
;;
"r" | "root")
cd "$basedir"
basedir
;;
"a" | "api")
cd "$basedir/Akarin-API"
@@ -75,7 +74,7 @@ case "$1" in
"c" | "clean")
rm -rf Akarin-API
rm -rf Akarin-Server
rm -rf work
rm -rf Paper
echo "Cleaned build files"
;;
"e" | "edit")
@@ -85,7 +84,6 @@ case "$1" in
cd "$basedir/Akarin-Server"
(
set -e
gitstash
$gitcmd rebase -i upstream/upstream
gitunstash
@@ -96,7 +94,6 @@ case "$1" in
cd "$basedir/Akarin-API"
(
set -e
gitstash
$gitcmd rebase -i upstream/upstream
gitunstash
@@ -107,13 +104,11 @@ case "$1" in
unset AKARIN_LAST_EDIT
(
set -e
$gitcmd add .
$gitcmd commit --amend
$gitcmd rebase --continue
cd "$basedir"
scripts/rebuildPatches.sh "$basedir"
basedir
$scriptdir/rebuildPatches.sh "$basedir"
)
;;
*)
@@ -138,9 +133,9 @@ case "$1" in
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 " * rb, rebuild | Rebuild patches, can be called from anywhere."
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 " * up, upstream | Build Paper upstream, pass arg up to update paper. Can be run from anywhere."
echo " * u, upstream | Build Paper upstream, pass arg up to update paper. Can be run from anywhere."
echo " * b, build | Build the API and the server project without deploying. Can be ran anywhere."
echo " * d, deploy | Build and deploy jars of the API and the server project. Can be ran anywhere."
echo ""

View File

@@ -689,398 +689,6 @@ index 90319909e..c09c5440b 100644
}
public Stream<PathfinderGoalWrapped> c() {
diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder b/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder
new file mode 100644
index 000000000..1790878ae
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder
@@ -0,0 +1,271 @@
+package net.minecraft.server;
+
+import javax.annotation.Nullable;
+
+public class PathfinderTurtle extends PathfinderNormal {
+
+ private float k;
+ private float l;
+
+ public PathfinderTurtle() {}
+
+ @Override
+ public void a(ChunkCache chunkcache, EntityInsentient entityinsentient) {
+ super.a(chunkcache, entityinsentient);
+ entityinsentient.a(PathType.WATER, 0.0F);
+ this.k = entityinsentient.a(PathType.WALKABLE);
+ entityinsentient.a(PathType.WALKABLE, 6.0F);
+ this.l = entityinsentient.a(PathType.WATER_BORDER);
+ entityinsentient.a(PathType.WATER_BORDER, 4.0F);
+ }
+
+ @Override
+ public void a() {
+ this.b.a(PathType.WALKABLE, this.k);
+ this.b.a(PathType.WATER_BORDER, this.l);
+ super.a();
+ }
+
+ @Override
+ public PathPoint b() {
+ return this.a(MathHelper.floor(this.b.getBoundingBox().minX), MathHelper.floor(this.b.getBoundingBox().minY + 0.5D), MathHelper.floor(this.b.getBoundingBox().minZ));
+ }
+
+ @Override
+ public PathDestination a(double d0, double d1, double d2) {
+ return new PathDestination(this.a(MathHelper.floor(d0), MathHelper.floor(d1 + 0.5D), MathHelper.floor(d2)));
+ }
+
+ @Override
+ public int a(PathPoint[] apathpoint, PathPoint pathpoint) {
+ int i = 0;
+ boolean flag = true;
+ BlockPosition blockposition = new BlockPosition(pathpoint.a, pathpoint.b, pathpoint.c);
+ double d0 = this.a(blockposition);
+ PathPoint pathpoint1 = this.a(pathpoint.a, pathpoint.b, pathpoint.c + 1, 1, d0);
+ PathPoint pathpoint2 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c, 1, d0);
+ PathPoint pathpoint3 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c, 1, d0);
+ PathPoint pathpoint4 = this.a(pathpoint.a, pathpoint.b, pathpoint.c - 1, 1, d0);
+ PathPoint pathpoint5 = this.a(pathpoint.a, pathpoint.b + 1, pathpoint.c, 0, d0);
+ PathPoint pathpoint6 = this.a(pathpoint.a, pathpoint.b - 1, pathpoint.c, 1, d0);
+
+ if (pathpoint1 != null && !pathpoint1.i) {
+ apathpoint[i++] = pathpoint1;
+ }
+
+ if (pathpoint2 != null && !pathpoint2.i) {
+ apathpoint[i++] = pathpoint2;
+ }
+
+ if (pathpoint3 != null && !pathpoint3.i) {
+ apathpoint[i++] = pathpoint3;
+ }
+
+ if (pathpoint4 != null && !pathpoint4.i) {
+ apathpoint[i++] = pathpoint4;
+ }
+
+ if (pathpoint5 != null && !pathpoint5.i) {
+ apathpoint[i++] = pathpoint5;
+ }
+
+ if (pathpoint6 != null && !pathpoint6.i) {
+ apathpoint[i++] = pathpoint6;
+ }
+
+ boolean flag1 = pathpoint4 == null || pathpoint4.l == PathType.OPEN || pathpoint4.k != 0.0F;
+ boolean flag2 = pathpoint1 == null || pathpoint1.l == PathType.OPEN || pathpoint1.k != 0.0F;
+ boolean flag3 = pathpoint3 == null || pathpoint3.l == PathType.OPEN || pathpoint3.k != 0.0F;
+ boolean flag4 = pathpoint2 == null || pathpoint2.l == PathType.OPEN || pathpoint2.k != 0.0F;
+ PathPoint pathpoint7;
+
+ if (flag1 && flag4) {
+ pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c - 1, 1, d0);
+ if (pathpoint7 != null && !pathpoint7.i) {
+ apathpoint[i++] = pathpoint7;
+ }
+ }
+
+ if (flag1 && flag3) {
+ pathpoint7 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c - 1, 1, d0);
+ if (pathpoint7 != null && !pathpoint7.i) {
+ apathpoint[i++] = pathpoint7;
+ }
+ }
+
+ if (flag2 && flag4) {
+ pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c + 1, 1, d0);
+ if (pathpoint7 != null && !pathpoint7.i) {
+ apathpoint[i++] = pathpoint7;
+ }
+ }
+
+ if (flag2 && flag3) {
+ pathpoint7 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c + 1, 1, d0);
+ if (pathpoint7 != null && !pathpoint7.i) {
+ apathpoint[i++] = pathpoint7;
+ }
+ }
+
+ return i;
+ }
+
+ private double a(BlockPosition blockposition) {
+ if (!this.b.isInWater()) {
+ BlockPosition blockposition1 = blockposition.down();
+ VoxelShape voxelshape = this.a.getType(blockposition1).getCollisionShape(this.a, blockposition1);
+
+ return (double) blockposition1.getY() + (voxelshape.isEmpty() ? 0.0D : voxelshape.c(EnumDirection.EnumAxis.Y));
+ } else {
+ return (double) blockposition.getY() + 0.5D;
+ }
+ }
+
+ @Nullable
+ private PathPoint a(int i, int j, int k, int l, double d0) {
+ PathPoint pathpoint = null;
+ BlockPosition blockposition = new BlockPosition(i, j, k);
+ double d1 = this.a(blockposition);
+
+ if (d1 - d0 > 1.125D) {
+ return null;
+ } else {
+ PathType pathtype = this.a(this.a, i, j, k, this.b, this.d, this.e, this.f, false, false);
+ float f = this.b.a(pathtype);
+ double d2 = (double) this.b.getWidth() / 2.0D;
+
+ if (f >= 0.0F) {
+ pathpoint = this.a(i, j, k);
+ pathpoint.l = pathtype;
+ pathpoint.k = Math.max(pathpoint.k, f);
+ }
+
+ if (pathtype != PathType.WATER && pathtype != PathType.WALKABLE) {
+ if (pathpoint == null && l > 0 && pathtype != PathType.FENCE && pathtype != PathType.TRAPDOOR) {
+ pathpoint = this.a(i, j + 1, k, l - 1, d0);
+ }
+
+ if (pathtype == PathType.OPEN) {
+ AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) i - d2 + 0.5D, (double) j + 0.001D, (double) k - d2 + 0.5D, (double) i + d2 + 0.5D, (double) ((float) j + this.b.getHeight()), (double) k + d2 + 0.5D);
+
+ if (!this.a.getCubes(this.b, axisalignedbb)) { // Akarin - use chunk cache
+ return null;
+ }
+
+ PathType pathtype1 = this.a(this.a, i, j - 1, k, this.b, this.d, this.e, this.f, false, false);
+
+ if (pathtype1 == PathType.BLOCKED) {
+ pathpoint = this.a(i, j, k);
+ pathpoint.l = PathType.WALKABLE;
+ pathpoint.k = Math.max(pathpoint.k, f);
+ return pathpoint;
+ }
+
+ if (pathtype1 == PathType.WATER) {
+ pathpoint = this.a(i, j, k);
+ pathpoint.l = PathType.WATER;
+ pathpoint.k = Math.max(pathpoint.k, f);
+ return pathpoint;
+ }
+
+ int i1 = 0;
+
+ while (j > 0 && pathtype == PathType.OPEN) {
+ --j;
+ if (i1++ >= this.b.bD()) {
+ return null;
+ }
+
+ pathtype = this.a(this.a, i, j, k, this.b, this.d, this.e, this.f, false, false);
+ f = this.b.a(pathtype);
+ if (pathtype != PathType.OPEN && f >= 0.0F) {
+ pathpoint = this.a(i, j, k);
+ pathpoint.l = pathtype;
+ pathpoint.k = Math.max(pathpoint.k, f);
+ break;
+ }
+
+ if (f < 0.0F) {
+ return null;
+ }
+ }
+ }
+
+ return pathpoint;
+ } else {
+ if (j < this.b.world.getSeaLevel() - 10 && pathpoint != null) {
+ ++pathpoint.k;
+ }
+
+ return pathpoint;
+ }
+ }
+ }
+
+ @Override
+ protected PathType a(IBlockAccess iblockaccess, boolean flag, boolean flag1, BlockPosition blockposition, PathType pathtype) {
+ if (pathtype == PathType.RAIL && !(iblockaccess.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(iblockaccess.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) {
+ pathtype = PathType.FENCE;
+ }
+
+ if (pathtype == PathType.DOOR_OPEN || pathtype == PathType.DOOR_WOOD_CLOSED || pathtype == PathType.DOOR_IRON_CLOSED) {
+ pathtype = PathType.BLOCKED;
+ }
+
+ if (pathtype == PathType.LEAVES) {
+ pathtype = PathType.BLOCKED;
+ }
+
+ return pathtype;
+ }
+
+ @Override
+ public PathType a(IBlockAccess iblockaccess, int i, int j, int k) {
+ PathType pathtype = c(iblockaccess, i, j, k);
+
+ if (pathtype == PathType.WATER) {
+ EnumDirection[] aenumdirection = EnumDirection.values();
+ int l = aenumdirection.length;
+
+ for (int i1 = 0; i1 < l; ++i1) {
+ EnumDirection enumdirection = aenumdirection[i1];
+ PathType pathtype1 = c(iblockaccess, i + enumdirection.getAdjacentX(), j + enumdirection.getAdjacentY(), k + enumdirection.getAdjacentZ());
+
+ if (pathtype1 == PathType.BLOCKED) {
+ return PathType.WATER_BORDER;
+ }
+ }
+
+ return PathType.WATER;
+ } else {
+ if (pathtype == PathType.OPEN && j >= 1) {
+ Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock();
+ PathType pathtype2 = c(iblockaccess, i, j - 1, k);
+
+ if (pathtype2 != PathType.WALKABLE && pathtype2 != PathType.OPEN && pathtype2 != PathType.LAVA) {
+ pathtype = PathType.WALKABLE;
+ } else {
+ pathtype = PathType.OPEN;
+ }
+
+ if (pathtype2 == PathType.DAMAGE_FIRE || block == Blocks.MAGMA_BLOCK || block == Blocks.CAMPFIRE) {
+ pathtype = PathType.DAMAGE_FIRE;
+ }
+
+ if (pathtype2 == PathType.DAMAGE_CACTUS) {
+ pathtype = PathType.DAMAGE_CACTUS;
+ }
+
+ if (pathtype2 == PathType.DAMAGE_OTHER) {
+ pathtype = PathType.DAMAGE_OTHER;
+ }
+ }
+
+ if (pathtype == PathType.WALKABLE) {
+ pathtype = a(iblockaccess, i, j, k, pathtype);
+ }
+
+ return pathtype;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder b/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder
new file mode 100644
index 000000000..a3473ddcf
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder
@@ -0,0 +1,109 @@
+package net.minecraft.server;
+
+import javax.annotation.Nullable;
+
+public class PathfinderWater extends PathfinderAbstract {
+
+ private final boolean j;
+
+ public PathfinderWater(boolean flag) {
+ this.j = flag;
+ }
+
+ @Override
+ public PathPoint b() {
+ return super.a(MathHelper.floor(this.b.getBoundingBox().minX), MathHelper.floor(this.b.getBoundingBox().minY + 0.5D), MathHelper.floor(this.b.getBoundingBox().minZ));
+ }
+
+ @Override
+ public PathDestination a(double d0, double d1, double d2) {
+ return new PathDestination(super.a(MathHelper.floor(d0 - (double) (this.b.getWidth() / 2.0F)), MathHelper.floor(d1 + 0.5D), MathHelper.floor(d2 - (double) (this.b.getWidth() / 2.0F))));
+ }
+
+ @Override
+ public int a(PathPoint[] apathpoint, PathPoint pathpoint) {
+ int i = 0;
+ EnumDirection[] aenumdirection = EnumDirection.values();
+ int j = aenumdirection.length;
+
+ for (int k = 0; k < j; ++k) {
+ EnumDirection enumdirection = aenumdirection[k];
+ PathPoint pathpoint1 = this.b(pathpoint.a + enumdirection.getAdjacentX(), pathpoint.b + enumdirection.getAdjacentY(), pathpoint.c + enumdirection.getAdjacentZ());
+
+ if (pathpoint1 != null && !pathpoint1.i) {
+ apathpoint[i++] = pathpoint1;
+ }
+ }
+
+ return i;
+ }
+
+ @Override
+ public PathType a(IBlockAccess iblockaccess, int i, int j, int k, EntityInsentient entityinsentient, int l, int i1, int j1, boolean flag, boolean flag1) {
+ return this.a(iblockaccess, i, j, k);
+ }
+
+ @Override
+ public PathType a(IBlockAccess iblockaccess, int i, int j, int k) {
+ BlockPosition blockposition = new BlockPosition(i, j, k);
+ Fluid fluid = iblockaccess.getFluid(blockposition);
+ IBlockData iblockdata = iblockaccess.getType(blockposition);
+
+ return fluid.isEmpty() && iblockdata.a(iblockaccess, blockposition.down(), PathMode.WATER) && iblockdata.isAir() ? PathType.BREACH : (fluid.a(TagsFluid.WATER) && iblockdata.a(iblockaccess, blockposition, PathMode.WATER) ? PathType.WATER : PathType.BLOCKED);
+ }
+
+ @Nullable
+ private PathPoint b(int i, int j, int k) {
+ PathType pathtype = this.c(i, j, k);
+
+ return (!this.j || pathtype != PathType.BREACH) && pathtype != PathType.WATER ? null : this.a(i, j, k);
+ }
+
+ @Nullable
+ @Override
+ protected PathPoint a(int i, int j, int k) {
+ PathPoint pathpoint = null;
+ PathType pathtype = this.a(this.a, i, j, k); // Akarin - use chunk cache
+ float f = this.b.a(pathtype);
+
+ if (f >= 0.0F) {
+ pathpoint = super.a(i, j, k);
+ pathpoint.l = pathtype;
+ pathpoint.k = Math.max(pathpoint.k, f);
+ if (this.a.getFluid(new BlockPosition(i, j, k)).isEmpty()) {
+ pathpoint.k += 8.0F;
+ }
+ }
+
+ return pathtype == PathType.OPEN ? pathpoint : pathpoint;
+ }
+
+ private PathType c(int i, int j, int k) {
+ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
+
+ for (int l = i; l < i + this.d; ++l) {
+ for (int i1 = j; i1 < j + this.e; ++i1) {
+ for (int j1 = k; j1 < k + this.f; ++j1) {
+ Fluid fluid = this.a.getFluid(blockposition_mutableblockposition.d(l, i1, j1));
+ IBlockData iblockdata = this.a.getType(blockposition_mutableblockposition.d(l, i1, j1));
+
+ if (fluid.isEmpty() && iblockdata.a((IBlockAccess) this.a, blockposition_mutableblockposition.down(), PathMode.WATER) && iblockdata.isAir()) {
+ return PathType.BREACH;
+ }
+
+ if (!fluid.a(TagsFluid.WATER)) {
+ return PathType.BLOCKED;
+ }
+ }
+ }
+ }
+
+ IBlockData iblockdata1 = this.a.getType(blockposition_mutableblockposition);
+
+ if (iblockdata1.a((IBlockAccess) this.a, blockposition_mutableblockposition, PathMode.WATER)) {
+ return PathType.WATER;
+ } else {
+ return PathType.BLOCKED;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7929fcc80..e1225d501 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# SCRIPT HEADER start
basedir=$1
source "$basedir/scripts/functions.sh"
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - Apply Patches"
echo " This will apply all of Akarin patches on top of the Paper."
@@ -14,11 +16,7 @@ echo " - $(bashcolor 1 32)2$(bashcolorend) : Server"
echo "----------------------------------------"
# SCRIPT HEADER end
# get base dir regardless of execution location
basedir=$1
source "$basedir/scripts/functions.sh"
needimport=$2
gpgsign="$(git config commit.gpgsign || echo "false")"
function applyPatch {
@@ -43,7 +41,7 @@ function applyPatch {
$gitcmd branch -D upstream >/dev/null &> /dev/null
$gitcmd branch -f upstream "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null
if [ $baseproject != "Paper/Paper-API" ]; then
if [ $needimport && [ $baseproject != "Paper/Paper-API" ] ]; then
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
basedir && $scriptdir/importSources.sh $basedir 1
fi
@@ -100,8 +98,6 @@ function enableCommitSigningIfNeeded {
fi
}
# echo "Importing MC-DEV"
# ./scripts/importSources.sh "$basedir" || exit 1
(
(applyPatch Paper/Paper-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
applyPatch Paper/Paper-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2) || exit 1

View File

@@ -4,22 +4,17 @@ maintask=$2
tasktitle=maintask && "Import Sources" || "Import Sources (Subtask)"
# SCRIPT HEADER start
basedir=$1
source "$basedir/scripts/functions.sh"
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - "
echo " This will import unimported sources newly added/mod by Akarin to Paper workspace"
echo " $(bashcolor 1 32)Task$(bashcolorend) - $tasktitle"
echo " This will import unimported newly added/mod sources to Paper workspace"
echo " "
echo "----------------------------------------"
# SCRIPT HEADER end
# 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/Paper/work"
paperserverdir="$basedir/Paper/Paper-Server"
papersrcdir="$paperserverdir/src/main/java"
papernmsdir="$papersrcdir/net/minecraft/server"
@@ -30,7 +25,7 @@ papernmsdir="$papersrcdir/net/minecraft/server"
echo "$(bashcolor 1 31) Exception $(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup."
exit 1
fi
}
)
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot

View File

@@ -1,15 +1,22 @@
#!/usr/bin/env bash
echo "[Akarin] State: Rebuild Patches"
# get base dir regardless of execution location
# SCRIPT HEADER start
basedir=$1
source "$basedir/scripts/functions.sh"
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - Rebuild Patches"
echo " This will diff the sources of Akarin 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
gitcmd="git -c commit.gpgsign=false -c core.safecrlf=false"
echo "Rebuild patch files from local sources.."
function savePatches {
targetname=$1
basedir
mkdir -p $basedir/patches/$2
if [ -d ".git/rebase-apply" ]; then
@@ -28,13 +35,13 @@ function savePatches {
rm -rf $basedir/patches/$2/*.patch
fi
cd "$basedir/$1"
cd "$basedir/$targetname"
$gitcmd format-patch --no-stat -N -o "$basedir/patches/$2" upstream/upstream >/dev/null
basedir
$gitcmd add -A "$basedir/patches/$2"
echo " Patches saved for $basedir to patches/$2"
echo " $(bashcolor 1 32)($3/$4)$(bashcolorend) - Patches saved for $targetname to patches/$2"
}
savePatches ${FORK_NAME}-API api
savePatches ${FORK_NAME}-Server server
savePatches ${FORK_NAME}-API api 1 2
savePatches ${FORK_NAME}-Server server 2 2
# gitpushproject

View File

@@ -1,9 +1,11 @@
#!/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, then importing necessary sources for patching."
echo " This will update and patch Paper, importing necessary sources for patching."
echo " "
echo " $(bashcolor 1 32)Subtask:$(bashcolorend)"
echo " - Import Sources"
@@ -23,10 +25,6 @@ echo "----------------------------------------"
# exit immediately if a command exits with a non-zero status
set -e
# get base dir regardless of execution location
basedir=$1
source "$basedir/scripts/functions.sh"
subtasks=2
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.."
@@ -42,6 +40,7 @@ fi
# patch paper
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Apply patches of Paper.."
echo " "
paperVer=$(gethead Paper)
paperdir
./paper patch