From a40c1a79c73fd546d784dddb8d4d97bd81d389f7 Mon Sep 17 00:00:00 2001 From: Sotr Date: Mon, 13 Apr 2020 20:39:14 +0700 Subject: [PATCH] A few more tweaks in script --- README.md | 10 +++++----- akarin | 21 +++++++++++---------- scripts/applyPatches.sh | 3 ++- scripts/importSources.sh | 30 +++++++++++++++++++++--------- scripts/installLauncher.sh | 1 + scripts/rebuildPatches.sh | 1 + scripts/updateUpstream.sh | 14 +++++++------- 7 files changed, 48 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c487d2fc7..b03434e3c 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ Get Akarin #### Recommended -+ [**JosephWorks Jenkins**](http://josephworks.ddns.net:8080/job/Akarin-project/job/Akarin-1.15.2/) -+ [**Melon Jenkins**](https://ci.melon.cat/job/Akarin/) - Offline ++ [**Github Actions**](https://github.com/Akarin-project/Akarin/actions) ++ [**JosephWorks Jenkins**](http://josephworks.ddns.net:8080/job/Akarin-project/job/Akarin-1.15.2) *Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here* @@ -54,13 +54,13 @@ Demo Servers * [Fair Server](https://fairserver.ru) * [LoyaltyMC](https://www.loyaltymc.net/) -*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here* +*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your server here* Contributing --- -* You can checkout the `src` folder to see more. Please follow the patch style to do any change, so we are able to update between different Minecraft versions. +* Akarin use patches to handle our changes. * Add your name to the [LICENSE](https://github.com/Akarin-project/Akarin/blob/master/LICENSE.md) if you want to publish your code under the [MIT License](https://github.com/Akarin-project/Akarin/blob/master/licenses/MIT.md). -* If you want to join the [Akarin-project](https://github.com/Akarin-project) team, you can [send](mailto://kira@kira.moe) us an email with your experience and necessary information. +* If you want to join the [Akarin-project](https://github.com/Akarin-project) team, welcome to contact us by our [Discord](https://discord.gg/fw2pJAj). ![Akarin project](https://i.loli.net/2018/05/13/5af7fbbfbcddf.png) diff --git a/akarin b/akarin index 4b02f18a7..5577ce39a 100755 --- a/akarin +++ b/akarin @@ -10,7 +10,7 @@ function updateAndPatch { if [ "$1" != "skipPaper" ]; then $scriptdir/updateUpstream.sh "$basedir" || exit 1 fi - $scriptdir/applyPatches.sh "$basedir" || exit 1 + $scriptdir/applyPatches.sh "$basedir" $2 || exit 1 } failed=0 @@ -25,22 +25,22 @@ case "$1" in "a" | "p" | "patch" | "apply") ( set -e - updateAndPatch $2 + $scriptdir/applyPatches.sh "$basedir" $2 0 || exit 1 ) || failed=1 ;; - "b" | "bu" | "build") + "b" | "bu" | "build" | "install") ( set -e - updateAndPatch $2 + updateAndPatch $2 0 basedir mvn -N install || exit 1 cd ${FORK_NAME}-API mvn -e clean install && cd ../${FORK_NAME}-Server && mvn -e clean install || exit 1 ) || failed=1 ;; - "jar" | "paperclip") + "j" | "launcher" | "jar" | "paperclip") ( - updateAndPatch $2 + updateAndPatch $2 0 basedir mvn -N install cd ${FORK_NAME}-API @@ -134,11 +134,12 @@ 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 " * r, 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 " * 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 " * 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." diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh index 530c75fe6..b04d99aa1 100755 --- a/scripts/applyPatches.sh +++ b/scripts/applyPatches.sh @@ -3,6 +3,7 @@ # 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 Akarin patches on top of the Paper." @@ -42,7 +43,7 @@ function applyPatch { 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 + basedir && $scriptdir/importSources.sh $basedir 1 || exit 1 fi basedir diff --git a/scripts/importSources.sh b/scripts/importSources.sh index 67e4f51fd..b6acd3762 100755 --- a/scripts/importSources.sh +++ b/scripts/importSources.sh @@ -1,13 +1,18 @@ #!/usr/bin/env bash maintask=$2 -tasktitle=maintask && "Import Sources" || "Import Sources (Subtask)" +if [ ! $maintask ]; 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 " $(bashcolor 1 32)Task$(bashcolorend) - $TASKTITLE" echo " This will import unimported newly added/mod sources to Paper workspace" echo " " echo "----------------------------------------" @@ -21,8 +26,8 @@ papernmsdir="$papersrcdir/net/minecraft/server" ( # fast-fail if Paper not set - if [ ! -f "$papernmsdir" ]; then - echo "$(bashcolor 1 31) Exception $(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup." + if [ ! -d "$papernmsdir" ]; then + echo " $(bashcolor 1 31)Exception$(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup." exit 1 fi ) @@ -36,7 +41,7 @@ basedir function importToPaperWorkspace { if [ -f "$papernmsdir/$1.java" ]; then - echo "$(bashcolor 1 33) Skipped $(bashcolorend) - Already imported $1.java" + echo " $(bashcolor 1 33)Skipped$(bashcolorend) - Already imported $1.java" return 0 fi @@ -64,7 +69,7 @@ function importLibraryToPaperWorkspace { 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." + 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 @@ -75,6 +80,7 @@ function importLibraryToPaperWorkspace { } ( + # 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 Akarin"* ]]; then @@ -92,8 +98,7 @@ for f in $patchedFiles; do if [ "$?" == "1" ]; then if [ ! -f "$papersrcdir/$nms/$f.java" ]; then if [ ! -f "$decompiledir/$nms/$f.java" ]; then - echo "$(bashcolor 1 31) ERROR!!! Missing NMS$(bashcolor 1 34) $f $(bashcolorend)"; - echo "$(bashcolor 1 31) Exception $(bashcolorend) - Cannot find NMS file $f.java to import, re-decomplie or remove the import." + 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 @@ -114,5 +119,12 @@ done # rm -rf nms-patches git add . &> /dev/null echo -e "Extra dev imports of Akarin:\n\n$IMPORT_LOG" | git commit src -F - &> /dev/null - echo " $(bashcolor 1 32) Succeed$(bashcolorend) - Sources have been imported to the current branch/state of Paper/Paper-Server" + echo " $(bashcolor 1 32)Succeed$(bashcolorend) - Sources have been imported to Paper/Paper-Server" + + if [ $maintask ]; then # this is magical + echo "----------------------------------------" + echo " Subtask finished" + echo "----------------------------------------" + fi + echo " " ) \ No newline at end of file diff --git a/scripts/installLauncher.sh b/scripts/installLauncher.sh index 5ba4685be..d1815bf52 100755 --- a/scripts/installLauncher.sh +++ b/scripts/installLauncher.sh @@ -3,6 +3,7 @@ # 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." diff --git a/scripts/rebuildPatches.sh b/scripts/rebuildPatches.sh index 9c6dd5cc3..bca03b2c6 100755 --- a/scripts/rebuildPatches.sh +++ b/scripts/rebuildPatches.sh @@ -3,6 +3,7 @@ # SCRIPT HEADER start basedir=$1 source "$basedir/scripts/functions.sh" +echo " " echo "----------------------------------------" echo " $(bashcolor 1 32)Task$(bashcolorend) - Rebuild Patches" echo " This will diff the sources of Akarin and Paper to build patches." diff --git a/scripts/updateUpstream.sh b/scripts/updateUpstream.sh index 1f71960f1..5c6477a25 100755 --- a/scripts/updateUpstream.sh +++ b/scripts/updateUpstream.sh @@ -6,9 +6,9 @@ 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)Subtask:$(bashcolorend)" +#echo " - Import Sources" echo " " echo " $(bashcolor 1 32)Projects:$(bashcolorend)" echo " - $(bashcolor 1 32)1$(bashcolorend) : Paper" @@ -25,7 +25,7 @@ echo "----------------------------------------" # exit immediately if a command exits with a non-zero status set -e -subtasks=2 +subtasks=1 echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.." git submodule update --init --recursive @@ -48,9 +48,9 @@ paperdir 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 } }') -echo " $(bashcolor 1 32)(1/$subtasks)$(bashcolorend) - Update Git submodule.." -basedir -"$basedir"/scripts/importSources.sh $1 +#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")