-
Notifications
You must be signed in to change notification settings - Fork 65
/
build.gradle
168 lines (144 loc) · 4.96 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
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id "com.matthewprenger.cursegradle" version "1.4.0"
}
apply {
// "Simple" fix for M1 (Apple Silicon) macs in the dev environment... All thanks to @mezz
from "https://raw.githubusercontent.com/mezz/JustEnoughItems/1.18/Forge/buildtools/AppleSiliconSupport.gradle"
}
def ENV = System.getenv()
version = "${version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${minecraft_version}"
group = 'com.direwolf20'
archivesBaseName = "buildinggadgets"
def forge_major = forge_version.tokenize('.')[0]
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'official', version: "${minecraft_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
buildinggadgets {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
buildinggadgets {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'buildinggadgets', '--all', '--output', file('src/generated/resources/')
mods {
buildinggadgets {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven {
url = "https://modmaven.dev/"
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
}
processResources {
// This might be the wrong way of doing it but basically this file doesn't always get updated
// for some reason so I'm deleting it before it's generated again
def path = new File("${project.buildDir}/resources/main/META-INF/mods.toml")
if (path.exists()) {
path.delete()
}
exclude '.cache'
inputs.property "version", project.version
filesMatching("META-INF/mods.toml") {
expand "version": project.version,
"forgeversion": project.forge_version,
"forgeshortversion": project.forge_version.split("\\.")[0],
"mcversion": project.minecraft_version
}
}
jar {
finalizedBy 'reobfJar'
manifest {
attributes(["Specification-Title" : "BuildingGadgets",
"Specification-Vendor" : "Direwolf20",
"Specification-Version" : forge_major, // We are version 1 of the modlauncher specification
"Implementation-Title" : project.archivesBaseName,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "Direwolf20",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")])
}
}
java {
withSourcesJar()
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier 'deobf'
}
artifacts {
archives deobfJar
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifactId = project.archivesBaseName.toLowerCase()
artifact(deobfJar) {
classifier 'deobf'
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/Direwolf20-MC/BuildingGadgets"
credentials {
username = ENV.GITHUB_ACTOR
password = ENV.GITHUB_TOKEN
}
}
}
}
if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = "298187"
releaseType = "release"
addGameVersion "${minecraft_version}"
addGameVersion "Forge"
addGameVersion "Java 17"
mainArtifact(jar) {
relations {
optionalDependency 'charging-gadgets'
}
}
changelog = file('CHANGELOG.md')
changelogType = 'markdown'
}
}
}