-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
90 lines (77 loc) · 2.24 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
import java.nio.file.Files
plugins {
id 'java'
id 'maven-publish'
id 'me.modmuss50.mod-publish-plugin' version '0.5.1'
}
group = 'net.neoforged'
var describe = new ByteArrayOutputStream()
project.exec {
commandLine('git', 'describe')
standardOutput = describe
}
final splitVersion = describe.toString().trim().split('-')
if (splitVersion[0].split('\\.').length == 2) {
println("Version: ${version = (splitVersion[0] + '.' + splitVersion[1])}")
} else {
var splitVer = splitVersion[0].split('\\.')
println("Version: ${version = (splitVer[0] + '.' + splitVer[1] + (splitVer[2] as int + splitVersion[1] as int))}")
}
base {
archivesName = 'server'
}
sourceSets {
java8
}
repositories {
mavenCentral()
}
dependencies {
compileOnly sourceSets.java8.output
compileOnly 'org.jetbrains:annotations:24.1.0'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(16)
}
}
tasks.named("compileJava8Java").configure {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
jar {
from sourceSets.java8.output
archiveFileName = 'server.jar'
manifest.attributes([
'Implementation-Version': project.version.toString(),
'Main-Class' : 'net.neoforged.serverstarterjar.Main8',
'Premain-Class' : 'net.neoforged.serverstarterjar.Agent',
'Launcher-Agent-Class' : 'net.neoforged.serverstarterjar.Agent'
])
}
tasks.register('updateServerJar') {
dependsOn(tasks.jar)
doFirst {
var targetPath = rootProject.file('testing/server.jar').toPath()
Files.deleteIfExists(targetPath)
Files.copy(tasks.jar.archiveFile.get().asFile.toPath(), targetPath)
}
}
var lastCommitMessage = new ByteArrayOutputStream()
project.exec {
commandLine('git log -1 --pretty=%B'.split(' '))
standardOutput = lastCommitMessage
}
publishMods {
file = tasks.jar.archiveFile
modLoaders.addAll('forge', 'neoforge')
getChangelog().set(lastCommitMessage.toString().trim())
type = STABLE
github {
accessToken = providers.environmentVariable('GITHUB_TOKEN')
repository = 'neoforged/ServerStarterJar'
commitish = 'main'
}
}
test.enabled = false