forked from symt/BazaarNotifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
139 lines (117 loc) · 3.7 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
import de.undercouch.gradle.tasks.download.Download
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
idea
java
id("gg.essential.loom") version "0.10.0.+"
id("dev.architectury.architectury-pack200") version "0.1.3"
id("de.undercouch.download").version("5.3.0")
id("com.github.johnrengelman.shadow") version "7.1.2"
}
group = "dev.meyi.bazaarnotifier"
version = "1.7.0-beta1"
val mod_id = "bazaarnotifier"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
loom {
launchConfigs.named("client") {
arg("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker")
}
log4jConfigs.from(file("log4j2.xml"))
forge {
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
}
}
sourceSets.main {
output.setResourcesDir(file("$buildDir/classes/java/main"))
}
val shade: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
repositories {
mavenCentral()
maven("https://repo.spongepowered.org/maven/")
maven("https://repo.polyfrost.cc/releases")
}
dependencies {
minecraft("com.mojang:minecraft:1.8.9")
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")
modCompileOnly("cc.polyfrost:oneconfig-1.8.9-forge:0.2.0-alpha+")
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
}
val resourcesFile = "src/main/resources/resources.json"
val resourcesURL = "https://raw.githubusercontent.com/symt/BazaarNotifier/resources/resources.json"
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
inputs.property("version", project.version)
inputs.property("mcversion", "1.8.9")
from(sourceSets["main"].resources.srcDirs) {
include("mcmod.info")
expand("version" to project.version, "mcversion" to "1.8.9")
}
from(sourceSets["main"].resources.srcDirs) {
exclude("mcmod.info")
}
dependsOn("retrieveResources")
finalizedBy("destroyResources")
outputs.upToDateWhen { false }
}
task<DefaultTask>("destroyResources") {
doLast {
if (File(resourcesFile).exists()) {
project.delete(files(resourcesFile))
}
}
outputs.upToDateWhen { false }
}
task<DefaultTask>("retrieveResources") {
val dest = File(resourcesFile)
if (dest.exists()) {
project.delete(files(resourcesFile))
}
task<Download>("download-task") {
src(resourcesURL)
dest(resourcesFile)
}
dependsOn("download-task")
}
tasks{
withType(JavaCompile::class) {
options.encoding = "UTF-8"
}
withType(Jar::class) {
manifest.attributes.run {
this["FMLCorePluginContainsFMLMod"] = "true"
this["ForceLoadAsMod"] = "true"
}
named<ShadowJar>("shadowJar") {
archiveClassifier.set("dev")
configurations = listOf(shade)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
remapJar {
input.set(shadowJar.get().archiveFile)
archiveClassifier.set("")
}
jar {
manifest {
attributes(
mapOf(
"ModSide" to "CLIENT",
"ForceLoadAsMod" to true,
"TweakOrder" to "0",
"TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker"
)
)
}
dependsOn(shadowJar)
archiveClassifier.set("")
enabled = false
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
}