forked from Devan-Kerman/ARRP
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
163 lines (143 loc) · 4.74 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
import com.modrinth.minotaur.dependencies.ModDependency
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT"
id "com.modrinth.minotaur" version "2.+" apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.github.breadmoirai.github-release" version "2.5.2" apply false
}
architectury {
minecraft = rootProject.minecraft_version
common((rootProject.enabled_platforms as String).split(","))
}
allprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
base {
archivesName = rootProject.archives_base_name
}
version = rootProject.mod_version + "-" + project.minecraft_version
group = rootProject.maven_group
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
repositories {
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 21
}
java {
withSourcesJar()
}
}
base {
archivesName = archivesName.get() + '-common'
}
subprojects {
apply plugin: "com.modrinth.minotaur"
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'com.github.breadmoirai.github-release'
apply plugin: "maven-publish"
base {
archivesName = archivesName.get() + "-" + project.name
}
loom {
runs {
client {
programArg "-username=Solid"
runDir = '../run'
}
server {
runDir = '../run'
}
}
}
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = base.archivesName.get()
from components.java
}
}
repositories {
maven {
url = rootProject.file('../mvn-repo').path
}
}
}
String platform = project.properties.getOrDefault 'loom.platform', 'fabric'
final String changelogContent = rootProject.file('changelog.md').text
modrinth {
println "Modrinth token: ${token.get()}"
projectId = 'JnrDtPAE'
versionNumber = "${rootProject.mod_version}-mc${rootProject.minecraft_version}-$platform"
versionType = 'release'
uploadFile = remapJar
gameVersions = List.of(project.supported_minecraft_versions.split(","))
loaders = [platform]
changelog = changelogContent
dependencies = platform.equals('fabric') ? [
new ModDependency('P7dR8mSH', 'required') // Fabric API
] : []
}
curseforge {
// The api key is store in my environment variable.
def getenv = System.getenv("CURSEFORGE_TOKEN")
println("CurseForge token: $getenv")
if (getenv) apiKey = getenv
project {
id = '618156'
changelog = changelogContent
releaseType = 'release'
gameVersionStrings.addAll project.supported_minecraft_versions.split(',')
addGameVersion platform.capitalize()
mainArtifact(remapJar) {
it.displayName = "brrp-$platform-${rootProject.mod_version}-mc${rootProject.minecraft_version}"
}
relations {
requiredDependency 'fabric-api'
}
afterEvaluate {
mainArtifact remapJar
uploadTask.dependsOn remapJar
}
}
options {
forgeGradleIntegration = false
}
}
githubRelease {
def getenv = System.getenv("GITHUB_TOKEN")
println "GitHub token: $getenv"
if (getenv) token getenv
owner = "SolidBlock-cn"
repo = "BRRP"
tagName = "v$project.mod_version"
targetCommitish = "1.21"
body = changelogContent
draft = true
prerelease = false
releaseAssets remapJar, remapSourcesJar
allowUploadToExisting = true
apiEndpoint = "https://api.github.com"
}
publish {
dependsOn tasks.modrinth, tasks.curseforge, tasks.githubRelease, tasks.publishToMavenLocal
}
}
loom {
mixin {
defaultRefmapName = "brrp-v1-common-refmap.json"
}
}
dependencies {
// 用于在 common 部分使用与 @Environment 有关的注解,以及 Fabric Data Generation API 中的 access widener。
modImplementation "net.fabricmc:fabric-loader:${rootProject.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
}