-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
140 lines (121 loc) · 4.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
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "2.+"
}
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import com.modrinth.minotaur.dependencies.ModDependency
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
base {
archivesName = project.modName
}
version = project.modVersion
group = project.mavenGroup
repositories {
maven { url "https://cfa2.cursemaven.com" }
maven { url "https://libs.azuredoom.com:4443/mods" }
maven { url "https://dl.cloudsmith.io/public/tslat/sbl/maven/" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://api.modrinth.com/maven" }
maven { url "https://maven.terraformersmc.com" }
maven { url "https://maven.parchmentmc.org" }
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraftVersion}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabricVersion}"
modImplementation "mod.azure.azurelib:azurelib-fabric-${project.minecraftVersion}:${project.azurelibVersion}"
modImplementation "com.terraformersmc:modmenu:${project.modmenuVersion}"
modImplementation "net.tslat.smartbrainlib:SmartBrainLib-fabric-${project.minecraftVersion}:${project.sblVersion}"
modImplementation "net.tslat.smartbrainlib:SmartBrainLib-common-${project.minecraftVersion}:${project.sblVersion}"
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
java {
withSourcesJar()
}
loom {
accessWidenerPath = file("src/main/resources/darkwaters.accesswidener")
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
processResources {
doLast {
def jsonMinifyStart = System.currentTimeMillis()
def jsonMinified = 0
def jsonBytesSaved = 0
fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
File file = it
jsonMinified++
def oldLength = file.length()
file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
jsonBytesSaved += oldLength - file.length()
}
println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
}
}
if (file('key.properties').exists()) {
curseforge {
def curseProp = new Properties()
File secretPropsFile = file("key.properties")
curseProp.load(secretPropsFile.newInputStream())
project {
apiKey = curseProp.getProperty('curseKey')
id = "${curseID}"
releaseType = "${releaseStatus}"
changelogType = 'text'
changelog = file('CHANGELOG.txt')
addGameVersion("${project.minecraftVersion}")
addGameVersion("Fabric")
addGameVersion("Java 17")
relations {
requiredDependency 'fabric-api'
requiredDependency 'azurelib'
requiredDependency 'smartbrainlib'
}
mainArtifact(remapJar)
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
options {
//debug = true
forgeGradleIntegration = false
}
}
}
if (file('key.properties').exists()) {
modrinth {
def modrinthProp = new Properties()
File secretPropsFile = file("key.properties")
modrinthProp.load(secretPropsFile.newInputStream())
token = modrinthProp.getProperty('modrinthKey')
projectId = project.modrinthID
versionNumber = project.modVersion
uploadFile = remapJar
changelog = rootProject.file("changelog.txt").text
gameVersions = [project.minecraftVersion]
loaders = ['fabric','quilt']
dependencies {
required.project "azurelib"
required.project "smartbrainlib"
required.project "fabric-api"
optional.project "modmenu"
}
}
}