Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
88 lines (79 loc) · 2.52 KB
/
Copy pathbuild.gradle
File metadata and controls
88 lines (79 loc) · 2.52 KB
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
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
// 依存側MODの開発者がIDEでソースを参照できるようにソースjarも出力する
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
minecraft {
mappings channel: 'official', version: minecraft_version
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods { nplib { source sourceSets.main } }
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods { nplib { source sourceSets.main } }
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
}
tasks.named('processResources', ProcessResources).configure {
def props = [
minecraft_version_range: minecraft_version_range,
forge_version_range : forge_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_version : mod_version,
mod_authors : mod_authors,
mod_license : mod_license,
]
inputs.properties props
filesMatching('META-INF/mods.toml') {
expand props
}
}
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1',
'Implementation-Title' : project.name,
'Implementation-Version': project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
])
}
finalizedBy 'reobfJar'
}
// `gradlew publishToMavenLocal` で ~/.m2 に公開し、依存側MODから
// implementation fg.deobf("com.noplancoders:nplib:<version>") で参照できるようにする
publishing {
publications {
register('mavenJava', MavenPublication) {
artifactId = mod_id
artifact jar
artifact sourcesJar
}
}
}