-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
131 lines (92 loc) · 4.13 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
// TODO remove buildscript block
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'com.diluv.schoomp', name: 'Schoomp', version: '1.2.5'
}
}
plugins {
id 'net.darkhax.curseforgegradle' version '1.1.17' apply(false)
id 'com.modrinth.minotaur' version '2.8.5' apply(false)
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}
apply from: 'gradle/property_loader.gradle'
apply from: 'gradle/build_number.gradle'
apply from: 'gradle/git_changelog.gradle'
apply from: 'gradle/version_checker.gradle'
subprojects {
apply plugin: 'maven-publish'
apply from: '../gradle/property_loader.gradle'
apply from: '../gradle/java.gradle'
apply from: '../gradle/build_number.gradle'
apply from: '../gradle/git_changelog.gradle'
apply from: '../gradle/minify_jsons.gradle'
apply from: '../gradle/signing.gradle'
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// Enable Mixins
project.ext.mixin_enabled = project.file("src/main/resources/${mod_id}.mixins.json").exists()
project.logger.lifecycle("Mixin ${project.ext.mixin_enabled ? 'enabled' : 'disabled'} for project ${project.name}.")
repositories {
mavenCentral()
maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'BlameJared Maven (CrT / Bookshelf)'
url = 'https://maven.blamejared.com'
}
maven {
name = 'Mod Menu'
url = 'https://maven.terraformersmc.com/releases/'
}
}
}
import com.diluv.schoomp.Webhook
import com.diluv.schoomp.message.Message
import com.diluv.schoomp.message.embed.Embed
task postDiscord() {
doLast {
try {
// Create a new webhook instance for Discord
def webhook = new Webhook(findProperty('curse_discord_webhook'), "${project.ext.mod_name} CurseForge Gradle Upload")
// Craft a message to send to Discord using the webhook.
def message = new Message()
message.setUsername("Mod Update: ${project.ext.mod_name}")
message.setContent("${project.ext.mod_name} ${project.version} for Minecraft ${project.ext.minecraft_version} has been published!")
def embed = new Embed();
def downloadSources = new StringJoiner('\n')
if (project(':forge').hasProperty('curse_file_url')) {
downloadSources.add("<:forge:916233930091401266> [Forge](${project(':forge').findProperty('curse_file_url')})")
}
if (project(':fabric').hasProperty('curse_file_url')) {
downloadSources.add("<:fabric:916233929722314763> [Fabric](${project(':fabric').findProperty('curse_file_url')})")
}
if (project(':neoforge').hasProperty('curse_file_url')) {
downloadSources.add("<:neoforge:1173939148806176779> [NeoForge](${project(':neoforge').findProperty('curse_file_url')})")
}
// Add Curseforge DL link if available.
def downloadString = downloadSources.toString()
if (downloadString && !downloadString.isEmpty()) {
embed.addField('Download', downloadString, false)
}
// Add a changelog field if a changelog exists.
if (project.ext.mod_changelog && !project.ext.mod_changelog.isEmpty()) {
embed.addField('Changelog', getChangelog(1500), false)
}
embed.setColor(0xFF8000)
message.addEmbed(embed)
webhook.sendMessage(message)
}
catch (IOException e) {
project.logger.error('Failed to push CF Discord webhook.')
}
}
}