-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle
187 lines (163 loc) · 5.66 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* Adapted from The MIT License (MIT)
*
* Copyright (c) 2016-2021 DaPorkchop_
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
* provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
import java.util.stream.StreamSupport
buildscript {
repositories {
maven {
name = "DaPorkchop_"
url = "https://maven.daporkchop.net/"
}
maven {
name = 'SpongePowered'
url = 'https://repo.spongepowered.org/maven'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.0'
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
group = "net.daporkchop"
archivesBaseName = "pepsimod"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
configurations.all {
resolutionStrategy {
force("com.google.guava:guava:21.0")
}
}
minecraft {
version = "1.12.2-14.23.5.2836"
runDir = "run"
mappings = "stable_39"
makeObfSourceJar = false
coreMod = "net.daporkchop.pepsimod.asm.PepsimodMixinLoader"
def args = [
"-Dmixin.checks.interfaces=true",
"-Dmixin.debug.export=true",
"-Dmixin.debug.verbose=true",
"-Dmixin.hotSwap=true",
"-Xmx2G",
"-XX:+UseG1GC",
"-ea",
"-da:io.netty..."
]
clientJvmArgs += args
serverJvmArgs += args
}
version = "v11.1-" + project.minecraft.version
configurations {
relocate
shade
shade.extendsFrom relocate
compile.extendsFrom shade
}
repositories {
maven {
name = 'DaPorkchop_'
url = 'https://maven.daporkchop.net/'
}
maven {
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/maven/'
}
mavenCentral()
}
dependencies {
if ("true".equalsIgnoreCase(System.getProperty("idea.sync.active"))) {
//intellij is present - we don't want it to register mixin as an annotation processor, so we just add it as a standard dependency.
// if we don't do this, the intellij annotation processors will get totally screwed up
compile "org.spongepowered:mixin:0.8"
} else {
//register mixin as a standard annotation processor
shade("org.spongepowered:mixin:0.8") {
transitive = false
}
annotationProcessor "org.spongepowered:mixin:0.8:processor"
}
relocate "net.daporkchop.lib:common:0.5.4-SNAPSHOT"
}
processResources {
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"
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
mixin {
defaultObfuscationEnv notch
add sourceSets.main, "mixins.pepsimod.refmap.json"
}
shadowJar {
classifier = null
configurations = [project.configurations.shade]
}
build.dependsOn shadowJar
reobf {
shadowJar {
mappingType = 'SEARGE'
classpath = sourceSets.main.compileClasspath
}
}
class PepsiRelocate extends com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation {
@Override
List<Configuration> getConfigurations() {
return [project.configurations.relocate]
}
}
//relocate all shaded dependencies
task relocateShadowJar(type: PepsiRelocate) {
target = tasks.shadowJar
prefix = "net.daporkchop.pepsimod.dep"
}
shadowJar.dependsOn relocateShadowJar
jar {
manifest {
attributes(
"tweakClass": 'org.spongepowered.asm.launch.MixinTweaker',
"TweakOrder": 0,
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'net.daporkchop.pepsimod.asm.PepsimodMixinLoader',
'ForceLoadAsMod': 'true'
)
}
}
task preIntellijRuns {
doFirst {
StreamSupport.stream(configurations.compile.spliterator(), false).filter({
java.nio.file.Paths.get(it.absolutePath).getFileName().toString().matches("mixin-\\d+(\\.\\d+)*\\.jar")
}).findAny().ifPresent({
minecraft.clientJvmArgs += "-javaagent:" + it.absolutePath
minecraft.serverJvmArgs += "-javaagent:" + it.absolutePath
})
}
}
genIntellijRuns.dependsOn(preIntellijRuns)