generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
162 lines (138 loc) · 4.64 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
plugins {
id 'maven-publish'
id 'java-library'
alias libs.plugins.fabric.loom
alias libs.plugins.minotaur
alias libs.plugins.cursegradle
alias libs.plugins.loom.quiltflower
}
archivesBaseName = project.archives_base_name
group = project.maven_group
boolean isBuild = System.getenv('GITHUB_WORKFLOW') == 'build'
version = !isBuild ? project.mod_version : "${project.mod_version}+build.${System.getenv('GITHUB_RUN_NUMBER')}"
allprojects {
apply plugin: 'fabric-loom'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
maven {
name = 'Quilt'
url = 'https://maven.quiltmc.org/repository/release'
}
maven {
name = 'Quilt Snapshots'
url = 'https://maven.quiltmc.org/repository/snapshot'
}
maven {
name 'FabricMC'
url 'https://maven.fabricmc.net'
}
}
dependencies {
//to change the versions see the libs.versions.toml file
minecraft libs.minecraft
mappings variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' }
modImplementation libs.fabric.loader
modImplementation libs.fabric.api
}
processResources {
inputs.property 'version', rootProject.version
filesMatching('fabric.mod.json') {
expand 'version': rootProject.version
}
}
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'
it.options.release = 17
}
java {
// 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.
withSourcesJar()
}
jar {
from('LICENSE') {
rename { "${it}_${project.archivesBaseName}" }
}
}
quiltflower {
addToRuntimeClasspath.set(true)
}
}
subprojects {
apply plugin: 'fabric-loom'
apply plugin: 'maven-publish'
apply plugin: 'java-library'
version = rootProject.version
}
repositories {
maven {
name 'JitPack'
url 'https://jitpack.io'
}
maven {
url 'https://maven.nucleoid.xyz/'
}
}
rootProject.processResources.dependsOn(project(':api').processResources)
dependencies {
// Add subprojects as dependency of root project
implementation project(path: ':api', configuration: 'namedElements')
include project(':api')
// FabricPlaceholderApi
modImplementation libs.placeholder.api
include libs.placeholder.api
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
mavenLocal()
}
}
modrinth {
token = project.hasProperty('modrinth_token') ? project.property('modrinth_token') : System.getenv('MODRINTH_TOKEN')
projectId = 'NLx6lJPJ'
versionNumber = project.version
versionName = "Player Events ${project.version} for Minecraft 1.20.1"
uploadFile = remapJar
changelog = "A changelog can be found at https://github.com/ByMartrixx/player-events/releases/tag/${version}"
gameVersions = ['1.20.1']
loaders = ['fabric', 'quilt']
additionalFiles = [project(':api').remapJar]
}
curseforge {
if (project.hasProperty('curse_api_key') || System.getenv('CURSE_API_KEY') != null) {
apiKey = project.hasProperty('curse_api_key') ? project.property('curse_api_key') : System.getenv('CURSE_API_KEY')
}
project {
id = '404348'
changelog = "A changelog can be found at https://github.com/ByMartrixx/player-events/releases/tag/${version}"
releaseType = 'release'
addGameVersion '1.20.1'
addGameVersion 'Fabric'
addGameVersion 'Quilt'
mainArtifact(remapJar) {
displayName = "Player Events ${version} for Minecraft 1.20.1"
}
addArtifact(project(':api').remapJar) {
displayName = "Player Events API ${version} for Minecraft 1.20.1"
}
afterEvaluate {
uploadTask.dependsOn('remapJar')
uploadTask.dependsOn('api:remapJar')
}
}
options {
forgeGradleIntegration = false
}
}
publish.finalizedBy tasks.curseforge, tasks.modrinth, project(':api').tasks.publish