Merge branch 'local.docker.compile' into 'main'

Local docker compile

See merge request jeseibel/minecraft-lod-mod!33
This commit is contained in:
James Seibel
2023-08-12 22:05:29 +00:00
5 changed files with 75 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
**/.git
**/.gitlab
**/.cache
buildAllJars
**/_Misc Files
*.bat
*.md
*.sh
*.txt
coreSubProjects/*.md
coreSubProjects/*.txt
**/.gitignore
**/.gitattributes
**/.gitlab-cy.yml
**/.gitmodules
+1
View File
@@ -5,6 +5,7 @@ run/
out/
*.iml
.gradle/
.gradle-cache/
output/
bin/
libs/
+12
View File
@@ -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] =========="
+12 -2
View File
@@ -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
<br>
## Compiling
@@ -138,7 +139,16 @@ Run tests with: `./gradlew test`
> Example: `./gradlew assemble -PmcVer=1.18.2`
<Br>
<br>
## Compiling with Docker
`./compile <version>`
You can also locally compile the DH jars without a Java environment by using Docker. Where `<version>` 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.
<br>
## Other commands
+31
View File
@@ -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