gradle: gitlab ci, build fat jar

This commit is contained in:
Bixilon 2022-10-17 20:25:57 +02:00
parent 162d0a97aa
commit 97392c9d20
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
4 changed files with 65 additions and 11 deletions

View File

@ -1,24 +1,63 @@
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_CLI_OPTS: "--errors --fail-at-end --show-version"
image: gradle:jdk11
image: maven:3-openjdk-11
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .m2/repository
- .gradle/wrapper
- .gradle/caches
stages:
- build
- test
- package
build:
stage: build
script: ./gradlew --build-cache assemble
only:
- master
- merge_requests
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test:
stage: test
script: ./gradlew check
only:
- master
- merge_requests
script:
- 'mvn $MAVEN_CLI_OPTS verify'
artifacts:
when: always
reports:
junit:
- target/surefire-reports/TEST-*.xml
junit: build/test-results/**/TEST-*.xml
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
package:
stage: package
script: ./gradlew fatJar
only:
- master
- merge_requests
artifacts:
paths:
- build/libs/minosoft-fat-*.jar
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle

View File

@ -16,8 +16,11 @@ import de.bixilon.kutil.os.OSTypes
import de.bixilon.kutil.os.PlatformInfo
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.gradle.configurationcache.extensions.capitalized
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.7.20"
id("org.openjfx.javafxplugin") version "0.0.13"
@ -314,3 +317,15 @@ javafx {
version = javafxVersion
modules("javafx.controls", "javafx.fxml")
}
val fatJar = task("fatJar", type = Jar::class) {
archiveBaseName.set("${project.name}-fat")
manifest {
attributes["Implementation-Title"] = project.name.capitalized()
attributes["Implementation-Version"] = project.version
attributes["Main-Class"] = application.mainClass
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
with(tasks["jar"] as CopySpec)
}

View File

@ -10,7 +10,7 @@
#
# This software is not affiliated with Mojang AB, the original developer of Minecraft.
#
kotlin.daemon.jvmargs=-Xmx1500M
kotlin.daemon.jvmargs=-Xmx2G
kotlin.code.style=official
javafx.version=19
lwjgl.version=3.3.2-SNAPSHOT

View File

@ -42,7 +42,7 @@ public final class ProtocolDefinition {
public static final String DEFAULT_NAMESPACE = "minecraft";
public static final String MINOSOFT_NAMESPACE = "minosoft";
public static final char TEXT_COMPONENT_SPECIAL_PREFIX_CHAR = '§';
public static final char TEXT_COMPONENT_SPECIAL_PREFIX_CHAR = '\u00A7';
public static final int DEFAULT_BUFFER_SIZE = 4096;