-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
190 lines (163 loc) · 6.06 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
190 lines (163 loc) · 6.06 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import net.minecraftforge.gradle.common.util.RunConfig
import net.minecraftforge.gradle.userdev.DependencyManagementExtension
import net.minecraftforge.gradle.userdev.UserDevExtension
import java.text.SimpleDateFormat
import java.util.*
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
maven("https://maven.minecraftforge.net")
maven("https://maven.parchmentmc.org")
mavenCentral()
}
dependencies {
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = "5.1.+") {
isChanging = true
}
classpath("org.parchmentmc:librarian:1.+")
}
}
plugins {
kotlin("jvm") version "1.5.31"
kotlin("plugin.serialization") version "1.5.31"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("pl.allegro.tech.build.axion-release") version "1.13.6"
`maven-publish`
}
apply {
plugin("net.minecraftforge.gradle")
plugin("org.parchmentmc.librarian.forgegradle")
}
scmVersion {
tag(closureOf<pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig> {
prefix = "1.16.5-"
})
repository(closureOf<pl.allegro.tech.build.axion.release.domain.RepositoryConfig> {
directory = project.projectDir // repository location
})
repository(closureOf<pl.allegro.tech.build.axion.release.domain.RepositoryConfig> {
directory = project.projectDir // repository location
})
versionCreator = KotlinClosure2<String, pl.allegro.tech.build.axion.release.domain.scm.ScmPosition, String>(
{ version, _ -> "1.16.5-$version" }
)
}
version = scmVersion.version
//version = "1.16.5-1.1.0"
group = "com.github.teampolymer"
configure<BasePluginExtension> {
archivesName.set("polymer-scripts")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
println(
"Java: ${System.getProperty("java.version")} " +
"JVM: ${System.getProperty("java.vm.version")}(${System.getProperty("java.vendor")}) " +
"Arch: ${System.getProperty("os.arch")}"
)
configure<UserDevExtension> {
mappings("parchment", "2022.03.06-1.16.5")
accessTransformer(file("src/main/resources/META-INF/polymer_at.cfg"))
runs {
val runConfig = Action<RunConfig> {
workingDirectory = project.file("run").canonicalPath
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property("forge.logging.markers", "REGISTRIES")
property("forge.logging.console.level", "debug")
mods {
create("polymer-scripts") {
source(sourceSets["main"])
}
}
}
create("client", runConfig)
create("server", runConfig)
create("data") {
runConfig(this)
args(
"--mod",
"polymer-scripts",
"--all",
"--output",
file("src/generated/resources/"),
"--existing",
file("src/main/resources/")
)
}
}
}
//Include resources generated by data generators.
sourceSets.main {
resources { srcDir("src/generated/resources") }
}
repositories {
maven {
name = "Kotlin for Forge"
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
}
}
tasks.withType<Jar> {
archiveClassifier.set("raw")
}
val shadowJar = tasks.withType<ShadowJar> {
archiveClassifier.set("")
dependencies {
include(dependency("org.jetbrains.kotlin:kotlin-scripting-common"))
include(dependency("org.jetbrains.kotlin:kotlin-scripting-jvm-host"))
include(dependency("org.jetbrains.kotlin:kotlin-scripting-jvm"))
include(dependency("org.jetbrains.kotlin:kotlin-script-runtime"))
include(dependency("org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable"))
include(dependency("org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable"))
include(dependency("org.jetbrains.kotlin:kotlin-compiler-embeddable"))
include(dependency("org.jetbrains.kotlin:kotlin-daemon-embeddable"))
include(dependency("org.jetbrains.intellij.deps:trove4j"))
}
}
tasks.build.get().dependsOn(shadowJar)
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
"minecraft"("net.minecraftforge:forge:1.16.5-36.2.20")
// Use the latest version of KotlinForForge
implementation("thedarkcolour:kotlinforforge:1.16.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
api("org.jetbrains.kotlin:kotlin-scripting-common:1.6.10")
api("org.jetbrains.kotlin:kotlin-scripting-jvm:1.6.10")
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host:1.6.10")
val fg = project.extensions.getByType<DependencyManagementExtension>()
implementation(fg.deobf("com.github.teampolymer:polymer-core:latest"))
}
tasks.jar {
manifest {
val time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
attributes(
mapOf(
"Specification-Title" to "Polymer Scripts",
"Specification-Vendor" to "WarmthDawn",
"Specification-Version" to "1", // We are version 1 of ourselves
"Implementation-Title" to project.name,
"Implementation-Version" to "${project.version}",
"Implementation-Vendor" to "WarmthDawn",
"Implementation-Timestamp" to time
)
)
}
}
if (project == project.rootProject) {
tasks.jar.get().finalizedBy("reobfJar")
} else {
tasks.publish.get().finalizedBy("reobfJar")
}
publishing {
publications {
register("mavenJava", MavenPublication::class) {
artifact(tasks.jar.get())
}
}
}