This repository has been archived by the owner on Jul 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
170 lines (139 loc) · 4.95 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
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
169
170
import net.minecraftforge.gradle.common.util.ModConfig
import net.minecraftforge.gradle.common.util.RunConfig
import net.minecraftforge.gradle.userdev.UserDevExtension
import java.time.Instant
import java.time.format.DateTimeFormatter
buildscript {
repositories {
maven { url = uri("https://maven.minecraftforge.net/") }
jcenter()
mavenCentral()
}
dependencies {
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = "4.1.+")
}
}
plugins {
idea
kotlin("jvm") version "latest.release"
}
apply(plugin = "net.minecraftforge.gradle")
// Config -> Minecraft
val forgeVersion: String by extra
val minecraftVersion: String by extra
val lootTablesVersion: String by extra
// Config -> Mod
val modId: String by extra
val modVersion: String by extra
// Default Mod Information
version = modVersion
group = "com.theonlytails.rubymod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
base.archivesBaseName = "rubymod"
// Sets the toolchain to compile against OpenJDK 8
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
}
}
configure<UserDevExtension> {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings("official", minecraftVersion)
// Exposes fields, methods, constructors, and classes for use within the mod.
// Uncomment this to enable.
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs(closureOf<NamedDomainObjectContainer<RunConfig>> {
create("client") {
workingDirectory(file("run"))
taskName("client")
// Recommended logging data for a userdev environment
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
// Recommended logging level for the console
property("forge.logging.console.level", "debug")
mods(closureOf<NamedDomainObjectContainer<ModConfig>> {
create(modId) {
source(sourceSets["main"])
}
})
}
create("server") {
workingDirectory(file("run"))
taskName("server")
// Recommended logging data for a userdev environment
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
// Recommended logging level for the console
property("forge.logging.console.level", "debug")
mods(closureOf<NamedDomainObjectContainer<ModConfig>> {
create(modId) {
source(sourceSets["main"])
}
})
}
create("data") {
workingDirectory(file("run"))
taskName("datagen")
// Recommended logging data for a userdev environment
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
// Recommended logging level for the console
property("forge.logging.console.level", "debug")
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args(
"--mod",
modId,
"--all",
"--output",
file("src/generated/resources/"),
"--existing",
file("src/main/resources/")
)
mods(closureOf<NamedDomainObjectContainer<ModConfig>> {
create(modId) {
source(sourceSets["main"])
}
})
}
})
}
// Include resources generated by data generators
sourceSets["main"].resources { srcDir("src/generated/resources") }
dependencies {
// Specify the version of Minecraft to use, If this is any group other than "net.minecraft" it is assumed
// that the dep is a ForgeGradle "patcher" dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
"minecraft"(group = "net.minecraftforge", name = "forge", version = "$minecraftVersion-$forgeVersion")
// Specify that the standard library of Kotlin that should be used to compile
implementation(group = "thedarkcolour", name = "kotlinforforge", version = "latest.release")
implementation(group = "com.theonlytails", name = "loottables", version = "0.2.13")
}
// Repositories to add Kotlin
repositories {
mavenCentral()
maven {
name = "Kotlin for Forge"
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
}
}
tasks {
named<Jar>("jar") {
// Example for how to set properties within the manifest for reading by runtime
manifest {
attributes(
"Specification-Title" to "RubyMod",
"Specification-Vendor" to "TheOnlyTails",
"Specification-Version" to project.version,
"Implementation-Title" to "RubyMod",
"Implementation-Vendor" to "TheOnlyTails",
"Implementation-Version" to project.version,
"Implementation-Timestamp" to DateTimeFormatter.ISO_INSTANT.format(Instant.now())
)
}
// This is the preferred method to reobfuscate your jar file
finalizedBy("reobfJar")
}
}