mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-05 12:40:01 +08:00
Rebrand Purpur
This commit is contained in:
commit
8bcfb52714
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Intellij
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
out/
|
||||
|
||||
# Eclipse
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
|
||||
# netbeans
|
||||
nbproject/
|
||||
nbactions.xml
|
||||
|
||||
# we use maven!
|
||||
build.xml
|
||||
|
||||
# Maven
|
||||
log/
|
||||
target/
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# various other potential build files
|
||||
build/
|
||||
bin/
|
||||
dist/
|
||||
manifest.mf
|
||||
|
||||
# Mac
|
||||
.DS_Store/
|
||||
.DS_Store
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
||||
# Linux temp files
|
||||
*~
|
||||
|
||||
# other stuff
|
||||
run/
|
||||
|
||||
Purpur-Server
|
||||
Purpur-API
|
||||
mc-dev
|
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
[submodule "Paper"]
|
||||
path = Paper
|
||||
url = https://github.com/PaperMC/Paper.git
|
||||
branch = master
|
1
Paper
Submodule
1
Paper
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit fb25dc17c62acce335346d5e96899257ae7230c7
|
1
current-paper
Normal file
1
current-paper
Normal file
@ -0,0 +1 @@
|
||||
1.13.2--68781abc035f77c64c2ef6961375df70ae357e83
|
79
patches/api/0001-Rebrand-Purpur.patch
Normal file
79
patches/api/0001-Rebrand-Purpur.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From 975b3da44f75bddc4b25e99fc92fadd3041693ff Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 30 Apr 2019 13:50:41 -0600
|
||||
Subject: [PATCH] Rebrand Purpur
|
||||
|
||||
---
|
||||
pom.xml | 10 ++++-----
|
||||
.../command/defaults/VersionCommand.java | 21 +++++++++++--------
|
||||
2 files changed, 17 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 3347be41..c6b3aaec 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -4,17 +4,17 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
- <groupId>com.destroystokyo.paper</groupId>
|
||||
- <artifactId>paper-parent</artifactId>
|
||||
+ <groupId>net.pl3x.purpur</groupId>
|
||||
+ <artifactId>purpur-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
- <artifactId>paper-api</artifactId>
|
||||
+ <artifactId>purpur-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
- <name>Paper-API</name>
|
||||
- <url>https://github.com/PaperMC/Paper</url>
|
||||
+ <name>Purpur-API</name>
|
||||
+ <url>https://github.com/pl3xgaming/Purpur</url>
|
||||
<description>An enhanced plugin API for Minecraft servers.</description>
|
||||
|
||||
<properties>
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index 5cebb245..e3efafdc 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -207,8 +207,8 @@ public class VersionCommand extends BukkitCommand {
|
||||
private void obtainVersion() {
|
||||
String version = Bukkit.getVersion();
|
||||
if (version == null) version = "Custom";
|
||||
- if (version.startsWith("git-Paper-")) {
|
||||
- String[] parts = version.substring("git-Paper-".length()).split("[-\\s]");
|
||||
+ if (version.startsWith("git-Purpur-")) { // Purpur
|
||||
+ String[] parts = version.substring("git-Purpur-".length()).split("[-\\s]"); // Purpur
|
||||
int distance = getDistance(null, parts[0]);
|
||||
switch (distance) {
|
||||
case -1:
|
||||
@@ -259,13 +259,16 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
// Paper start
|
||||
private static int getDistance(String repo, String verInfo) {
|
||||
- try {
|
||||
- int currentVer = Integer.decode(verInfo);
|
||||
- return getFromJenkins(currentVer);
|
||||
- } catch (NumberFormatException ex) {
|
||||
- verInfo = verInfo.replace("\"", "");
|
||||
- return getFromRepo("PaperMC/Paper", "master", verInfo);
|
||||
- }
|
||||
+ // Purpur start
|
||||
+ //try {
|
||||
+ // int currentVer = Integer.decode(verInfo);
|
||||
+ // return getFromJenkins(currentVer);
|
||||
+ //} catch (NumberFormatException ex) {
|
||||
+ // verInfo = verInfo.replace("\"", "");
|
||||
+ // return getFromRepo("PaperMC/Paper", "master", verInfo);
|
||||
+ //}
|
||||
+ return getFromRepo("pl3xgaming/Purpur", "master", verInfo.replace("\"", ""));
|
||||
+ // Purpur end
|
||||
/*
|
||||
BufferedReader reader = Resources.asCharSource(
|
||||
new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
|
||||
--
|
||||
2.20.1
|
||||
|
140
patches/server/0001-Rebrand-Purpur.patch
Normal file
140
patches/server/0001-Rebrand-Purpur.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From 3597fc2ef74857fbb88d3ee4b299557566308490 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 30 Apr 2019 14:08:58 -0600
|
||||
Subject: [PATCH] Rebrand Purpur
|
||||
|
||||
---
|
||||
pom.xml | 18 +++++++++---------
|
||||
.../paper/console/PaperConsole.java | 2 +-
|
||||
src/main/java/net/minecraft/server/EULA.java | 2 +-
|
||||
.../net/minecraft/server/MinecraftServer.java | 2 +-
|
||||
.../org/bukkit/craftbukkit/CraftServer.java | 2 +-
|
||||
.../bukkit/craftbukkit/util/Versioning.java | 2 +-
|
||||
6 files changed, 14 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index c3844581..860bd355 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,11 +1,11 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
- <artifactId>paper</artifactId>
|
||||
+ <artifactId>purpur</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
- <name>Paper</name>
|
||||
- <url>https://papermc.io</url>
|
||||
+ <name>Purpur</name>
|
||||
+ <url>http://pl3x.net</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -20,16 +20,16 @@
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
- <groupId>com.destroystokyo.paper</groupId>
|
||||
- <artifactId>paper-parent</artifactId>
|
||||
+ <groupId>net.pl3x.purpur</groupId>
|
||||
+ <artifactId>purpur-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
- <groupId>com.destroystokyo.paper</groupId>
|
||||
- <artifactId>paper-api</artifactId>
|
||||
+ <groupId>net.pl3x.purpur</groupId>
|
||||
+ <artifactId>purpur-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
- <finalName>paper-${minecraft.version}</finalName>
|
||||
+ <finalName>purpur-${minecraft.version}</finalName>
|
||||
<defaultGoal>clean install</defaultGoal> <!-- Paper -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -143,7 +143,7 @@
|
||||
<artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
- <outputPrefix>git-Paper-</outputPrefix>
|
||||
+ <outputPrefix>git-Purpur-</outputPrefix>
|
||||
<scmDirectory>..</scmDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
index 688b4715..e4522e68 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@Override
|
||||
protected LineReader buildReader(LineReaderBuilder builder) {
|
||||
return super.buildReader(builder
|
||||
- .appName("Paper")
|
||||
+ .appName("Purpur") // Purpur
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java
|
||||
index 526f3af5..b64cac25 100644
|
||||
--- a/src/main/java/net/minecraft/server/EULA.java
|
||||
+++ b/src/main/java/net/minecraft/server/EULA.java
|
||||
@@ -49,7 +49,7 @@ public class EULA {
|
||||
Properties properties = new Properties();
|
||||
fileoutputstream = new FileOutputStream(this.b);
|
||||
properties.setProperty("eula", "false");
|
||||
- properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world."); // Paper - fix lag);
|
||||
+ properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).");
|
||||
} catch (Exception exception) {
|
||||
a.warn("Failed to save {}", this.b, exception);
|
||||
} finally {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9c8c3304..570360f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1347,7 +1347,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
- return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Purpur"; // Purpur // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 32bf4e58..fc7084ee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -164,7 +164,7 @@ import javax.annotation.Nonnull; // Paper
|
||||
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Purpur"; // Purpur // Paper
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 674096ca..e9aee2d8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.destroystokyo.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/net.pl3x.purpur/purpur-api/pom.properties"); // Purpur
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
--
|
||||
2.20.1
|
||||
|
18
pom.xml
Normal file
18
pom.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.pl3x.purpur</groupId>
|
||||
<artifactId>purpur-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Purpur (Parent)</name>
|
||||
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
<modules>
|
||||
<module>Purpur-API</module>
|
||||
<module>Purpur-Server</module>
|
||||
</modules>
|
||||
</project>
|
112
purpur
Executable file
112
purpur
Executable file
@ -0,0 +1,112 @@
|
||||
#!/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
|
||||
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
|
||||
basedir=$(dirname "$SOURCE")
|
||||
. $basedir/scripts/init.sh
|
||||
|
||||
purpurstash() {
|
||||
STASHED=$(git stash)
|
||||
}
|
||||
|
||||
purpurunstash() {
|
||||
if [[ "$STASHED" != "No local changes to save" ]] ; then
|
||||
git stash pop
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"rb" | "rbp" | "rebuild")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
scripts/rebuildpatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"p" | "patch" | "apply")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
scripts/apply.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"b" | "bu" | "build")
|
||||
(
|
||||
basedir
|
||||
mvn -N install
|
||||
cd ${FORK_NAME}-API
|
||||
mvn clean install && cd ../${FORK_NAME}-Server && mvn clean install
|
||||
)
|
||||
;;
|
||||
"d" | "de" | "deploy")
|
||||
(
|
||||
basedir
|
||||
mvn -N install
|
||||
cd ${FORK_NAME}-API
|
||||
mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install
|
||||
)
|
||||
;;
|
||||
"up" | "upstream")
|
||||
(
|
||||
cd "$basedir"
|
||||
scripts/upstream.sh "$2"
|
||||
)
|
||||
;;
|
||||
"r" | "root")
|
||||
cd "$basedir"
|
||||
;;
|
||||
"a" | "api")
|
||||
cd "$basedir/Purpur-API"
|
||||
;;
|
||||
"s" | "server")
|
||||
cd "$basedir/Purpur-Server"
|
||||
;;
|
||||
"setup")
|
||||
if [[ -f ~/.bashrc ]] ; then
|
||||
NAME="purpur"
|
||||
if [[ ! -z "${2+x}" ]] ; then
|
||||
NAME="$2"
|
||||
fi
|
||||
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
|
||||
alias "$NAME=. $SOURCE"
|
||||
echo "You can now just type '$NAME' at any time to access the purpur tool."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Purpur build tool command. This provides a variety of commands to build and manage the Purpur 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 " * rb, 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 " * b, build | Build API and Server but no deploy. Can be ran anywhere."
|
||||
echo " * d, deploy | Build and Deploy API jar and build Server. 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 Purpur-API directory."
|
||||
echo " * s, server | Move to the Purpur-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 " | . ./purpur setup"
|
||||
echo " | After you run this command you'll be able to just run 'purpur' from anywhere."
|
||||
echo " | The default name for the resulting alias is 'purpur', you can give an argument to override"
|
||||
echo " | this default, such as:"
|
||||
echo " | . ./purpur setup example"
|
||||
echo " | Which will allow you to run 'example' instead."
|
||||
;;
|
||||
esac
|
||||
|
||||
unset -f purpurstash
|
||||
unset -f purpurunstash
|
90
scripts/apply.sh
Executable file
90
scripts/apply.sh
Executable file
@ -0,0 +1,90 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
(
|
||||
(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
|
40
scripts/generatesources.sh
Executable file
40
scripts/generatesources.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/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/forge"
|
||||
|
||||
mkdir -p mc-dev/src/net/minecraft/server
|
||||
|
||||
cd mc-dev
|
||||
if [ ! -d ".git" ]; then
|
||||
git init
|
||||
fi
|
||||
|
||||
rm src/net/minecraft/server/*.java
|
||||
cp $basedir/$decompile/net/minecraft/server/*.java src/net/minecraft/server
|
||||
|
||||
base="$basedir/Paper/Paper-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 "$paperVer" -m "$paperVer" 2>/dev/null
|
||||
pushRepo . $MCDEV_REPO $paperVer
|
89
scripts/importmcdev.sh
Executable file
89
scripts/importmcdev.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/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/forge
|
||||
|
||||
nms="net/minecraft/server"
|
||||
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/net/minecraft/server/$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";
|
||||
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
|
||||
}
|
||||
|
||||
(
|
||||
cd Paper/Paper-Server/
|
||||
lastlog=$(git log -1 --oneline)
|
||||
if [[ "$lastlog" = *"Purpur-Extra mc-dev Imports"* ]]; then
|
||||
git reset --hard HEAD^
|
||||
fi
|
||||
)
|
||||
|
||||
|
||||
files=$(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')
|
||||
|
||||
nonnms=$(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')
|
||||
|
||||
for f in $files; do
|
||||
containsElement "$f" ${nonnms[@]}
|
||||
if [ "$?" == "1" ]; then
|
||||
if [ ! -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server/$f.java" ]; then
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||
echo "$(bashColor 1 31) ERROR!!! Missing NMS$(bashColor 1 34) $f $(bashColorReset)";
|
||||
else
|
||||
import $f
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
###############################################################################################
|
||||
###############################################################################################
|
||||
#################### ADD TEMPORARY ADDITIONS HERE #############################################
|
||||
###############################################################################################
|
||||
###############################################################################################
|
||||
|
||||
# import Foo
|
||||
|
||||
################
|
||||
(
|
||||
cd Paper/Paper-Server/
|
||||
rm -rf nms-patches
|
||||
git add src -A
|
||||
echo -e "Purpur-Extra mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
||||
)
|
||||
|
||||
|
65
scripts/init.sh
Executable file
65
scripts/init.sh
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
# BEGIN config
|
||||
FORK_NAME="Purpur"
|
||||
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
|
||||
)
|
||||
}
|
15
scripts/push.sh
Executable file
15
scripts/push.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/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
|
44
scripts/rebuildpatches.sh
Executable file
44
scripts/rebuildpatches.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/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 --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}-Server server
|
||||
|
||||
$basedir/scripts/push.sh
|
62
scripts/upstream.sh
Executable file
62
scripts/upstream.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/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
|
||||
|
||||
if [[ "$1" == up* ]]; then
|
||||
(
|
||||
cd "$basedir/Paper/"
|
||||
git fetch && 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
|
||||
|
Loading…
Reference in New Issue
Block a user