Added multithreading

This commit is contained in:
Joseph Robinson
2020-04-30 10:50:42 -07:00
parent 09aaa59f0a
commit 14a36a6861
3 changed files with 22 additions and 8 deletions

22
akarin
View File

@@ -1,5 +1,15 @@
#!/usr/bin/env bash
# Akarin Build Script
############################################################################
# Multicore building #
# By JosephWorks #
# -------------------------------------------------------------------------#
# To use multicore building, add "-T ${BUILD_CORES}" after all mvn commands#
# 20-50% speed improvement is quite common. #
############################################################################
# Exit immediately if a command exits with a non-zero status
set -e
@@ -38,18 +48,18 @@ case "$1" in
set -e
setupUpstreamAndPatch $2 || exit 1
basedir
mvn -N install || exit 1
mvn -T ${BUILD_CORES} -N install || exit 1
cd ${FORK_NAME}-API
mvn -e clean install && cd ../${FORK_NAME}-Server && mvn -e clean install || exit 1
mvn -T ${BUILD_CORES} -e clean install && cd ../${FORK_NAME}-Server && mvn -T ${BUILD_CORES} -e clean install || exit 1
) || failed=1
;;
"j" | "launcher" | "jar" | "paperclip")
(
setupUpstreamAndPatch $2 || exit 1
basedir
mvn -N install
mvn -T ${BUILD_CORES} -N install
cd ${FORK_NAME}-API
mvn -e clean install && cd ../${FORK_NAME}-Server && mvn -e clean install
mvn -T ${BUILD_CORES} -e clean install && cd ../${FORK_NAME}-Server && mvn -T ${BUILD_CORES} -e clean install
basedir
$scriptdir/installLauncher.sh "$basedir"
) || failed=1
@@ -57,9 +67,9 @@ case "$1" in
"d" | "de" | "deploy")
(
basedir
mvn -N install
mvn -T ${BUILD_CORES} -N install
cd ${FORK_NAME}-API
mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install
mvn -T ${BUILD_CORES} clean deploy && cd ../${FORK_NAME}-Server && mvn -T ${BUILD_CORES} clean install
)
;;
"u" | "up" | "upstream" | "update")

View File

@@ -7,6 +7,10 @@ PAPER_API_REPO=""
PAPER_SERVER_REPO=""
MCDEV_REPO=""
# Added Multithreading to builds
# By JosephWorks
BUILD_CORES="$(nproc --all)"
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

View File

@@ -48,7 +48,7 @@ paperdir
./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 } }')
#mcVer=$(mvn -T ${BUILD_CORES} -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
@@ -84,4 +84,4 @@ echo " $(bashcolor 1 32)($subtasks/$subtasks) Succeed$(bashcolorend) - Submodul
echo " "
# gitpush Paper-API $PAPER_API_REPO $tag
# gitpush Paper-Server $PAPER_SERVER_REPO $tag
# gitpush Paper-Server $PAPER_SERVER_REPO $tag