-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstonecutter.gradle
More file actions
76 lines (62 loc) · 2.93 KB
/
stonecutter.gradle
File metadata and controls
76 lines (62 loc) · 2.93 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
plugins {
id "me.gravityio.discord-webhook" version "0.0.2"
id "me.gravityio.replacementplugin" version "0.0.7" // my local experimental plugin, just delete if you fork
}
plugins.apply "dev.kikugie.stonecutter"
stonecutter.active "1.21" /* [SC] DO NOT EDIT */
def secrets = new Properties()
rootProject.file("secrets.properties").withInputStream { secrets.load(it) }
rootProject.ext.data = new LinkedHashMap<String, UploadData>()
rootProject.ext.changelog_overview = file("changelog-overview.md").text
rootProject.ext.changelog_details = file("changelog-details.md").text
rootProject.ext.changelog = rootProject.changelog_overview + "\n" + rootProject.changelog_details
stonecutter.versions.forEach {
rootProject.ext.data.put(it.project, new UploadData())
}
replacement {
fileName = "README.md"
types = ["modrinth", "curseforge"]
values = [
"fabric": ["https://modrinth.com/mod/fabric-api", "https://curseforge.com/minecraft/mc-mods/fabric-api"]
]
}
discordWebhook {
webhook_url = secrets.get("discord_webhook_url")
}
stonecutter.registerChiseled tasks.register("chiseledBuild", stonecutter.chiseled) {
group = "project"
ofTask "build"
}
// GRADLE?? WHAT THE FUCKKKKK
// my brain hurt
stonecutter.registerChiseled tasks.register("chiseledPublishMod") {
group = "project"
dependsOn("chiseledStonecutter")
chiseledDepends(it, "publishMod")
finalizedBy("sendDiscordWebhook")
doLast {
def message = ""
rootProject.ext.data.each {
UploadData upData = it.value
message += "# $rootProject.name ${rootProject.mod_version}+${it.key} Update ([Modrinth](<https://modrinth.com/mod/customdurability/version/${upData.modrinthFileId}>) | [Curseforge](<https://curseforge.com/minecraft/mc-mods/customdurability/files/${upData.curseFileId}>))\n"
}
message += "$rootProject.ext.changelog_overview\n\n"
message += "**To view the details of the changelog visit the [Modrinth changelog page](<https://modrinth.com/mod/customdurability/changelog>) or the [CurseForge files page](<https://curseforge.com/minecraft/mc-mods/customdurability/files/${rootProject.ext.data.firstEntry().value.curseFileId}>)**\n"
message += "**As always report any issues on my [GitHub](<${rootProject.mod_sources}>) or in https://discord.com/channels/1112046604183162961/1245461284992843946**\n"
message += "<@&1277910793085521940>"
rootProject.file("temp").mkdir()
rootProject.file("temp/discord.md").write(message)
tasks.named("sendDiscordWebhook").configure {
it.content = message
}
}
}
def chiseledDepends(Task task, String taskName) {
def setupTask = rootProject.tasks.named("chiseledStonecutter")
stonecutter.versions.forEach {
Project p = rootProject.project(it.project)
Task subtask = p.tasks.named(taskName).get()
task.dependsOn(subtask)
subtask.mustRunAfter(setupTask)
}
}