-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
141 lines (121 loc) · 4.67 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
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') {
changing = true
}
}
}
apply plugin: 'forge'
version = "1.0"
group = "com.mrfuzzihead.fuzzitweaks"
archivesBaseName = "fuzzitweaks"
targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_8
minecraft {
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "eclipse"
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
//minecraft "net.minecraftforge:forge:1.7.10-10.13.4.1614"
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
//##########################################################################################################
//######################################## Mixin Part ################################################
//##########################################################################################################
/**
* The name of your mixin config. Should match the name of mixin config file, which you placed in src/main/resources/
*/
def yourMixinConfig = 'mixin.fuzzitweaks.json'
/**
* The file with this name will be generated during build. Should match the remap value inside your src/main/resources/*yourMixinConfig*
*/
def refMapForYourConfig = 'mixin.fuzzitweaks.refmap.json'
/**
* Relative path to the new annotation processor.
* You should download it (https://github.com/TimeConqueror/SpongeMixins/raw/master/mixin-0.8-SNAPSHOT.jar) and then place to the project folder.
* You may also place it in the inner folders, only thing you should to do is to provide right RELATIVE path.
*/
def relativePathToMixinAP = 'mixin-0.8-SNAPSHOT.jar'
repositories {
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}
dependencies {
compile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
}
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + refMapForYourConfig
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
jar {
from refMap
manifest {
attributes([
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
'MixinConfigs': yourMixinConfig,
'FMLCorePluginContainsFMLMod': 'true',
"ForceLoadAsMod": true
])
}
}
reobf {
addExtraSrgFile mixinSrg
}
afterEvaluate {
def fixedRelPathToAP = relativePathToMixinAP
if(fixedRelPathToAP.startsWith('./') || fixedRelPathToAP.startsWith('.\\')){
fixedRelPathToAP = fixedRelPathToAP.substring(2)
} else if(fixedRelPathToAP.startsWith('/') || fixedRelPathToAP.startsWith('\\')){
fixedRelPathToAP = fixedRelPathToAP.substring(1)
}
tasks.compileJava {
println "Path: " + projectDir.absolutePath
options.compilerArgs += [
// There's a bug in the AnnotationProcessor for 0.7.11 that will generate the annotations pointing to the parent class instead of subclass
// resulting in the mixin not being applied. This is fixed in 0.8, however 0.8 needs guava > 21.0, and minecraft ships with 17.0.
// So as a hacky workaround... ship with 0.7.11, but use the AP from 0.8 for compiling
"-processorpath", projectDir.absolutePath + '/' + fixedRelPathToAP,
"-processor", "org.spongepowered.tools.obfuscation.MixinObfuscationProcessorInjection,org.spongepowered.tools.obfuscation.MixinObfuscationProcessorTargets",
"-Xlint:-sunapi", "-XDenableSunApiLintControl", "-XDignore.symbol.file",
"-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${mixinSrg}", "-AoutRefMapFile=${refMap}"
]
}
}
sourceSets {
main {
output.resourcesDir = output.classesDir
ext.refMap = refMapForYourConfig
}
}