-
Notifications
You must be signed in to change notification settings - Fork 46
/
build.gradle
171 lines (138 loc) · 4.76 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
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
plugins {
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.71.4'
id 'org.ajoberstar.grgit' version '4.1.1'
id 'com.github.ben-manes.versions' version '0.39.0'
id 'net.neoforged.gradle.userdev' version '7.0.142'
id "me.modmuss50.mod-publish-plugin" version "0.7.1"
id 'java-library'
id 'idea'
id 'maven-publish'
}
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}
version = grgit.describe(longDescr: true).split('-').with { "${it[0]}.${it[1]}" }
group = 'cpw.mods'
repositories {
mavenLocal()
}
base {
archivesName = 'inventorysorter'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}
client {
systemProperty 'forge.enabledGameTestNamespaces', 'inventorysorter'
}
server {
systemProperty 'forge.enabledGameTestNamespaces', 'inventorysorter'
programArgument '--nogui'
}
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', 'inventorysorter'
}
data {
programArguments.addAll '--mod', 'inventorysorter', '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
configurations {
runtimeClasspath.extendsFrom localRuntime
}
dependencies {
implementation "net.neoforged:neoforge:${neo_version}"
}
tasks.register('makeChangelog', GitChangelogTask) {
file = project.file('CHANGELOG.md')
fromRepo = file(".")
untaggedName = "Current release ${version}"
fromRef = project.findProperty('changelogStart') ?: '13.0'
templateContent = """
# Inventory sorter changelog history
## Version ${version} for Minecraft ${mc_version}
{{#tags}}
* {{name}}
{{#commits}}
* {{{messageTitle}}}
{{/commits}}
{{/tags}}
"""
}
publishMods {
def apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
dryRun = apiKey == '0'
file = jar.archiveFile
changelog = file('CHANGELOG.md').exists() ? file('CHANGELOG.md').text : "No changelog provided"
type = STABLE
curseforge {
modLoaders.add("neoforge")
accessToken = apiKey
projectId = "240633"
accessToken = apiKey
minecraftVersions.add(mc_version)
minecraftVersions.add("1.21.1")
minecraftVersions.add("1.21.2")
minecraftVersions.add("1.21.3")
minecraftVersions.add("1.21.4")
javaVersions.add(JavaVersion.VERSION_21)
clientRequired = true
serverRequired = true
}
}
tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title": 'inventorysorter',
"Specification-Vendor": 'cpwmods',
"Specification-Version": '1', // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :'cpwmods',
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
archiveAppendix = mc_version
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
mod_version : project.version,
]
inputs.properties replaceProperties
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
maven {
url "file://${project.projectDir}/repo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}