-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.gradle
139 lines (123 loc) · 4.49 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
plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'fabric-loom' version '1.6+'
id "com.modrinth.minotaur" version "2.+"
}
version = project.mod_version
group = project.maven_group
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 5, 'minutes'
}
}
repositories {
mavenCentral()
maven {
name = "sonatype-oss-snapshots"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.bymartrixx.me'
}
maven { url "https://repo.erdbeerbaerlp.de/repository/maven-public/" }
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven { url "https://maven.nucleoid.xyz/" }
}
tasks.register('release')
tasks.release.group="publishing"
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation include("eu.pb4:placeholder-api:2.4.0-pre.1+1.20.5")
modCompileOnly "maven.modrinth:styled-chat:2.5.0+1.20.5"
// ========= Common =====================
modImplementation include('de.erdbeerbaerlp:dcintegration.common:3.0.7') {
changing = true
transitive = false
}
include(modImplementation('me.lucko:fabric-permissions-api:0.2-SNAPSHOT'))
}
processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
}
remapJar{
archiveClassifier = project.minecraft_version
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
//Curseforge publishing
curseforge {
if (project.hasProperty('curseforge.apikey')) { // $GRADLE_USER_HOME/gradle.properties
apiKey = project.getProperty("curseforge.apikey")
project {
id = '493679'
changelog = project.changelog
releaseType = project.releaseType.toLowerCase()
addGameVersion "${project.minecraft_version}"
mainArtifact(remapJar) {
displayName = "DiscordIntegration-Fabric $version (MC ${project.minecraft_version})"
}
relations {
requiredDependency 'fabric-api'
tool 'no-chat-reports'
}
}
}
}
modrinth{
if (project.hasProperty('modrinth.apikey')) { // $GRADLE_USER_HOME/gradle.properties
token = project.getProperty("modrinth.apikey") // Use an environment property!
projectId = 'rbJ7eS5V'
versionNumber = version+"-${project.minecraft_version}"
versionName = "DiscordIntegration-Fabric $version (MC ${project.minecraft_version})"
uploadFile = remapJar
changelog = project.changelog
gameVersions = ["${project.minecraft_version}"]
loaders = ['fabric']
dependencies {
required.project "fabric-api"
optional.project "no-chat-reports"
}
versionType = project.releaseType.toUpperCase()
}
}
tasks.release.dependsOn(tasks.build, tasks.curseforge,tasks.modrinth)