-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
153 lines (126 loc) · 4.34 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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.+'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
// Add version to the jar name
version project.version
// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
// Generate sources jar when building and publishing
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.fork = true
options.forkOptions.jvmArgs += '-Xmx4G'
}
minecraft {
mcVersion = '1.12.2'
username = 'DevPanda'
extraRunJvmArguments.addAll('-Xmx4G', '-Xms4G', '-Dforge.logging.console.level=debug', '-Dmixin.hotSwap=true', '-Dmixin.checks.interfaces=true', '-Dmixin.debug.export=true')
injectedTags.put('ID', project.id)
injectedTags.put('VERSION', project.version)
}
// Generate a my.project.Tags class with the version number as a field
tasks.injectTags.configure {
outputClassName.set("com.paneedah.${project.id}.Tags")
}
configurations {
// Define a configuration to download and attach sources
sources
// Define a configuration to include embedded dependencies into the jar
implementation
compile.extendsFrom(embed)
}
repositories {
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name 'Cleanroom'
url 'https://maven.cleanroommc.com'
}
}
dependencies {
implementation 'org.json:json:20230227'
embed 'org.json:json:20230227'
implementation rfg.deobf("curse.maven:modern-warfare-cubed-836353:4556604")
String mixin = modUtils.enableMixins('zone.rong:mixinbooter:8.3', "mixins.${project.id}.refmap.json")
api (mixin) { transitive = false }
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
annotationProcessor 'com.google.guava:guava:24.1.1-jre'
annotationProcessor 'com.google.code.gson:gson:2.8.6'
annotationProcessor (mixin) { transitive = false }
}
def at = project.files("src/main/resources/META-INF/${project.id}_at.cfg")
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
// Replace version and id in `mcmod.info`
processResources {
inputs.property 'id', project.id
inputs.property 'version', project.version
filesMatching(['mcmod.info', 'pack.mcmeta']) { fcd ->
include 'mcmod.info'
fcd.expand (
'id': project.id,
'version': project.version
)
}
}
jar {
manifest.attributes([
'ModSide': 'BOTH',
'FMLAT': "${project.id}_at.cfg",
'FMLCorePlugin': "com.paneedah.pwem.asm.FMLPlugin",
'FMLCorePluginContainsFMLMod': 'true',
'ForceLoadAsMod': 'true'
])
// Add all embedded dependencies into the jar
from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} })
}
idea {
module { inheritOutputDirs = true }
module { excludeDirs = [file('.github'), file('.gradle'), file('.idea'), file('build'), file('gradle'), file('run')] }
project { settings {
runConfigurations {
'Client'(Gradle) {
taskNames = ['runClient']
}
'Server'(Gradle) {
taskNames = ['runServer']
}
'Obfuscated Client'(Gradle) {
taskNames = ['runObfClient']
}
'Obfuscated Server'(Gradle) {
taskNames = ['runObfServer']
}
'Vanilla Client'(Gradle) {
taskNames = ['runVanillaClient']
}
'Vanilla Server'(Gradle) {
taskNames = ['runVanillaServer']
}
}
compiler.javac {
afterEvaluate {
javacAdditionalOptions = '-encoding utf8'
moduleJavacAdditionalOptions = [ (project.id + '.main'): tasks.compileJava.options.compilerArgs.collect { ''' + it + ''' }.join(' ') ]
}
}
}}
}
tasks.named('processIdeaSettings').configure {
dependsOn('injectTags')
}