-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
129 lines (109 loc) · 3.5 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
126
127
128
129
import org.jetbrains.gradle.ext.Gradle
plugins {
id 'java'
id 'java-library'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.35'
}
version = project.mod_version
group = project.maven_group
base {
archivesName = project.archives_base_name
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
sourceCompatibility = 8
targetCompatibility = 8
}
configurations {
embed
implementation.extendsFrom(embed)
}
minecraft {
mcVersion = '1.12.2' // stable-39
// Set username here, the UUID will be looked up automatically
username = 'Developer'
// Add various JVM arguments here for runtime
def args = ["-ea:${project.group}"]
if (project.coremod_plugin) {
args << '-Dfml.coreMods.load=' + coremod_plugin
}
args << "-Xms128m"
args << "-Xmx2048m"
extraRunJvmArguments.addAll(args)
// Include and use dependencies' Access Transformer files
useDependencyAccessTransformers = true
injectedTags.put('MOD_ID', project.mod_id)
injectedTags.put('MOD_VERSION', project.version)
}
tasks.injectTags.configure {
outputClassName.set("${project.group}.${project.mod_id}.Tags")
}
repositories {
mavenCentral()
}
dependencies {
compileOnlyApi 'org.jetbrains:annotations:24.1.0'
}
apply from: 'dependencies.gradle'
// Adds Access Transformer files to tasks
if (project.use_access_transformer.toBoolean()) {
for (File at : sourceSets.getByName("main").resources.files) {
if (at.name.toLowerCase().endsWith("_at.cfg")) {
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
}
}
}
processResources {
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
filesMatching(['mcmod.info', 'pack.mcmeta']) { fcd ->
fcd.expand (
'modid': project.mod_id,
'modname': project.mod_name,
'version': project.version,
'mcversion': project.minecraft.version
)
}
if (project.use_access_transformer.toBoolean()) {
rename '(.+_at.cfg)', 'META-INF/$1' // Make sure Access Transformer files are in META-INF folder
}
}
jar {
manifest {
def attribute_map = [:]
if (project.coremod_plugin) {
attribute_map['FMLCorePlugin'] = project.coremod_plugin
if (project.include_mod.toBoolean()) {
attribute_map['FMLCorePluginContainsFMLMod'] = true
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build"
}
}
if (project.use_access_transformer.toBoolean()) {
attribute_map['FMLAT'] = project.mod_id + '_at.cfg'
}
attributes(attribute_map)
}
from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} })
}
idea {
module {
inheritOutputDirs = true
}
project {
settings {
compiler.javac {
afterEvaluate {
javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
]
}
}
}
}
}
tasks.named("processIdeaSettings").configure {
dependsOn("injectTags")
}