-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
119 lines (98 loc) · 3.35 KB
/
Copy pathbuild.gradle
File metadata and controls
119 lines (98 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
id 'fabric-loom' version "${loom_version}"
id 'maven-publish'
id 'checkstyle'
}
// Wire version/group/name from gradle.properties
group = project.findProperty('maven_group') ?: 'woflo.petsplus'
version = project.findProperty('mod_version') ?: '0.0.0-dev'
base {
archivesName = project.findProperty('archives_base_name') ?: 'petsplus'
}
// Repositories needed for Loom + deps
repositories {
mavenCentral()
maven { url "https://maven.fabricmc.net" }
}
// Expand version into fabric.mod.json
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand([version: project.version, mod_version: project.version])
}
}
// Java toolchain (Minecraft 1.21.10 requires Java 21)
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
}
loom {
mixin {
defaultRefmapName = "petsplus.refmap.json"
}
}
tasks.withType(JavaCompile).configureEach {
options.release = 21
options.encoding = 'UTF-8'
}
jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
}
// Publishing (standard Loom template)
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = base.archivesName.get()
from components.java
}
}
repositories {
// Configure if you need to publish
}
}
dependencies {
// Core Minecraft + mappings + loader
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
// Fabric API for mod features
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
// Testing dependencies - all actively used in tests
testImplementation "org.junit.jupiter:junit-jupiter:5.10.1"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.1"
testImplementation "org.mockito:mockito-core:5.8.0"
testImplementation "org.mockito:mockito-junit-jupiter:5.8.0"
testImplementation "org.assertj:assertj-core:3.24.2"
testImplementation "org.awaitility:awaitility:4.2.0"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
checkstyle {
toolVersion = '10.12.5'
configFile = file('config/checkstyle/checkstyle.xml')
checkstyleMain.source = 'src/main/java'
}
// JUnit 5 test configuration with parallel execution
test {
useJUnitPlatform()
// Enable parallel test execution
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
// Configure JUnit 5 parallel execution
systemProperty 'junit.jupiter.execution.parallel.enabled', 'true'
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'concurrent'
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', 'concurrent'
// Use dynamic thread count based on available processors
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'dynamic'
systemProperty 'junit.jupiter.execution.parallel.config.dynamic.factor', '1.0'
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = false
}
maxHeapSize = "2G"
// Fail fast on first failure (optional, remove if you want all tests to run)
// failFast = true
}