This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
152 lines (135 loc) · 4.27 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
plugins {
id "fabric-loom" version "1.0-SNAPSHOT"
id "com.modrinth.minotaur" version "2.+"
id "com.matthewprenger.cursegradle" version "1.4.+"
id "com.github.breadmoirai.github-release" version "2.4.+"
}
archivesBaseName = modid
version = "${minecraft_version}-${mod_version}"
group = project.group
repositories {
maven { url = "https://jitpack.io" }
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
// MixinSquared dependency
include(api(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.1.1")))
}
def resourceTarget = "fabric.mod.json"
def intoTargets = ["$rootDir/bin/main/"]
def replaceProperties = [
modid: modid,
modid_kebab: modid_kebab,
mod_title: mod_title,
minecraft_version: minecraft_version,
mod_version: mod_version,
loader_version: loader_version,
group: group,
author: author,
github_user: github_user
]
processResources {
inputs.properties replaceProperties
replaceProperties.put "project", project
filesMatching(resourceTarget) {
expand replaceProperties
}
intoTargets.each { target ->
if (file(target).exists()) {
copy {
from(sourceSets.main.resources) {
include resourceTarget
expand replaceProperties
}
into target
}
}
}
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
jar {
manifest {
attributes([
"Specification-Title" : project.mod_title,
"Specification-Version" : project.mod_version,
"Specification-Vendor" : project.author,
"Implementation-Title" : project.mod_title,
"Implementation-Version" : project.mod_version,
"Implementation-Vendor" : project.author,
"Implementation-Vendor-Id": project.group,
"Implementation-URL" : "https://github.com/${github_user}/${modid_kebab}/tree/${minecraft_version}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}
def changelog_body = "See [Changelog](https://github.com/${github_user}/${modid_kebab}/blob/master/CHANGELOG.md#${minecraft_version.replaceAll('\\.', '')}-${mod_version.replaceAll('\\.', '')}---${new Date().format("yyyyMMdd")})."
file("./api-keys.properties").withReader {
Properties props = new Properties()
props.load(it)
project.api_keys = props
}
curseforge {
apiKey = api_keys.curseforge
project {
id = curseforge_id
changelogType = "markdown"
changelog = changelog_body
releaseType = "release"
addGameVersion loader
addGameVersion minecraft_version
mainArtifact(remapJar) {
displayName = "[${minecraft_version}] ${mod_title} v${mod_version}"
relations {
requiredDependency "fabric-api"
}
}
}
options {
forgeGradleIntegration = false
}
}
modrinth {
token = api_keys.modrinth
projectId = modid_kebab
versionNumber = mod_version
versionName = "[${minecraft_version}] ${mod_title} v${mod_version}"
changelog = changelog_body
uploadFile = remapJar
versionType = "release"
gameVersions = [minecraft_version]
loaders = [loader.toLowerCase()]
dependencies {
required.project "fabric-api"
}
}
githubRelease {
token api_keys.github
owner github_user
repo modid_kebab
tagName "v${minecraft_version}-${mod_version}"
targetCommitish minecraft_version
releaseName "v${minecraft_version}-${mod_version}"
generateReleaseNotes false
body changelog_body
draft true
prerelease false
releaseAssets remapJar
// Setting this to true will allow this plugin to upload artifacts to a release if it found an existing one. If overwrite is set to true, this option is ignored.
allowUploadToExisting true
// By default false; if set to true, will delete an existing release with the same tag and name
// overwrite true
// by default false; you can use this to see what actions would be taken without making a release
// dryRun false
}