-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
181 lines (164 loc) · 5.89 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
import java.text.SimpleDateFormat
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.2.+" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
}
architectury {
minecraft = rootProject.minecraft_version
}
subprojects {
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
version = minecraft_version + "-" + mod_version
group = rootProject.maven_group
repositories {
maven {
url "https://www.cursemaven.com"
}
maven {
url = "https://maven.resourcefulbees.com/repository/maven-public/"
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven {
name = 'GitHubPackages'
url uri("$mod_mvngit_source")
credentials{
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.token") ?: System.getenv("TOKEN")
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
exclusiveContent {
forRepository {
maven {
name = "CTM"
url = "https://maven.tterrag.com/"
}
}
filter {
includeGroup "team.chisel.ctm"
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}
java {
withSourcesJar()
}
}
subprojects {
apply plugin: "me.shedaniel.unified-publishing"
ext {
releaseChangelog = {
def dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm")
dateFormat.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 = dateFormat.format(new Date())
def changes = new StringBuilder()
changes << "## " + stage.capitalize() + " $version \nUpdated at **$time**. \n**Changelog** "
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")) {
def lines = processedLine.split(" -")
changes << "\n**${lines[0]}** "
lines[0] = ""
lines.each {s-> changes << "\n-" + s + " "}
}
}
changes << "\n[Click here for complete changelog]($mod_source/commits/$branch)"
proc.waitFor()
return changes.toString()
}
}
task renameJarForPublication(type: Zip, dependsOn: remapJar) {
from remapJar.archiveFile.map { zipTree(it) }
archiveExtension = "jar"
metadataCharset "UTF-8"
destinationDirectory = base.libsDirectory
archiveClassifier = project.name
}
assemble.dependsOn renameJarForPublication
var modPlatformName = project.name.capitalize()
unifiedPublishing {
project {
def isFabric = project.name == "fabric"
displayName = "Factocrafty [$modPlatformName] $project.version"
releaseType = "$stage"
changelog = releaseChangelog()
gameVersions = ["1.20","$minecraft_version"]
gameLoaders = ["$project.name"]
if (isFabric) gameLoaders.addAll "quilt"
mainPublication renameJarForPublication
var CURSE_API_KEY = project.findProperty("CURSE_API_KEY") ?: System.getenv("CURSE_API_KEY")
if (CURSE_API_KEY != null) {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll(["Java 17", "Java 18"])
relations{
depends "architectury-api"
if (isFabric) depends "fabric-api"
depends "factory-api"
}
}
}
var MODRINTH_TOKEN = project.findProperty("gpr.token") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version+$project.name"
relations{
depends "architectury-api"
if (isFabric) depends "fabric-api"
depends "factory-api"
}
}
}
}
}
}