diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..a190fb110 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +**/.git +**/.gitlab +**/.cache + +buildAllJars + +**/_Misc Files +*.bat +*.md +*.sh +*.txt + +coreSubProjects/*.md +coreSubProjects/*.txt + +**/.gitignore +**/.gitattributes +**/.gitlab-cy.yml +**/.gitmodules diff --git a/.gitignore b/.gitignore index 547998298..0fa2bd272 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ run/ out/ *.iml .gradle/ +.gradle-cache/ output/ bin/ libs/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..8df81edfb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM eclipse-temurin:17-jdk + +WORKDIR /home/build/ +COPY ./gradlew . +RUN chmod +x ./gradlew +CMD echo "\r========== [CLEAN: $MC_VER] ==========" && \ + ./gradlew clean -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \ + echo "\r========== [BUILD: $MC_VER] ==========" && \ + ./gradlew build -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \ + echo "\r========== [MERGE: $MC_VER] ==========" && \ + ./gradlew mergeJars -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \ + echo "\r========== [DONE: $MC_VER] ==========" diff --git a/Readme.md b/Readme.md index 737724030..2566023d5 100644 --- a/Readme.md +++ b/Readme.md @@ -109,7 +109,8 @@ If running in an IDE, to ensure the IDE noticed the version change, run any grad >Note: There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions. To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s). (Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`). \ > If anyone knows how to solve this issue please let us know here: \ > https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/233 - + +
## Compiling @@ -138,7 +139,16 @@ Run tests with: `./gradlew test` > Example: `./gradlew assemble -PmcVer=1.18.2` -
+
+ +## Compiling with Docker + +`./compile ` + +You can also locally compile the DH jars without a Java environment by using Docker. Where `` is the version of Minecraft to compile for (ie `1.20.1`), or the keyword `all`. See [Versions](#minecraft-and-library-versions) for a list of all supported values. + + +
## Other commands diff --git a/compile.sh b/compile.sh new file mode 100644 index 000000000..9cc9a628b --- /dev/null +++ b/compile.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +publish_version() +{ + if [[ "$2" == "all" || "$1" == "$2" ]] + then + docker run --name=dh-build-$1 --rm -v /${PWD}:/home/build -e MC_VER=$1 dh-eclipse-temurin + cp ./fabric/build/libs/*$1.jar ./buildAllJars/fabric/ + cp ./forge/build/libs/*$1.jar ./buildAllJars/forge/ + cp ./Merged/*.jar ./buildAllJars/merged/ + fi +} + + +if [ -z "$1" ] +then + echo "Build target is undefined! [all] [1.20.1] [1.19.4] [1.19.2] [1.18.2] [1.17.1] [1.16.5]" + exit 1 +fi + +docker build --tag=dh-eclipse-temurin -q . + +mkdir -p buildAllJars/fabric +mkdir -p buildAllJars/forge +mkdir -p buildAllJars/merged +publish_version 1.20.1 $1 +publish_version 1.19.4 $1 +publish_version 1.19.2 $1 +publish_version 1.18.2 $1 +publish_version 1.17.1 $1 +publish_version 1.16.5 $1