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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
plugins {
id("fabric-loom") version "0.9-SNAPSHOT"
id("maven-publish")
id("java")
id("java-library")
id("org.cadixdev.licenser") version("0.6.1")
id("com.matthewprenger.cursegradle") version("1.4.0")
id("net.corda.plugins.jar-filter") version("5.0.8") apply false
}
import net.fabricmc.loom.task.RemapJarTask
import java.text.SimpleDateFormat
sourceCompatibility = targetCompatibility = 1.8
archivesBaseName = "RoughlyEnoughItems"
group = "me.shedaniel"
version = project.mod_version
minecraft {
accessWidener = file("src/main/resources/rei.aw")
}
license {
header rootProject.file('HEADER')
include '**/*.java'
}
repositories {
maven { url "https://maven.terraformersmc.com/" }
maven { url "https://maven.shedaniel.me/" }
}
jar {
from "LICENSE"
}
processResources {
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
inputs.property "version", project.version
}
dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings("me.shedaniel:legacy-yarn:${project.yarn_version}:v2")
modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}")
modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") {
exclude(module: "fabric-biomes-v1")
}
modApi("me.shedaniel.cloth.api:cloth-client-events-v0:${cloth_client_events_v0_version}") {
transitive(false)
}
modApi("me.shedaniel.cloth:config-2:${cloth_config_version}") {
exclude(module: "fabric-api")
}
modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}") {
exclude(module: "fabric-api")
}
modApi("org.jetbrains:annotations:19.0.0")
modCompileOnly("io.github.prospector:modmenu:${modmenu_version}") {
transitive(false)
}
modRuntime("io.github.prospector:modmenu:${modmenu_version}") {
transitive(false)
}
modRuntime("me.shedaniel:SmoothScrollingEverywhere:3.0.3-unstable") {
transitive(false)
}
afterEvaluate {
def listAdded = new ArrayList(Arrays.asList((api_exculde as String).split(',')))
def eachDep = { dep ->
for (apiIncludeDepStr in (api_include as String).split(',')) {
if (apiIncludeDepStr.isEmpty()) continue
def apiIncludeGroup = apiIncludeDepStr.split(':')[0]
def apiIncludeDep = apiIncludeDepStr.split(':')[1]
if (dep.module.id.group == apiIncludeGroup && dep.module.id.name.startsWith(apiIncludeDep)) {
def version = dep.module.id.version.indexOf('@') >= 0 ? dep.module.id.version.substring(0, dep.module.id.version.indexOf('@')) : dep.module.id.version
def mavenDep = "${dep.module.id.group}:${dep.module.id.name}:$version"
if (!(mavenDep in listAdded)) {
include(mavenDep) {
transitive = false
}
listAdded.add(mavenDep)
}
break
}
}
}
configurations.compileClasspath.resolvedConfiguration.firstLevelModuleDependencies.each eachDep
configurations.runtimeClasspath.resolvedConfiguration.firstLevelModuleDependencies.each eachDep
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task jarFilter(type: net.corda.gradle.jarfilter.JarFilterTask) {
jars remapJar
annotations {
forRemove = [
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable",
"org.jetbrains.annotations.ApiStatus\$Experimental",
"org.jetbrains.annotations.ApiStatus\$Internal",
"org.jetbrains.annotations.ApiStatus\$ScheduledForRemoval",
"org.jetbrains.annotations.ApiStatus\$AvailableSince",
"org.jetbrains.annotations.ApiStatus\$NonExtendable",
"org.jetbrains.annotations.ApiStatus\$OverrideOnly"
]
}
}
task copyJarFilter(type: Copy) {
from jarFilter
into "${project.buildDir}/filtered-libs/"
rename { "${project.archivesBaseName}-${project.version}.jar" }
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier("sources")
from sourceSets.main.allSource
}
task remapMavenJar(type: RemapJarTask, dependsOn: jar) {
afterEvaluate {
input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
archiveName = "${archivesBaseName}-${version}.jar"
addNestedDependencies = false
}
}
def releaseChangelog = "No changelog"
/* Thank you modmenu & fablabs */
task releaseOnCf {
def df = new SimpleDateFormat("yyyy-MM-dd HH:mm")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
def branch
if (System.env.BRANCH_NAME) {
branch = System.env.BRANCH_NAME
branch = branch.substring(branch.lastIndexOf("/") + 1)
} else {
branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
}
if (branch == "HEAD") {
branch = "git rev-parse --short HEAD".execute().in.text.trim()
}
def time = df.format(new Date())
def changes = new StringBuilder()
changes << "<h2>REI v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/shedaniel/RoughlyEnoughItems/commits/$branch\">Click here for changelog</a>"
def proc = "git log --max-count=200 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "<br>- ${processedLine.capitalize()}"
}
}
proc.waitFor()
releaseChangelog = changes.toString()
dependsOn tasks.getByName("curseforge")
}
curseforge {
if (project.hasProperty('danielshe_curse_api_key') || System.getenv('danielshe_curse_api_key') != null) {
apiKey = project.hasProperty('danielshe_curse_api_key') ? project.property('danielshe_curse_api_key') : System.getenv('danielshe_curse_api_key')
project {
id = "310111"
releaseType = "release"
changelogType = "html"
changelog = releaseChangelog
addGameVersion "1.16-Snapshot"
addGameVersion "1.16"
addGameVersion "1.16.1"
addGameVersion "Java 8"
addGameVersion "Fabric"
relations {
requiredDependency "fabric-api"
embeddedLibrary "cloth-api"
embeddedLibrary "cloth-config"
embeddedLibrary "auto-config-updated-api"
}
mainArtifact(file("${project.buildDir}/filtered-libs/${project.archivesBaseName}-${project.version}.jar")) {
displayName = "[Fabric $project.supported_version] v$project.version"
}
addArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}-sources.jar")) {
displayName = "[Fabric $project.supported_version] v$project.version Sources"
}
afterEvaluate {
uploadTask.dependsOn("copyJarFilter")
}
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}.jar")) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}
|