-
Notifications
You must be signed in to change notification settings - Fork 48
/
build.gradle
171 lines (148 loc) · 5.31 KB
/
build.gradle
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
plugins {
id 'maven-publish'
id 'eclipse'
id 'idea'
id 'org.ajoberstar.grgit.service' version '5.2.2'
id 'net.neoforged.gradle.userdev' version '7.0.154'//https://projects.neoforged.net/neoforged/neogradle
id 'io.freefair.lombok' version '8.6'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
tasks.named('wrapper', Wrapper).configure {
//Define wrapper values here so as to not have to always do so when updating gradlew.properties
gradleVersion = '8.9'
distributionType = Wrapper.DistributionType.ALL
}
project.ext.gitHash = grgitService.service.get().grgit.log().find().abbreviatedId
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE') == 'false'
ext.buildnumber = 0
project.buildnumber = System.getenv('BUILD_NUMBER') != null ? System.getenv('BUILD_NUMBER') : project.ext.gitHash
version = "${minecraft_version}-${mod_version}+" + project.buildnumber
group = "team.chisel.ctm" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
project.base.archivesName = dev ? "CTM_DEV" : "CTM"
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
minecraft.accessTransformers {
file(file('src/main/resources/META-INF/accesstransformer.cfg'))
}
runs {
configureEach {
if (hasProperty('forge_force_ansi')) {
//Force ansi if declared as a gradle variable, as the auto detection doesn't detect IntelliJ properly
// or eclipse's plugin that adds support for ansi escape in console
systemProperties.put('terminal.ansi', (String) property('forge_force_ansi'))
}
modSources.add((SourceSet[]) [sourceSets.main, sourceSets.test])
// Recommended logging level for the console
systemProperties.put('forge.logging.console.level', 'debug')
}
client {
}
server {
}
}
tasks.withType(JavaCompile).configureEach({
options.encoding = 'UTF-8'
options.compilerArgs.addAll(['-Xmaxerrs', '100000'])
})
tasks.withType(Javadoc).configureEach({
options.encoding = 'UTF-8'
})
tasks.named('jar', Jar).configure { Jar jar ->
jar.duplicatesStrategy(DuplicatesStrategy.FAIL)
jar.manifest {
attributes(['Specification-Title': 'ctm',
'Specification-Vendor': 'chisel-team',
'Specification-Version': '25.0',
'Implementation-Title': project.name,
'Implementation-Version': "${version}",
'Implementation-Vendor' : 'chisel-team',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
}
repositories {
mavenLocal()
}
dependencies {
implementation("net.neoforged:neoforge:${forge_version}")
testImplementation('org.junit.jupiter:junit-jupiter:5.10.2')
testImplementation("net.neoforged:testframework:${forge_version}")
}
tasks.named('test', Test).configure { Test test ->
test.useJUnitPlatform()
test.maxHeapSize = '1G'
test.testLogging {
events "passed"
}
}
lombok {
version = "1.18.32"
}
// Create API jar with sources and compiled files
tasks.register('apiJar', Jar) {
duplicatesStrategy(DuplicatesStrategy.FAIL)
archiveClassifier.set('api')
from(sourceSets.main.allSource)
from(sourceSets.main.output)
include('team/chisel/ctm/api/**/*')
}
publishing {
tasks.publish.dependsOn('build')
publications { PublicationContainer publicationContainer ->
publicationContainer.register('mavenJava', MavenPublication) { MavenPublication publication ->
publication.artifactId = 'CTM'
publication.artifacts = [jar, apiJar]
//artifact sourceJar
}
}
repositories {
if (project.hasProperty('mavendir')) {
maven { url project.property('mavendir') }
}
}
}
String getChangelogText() {
def changelogFile = file('changelog.txt')
String str = ''
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
if (lineCount == 0) {
temp = "CTM ${version}"
temp = "<h2>$temp</h2>"
} else if (it.startsWith('-')) {
temp = " $temp"
temp = temp.replaceAll("(\\S+\\/\\S+)#([0-9]+)\\b", "<a href=\"https://github.com/\$1/issues/\$2\">\$0</a>")
temp = temp.replaceAll("#([0-9]+)\\b(?!<\\/a>)", "<a href=\"https://github.com/$github_project/issues/\$1\">\$0</a>")
} else {
temp = "<h4>$temp</h4>"
}
str += "$temp<br/>"
lineCount++
return
} else {
done = true
}
}
return str
}
tasks.curseforge.enabled = !dev && project.hasProperty('curseforge_key')
curseforge {
if (project.hasProperty('curseforge_key')) {
apiKey = project.property('curseforge_key')
}
project {
id = project.projectId
changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG') == 'none' ? getChangelogText() : System.getenv('CHANGELOG')
changelogType = 'html'
releaseType = project.curse_type
mainArtifact(jar) {
displayName = "CTM - ${version}"
}
addGameVersion project.minecraft_version
}
}