forked from Siphalor/giftit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
184 lines (161 loc) · 5.25 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
172
173
174
175
176
177
178
179
180
181
182
183
184
plugins {
id 'fabric-loom' version '0.9-SNAPSHOT'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version '1.2.1'
id "com.github.breadmoirai.github-release" version "2.2.12"
}
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name
version = "${project.mod_version}+mc${project.minecraft_version}"
group = project.maven_group
minecraft {
}
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://jitpack.io/" }
maven {
name "Siphalor's Maven"
url "https://maven.siphalor.de/"
}
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_mappings}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}")
include(modImplementation("de.siphalor.tweed4:tweed4-base-$minecraft_major_version:1.3.1"))
include(modImplementation("de.siphalor.tweed4:tweed4-annotated-$minecraft_major_version:1.2.0"))
include(modImplementation("de.siphalor.tweed4:tweed4-data-$minecraft_major_version:1.2.0"))
include(modImplementation("de.siphalor.tweed4:tweed4-data-hjson-$minecraft_major_version:1.1.0"))
include(modImplementation("de.siphalor.tweed4:tweed4-tailor-screen-$minecraft_major_version:1.0.2"))
include(modImplementation("de.siphalor.tweed4:tweed4-tailor-coat-$minecraft_major_version:1.0.1"))
include(modImplementation("de.siphalor:coat-$minecraft_major_version:1.0.0-beta.12"))
modImplementation("com.terraformersmc:modmenu:2.0.10")
modRuntime("com.github.astei:lazydfu:master-SNAPSHOT")
}
processResources {
inputs.property "version", version
afterEvaluate {
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": version
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
}
}
// 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
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
jar {
from "LICENSE"
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = "${project.archives_base_name}-${project.minecraft_major_version}"
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
repositories {
if (project.hasProperty("siphalorMavenUser")) {
maven {
name = "Siphalor"
url = "https://maven.siphalor.de/upload.php"
credentials {
username = siphalorMavenUser
password = siphalorMavenPassword
}
}
}
}
}
// Mod sites
def getChangelog() {
def commits = 'git log -20 --format=oneline'.execute().text.readLines()
def versionCommit = null
for (commit in commits) {
if (commit.contains('Version')) {
versionCommit = commit.split(' ')[0]
break
}
}
if (versionCommit == null) {
return """## Version ${project.mod_version}
No changelog found!"""
}
return ('git log -1 --format=format:##%x20%s%n%n%b%nRelease%x20by%x20%an ' + versionCommit).execute().text.trim()
}
task uploadToModSites {
dependsOn build
group = "upload"
}
if (project.hasProperty("siphalorCurseForgeApi")) {
curseforge {
apiKey project.siphalorCurseForgeApi
project {
id = "323210"
releaseType = project.mod_release
changelogType = "markdown"
changelog = getChangelog()
addGameVersion("Fabric")
for (version in ((String) project.mod_mc_versions).split(";")) {
addGameVersion(version)
}
mainArtifact(remapJar) {
displayName = "[${project.mod_mc_version_specifier}] ${project.mod_version}"
}
}
}
uploadToModSites.finalizedBy(tasks.curseforge)
}
import com.modrinth.minotaur.TaskModrinthUpload
if (project.hasProperty("siphalorModrinthApi")) {
task modrinth (type: TaskModrinthUpload) {
group = "upload"
dependsOn(build)
token = project.siphalorModrinthApi
projectId = "oUy3C3HW"
versionNumber = version
versionName = "[${project.mod_mc_version_specifier}] ${project.mod_version}"
changelog = getChangelog()
uploadFile = remapJar
versionType = project.mod_release
for (version in ((String) project.mod_mc_versions).split(";")) {
addGameVersion(version)
}
addLoader("fabric")
}
uploadToModSites.finalizedBy(tasks.modrinth)
}
if (project.hasProperty("siphalorGitHubToken")) {
githubRelease {
token siphalorGitHubToken
targetCommitish.set(minecraft_major_version)
releaseName.set("Version $mod_version")
body.set(getChangelog())
releaseAssets remapJar.getArchiveFile()
prerelease.set(mod_release != "release")
overwrite.set(true)
}
uploadToModSites.finalizedBy(tasks.githubRelease)
}