-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
96 lines (74 loc) · 2.73 KB
/
build.gradle.kts
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
plugins {
id( "fabric-loom" )
kotlin( "jvm" ) version( System.getProperty( "kotlin_version" ) )
kotlin( "plugin.serialization" ) version( System.getProperty( "kotlin_version" ) )
}
base {
archivesName.set( project.extra[ "archives_base_name" ] as String )
}
version = project.extra[ "mod_version" ] as String
group = project.extra[ "maven_group" ] as String
repositories {}
dependencies {
// Minecraft
minecraft( "com.mojang", "minecraft", project.extra[ "minecraft_version" ] as String )
// Minecraft source mappings - https://github.com/FabricMC/yarn
mappings( "net.fabricmc", "yarn", project.extra[ "yarn_mappings" ] as String, null, "v2" )
// Fabric Loader - https://github.com/FabricMC/fabric-loader
modImplementation( "net.fabricmc", "fabric-loader", project.extra[ "loader_version" ] as String )
// Fabric API - https://github.com/FabricMC/fabric
modImplementation( "net.fabricmc.fabric-api", "fabric-api", project.extra[ "fabric_version" ] as String )
// Kotlin support for Fabric - https://github.com/FabricMC/fabric-language-kotlin
modImplementation( "net.fabricmc", "fabric-language-kotlin", project.extra[ "fabric_language_kotlin_version" ] as String )
// Kotlin JSON serialization
implementation( "org.jetbrains.kotlinx", "kotlinx-serialization-json", project.extra[ "kotlinx_serialization_json_version" ] as String )
}
tasks {
val javaVersion = JavaVersion.toVersion( ( project.extra[ "java_version" ] as String ).toInt() )
withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release.set( javaVersion.toString().toInt() )
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = javaVersion.toString()
}
}
jar {
from( "LICENSE.txt" ) {
rename { "${ it }_${ base.archivesName.get() }.txt" }
}
}
processResources {
// Metadata
filesMatching( "fabric.mod.json" ) {
expand( mutableMapOf(
"version" to project.extra[ "mod_version" ] as String,
"java" to project.extra[ "java_version" ] as String,
"minecraft" to project.extra[ "minecraft_version" ] as String,
"fabricloader" to project.extra[ "loader_version" ] as String,
"fabric_api" to project.extra[ "fabric_version" ] as String,
"fabric_language_kotlin" to project.extra[ "fabric_language_kotlin_version" ] as String
) )
}
// Mixins
filesMatching( "*.mixins.json" ) {
expand( mutableMapOf(
"java" to project.extra[ "java_version" ] as String
) )
}
}
java {
toolchain {
languageVersion.set( JavaLanguageVersion.of( javaVersion.toString() ) )
}
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
}
test {
useJUnitPlatform()
}
}