-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
125 lines (123 loc) · 4.51 KB
/
build.gradle
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
buildscript{
dependencies{
classpath "org.spongepowered:mixingradle:0.7.+"
}
}
plugins{
id "eclipse"
id "idea"
id "maven-publish"
id "net.minecraftforge.gradle" version "[6.0.16,6.2)"
//id "org.spongepowered.mixin" version "[0.7-SNAPSHOT)"
}
apply plugin: "org.spongepowered.mixin"
version=mod_version
group=mod_group_id
base{
archivesName=mod_name
}
java.toolchain.languageVersion=JavaLanguageVersion.of(8)
print "Java: ${System.getProperty 'java.version'}, "
print "JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), "
println "Arch: ${System.getProperty 'os.arch'}"
minecraft{
mappings channel: mapping_channel,version: mapping_version
copyIdeResources=true
}
sourceSets.main.resources{
srcDir "src/generated/resources"
}
repositories{
// ForgeGradle automatically adds the Forge maven and Maven Central for you
maven{
url="https://repo.spongepowered.org/maven"
}
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir "libs"
// }
}
configurations{
embed
}
dependencies{
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
embed(compileOnly "org.spongepowered:mixin:${mixin_version}")
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
configurations.all{
resolutionStrategy{
cacheChangingModulesFor 0,"seconds"
}
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named("processResources",ProcessResources).configure{
var replaceProperties=[
minecraft_version: minecraft_version,
minecraft_version_range: minecraft_version_range,
forge_version: forge_version,
forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id,
mod_name: mod_name,
mod_license: mod_license,
mod_version: mod_version,
mod_authors: mod_authors,
mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(["mcmod.info","pack.mcmeta"]){
expand replaceProperties+[project:project]
}
}
mixin{
add sourceSets.main,"${mixin_refmap}"
config "${mixin_config}"
}
tasks.named("jar",Jar).configure{
from{
configurations.embed.collect{
it.isDirectory()?it:zipTree(it)
}
}
exclude "LICENSE.txt","META-INF/*.RSA","META-INF/*.SF"
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,
"Implementation-Timestamp" : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"TweakClass" : tweak_class,
"FMLCorePlugin" : fml_core_plugin,
"FMLCorePluginContainsFMLMod" : "true",
"ForceLoadAsMod" : "true"
])
}
finalizedBy "reobfJar"
}
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named("publish").configure{
// dependsOn "reobfJar"
// }
tasks.withType(JavaCompile).configureEach{
options.encoding="UTF-8"
}