-
Notifications
You must be signed in to change notification settings - Fork 3
/
meddle.gradle
159 lines (119 loc) · 4.75 KB
/
meddle.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
import java.nio.file.CopyOption
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
/*apply plugin: MeddlePlugin
class MeddlePlugin implements Plugin<Project> {
void apply(Project project) {
project.extensions.create("meddle", MeddlePluginExtension)
}
}*/
configurations {
provided
getmc
}
sourceSets {
main { compileClasspath += configurations.provided }
}
project.extensions.add("meddle", MeddlePluginExtension)
project.extensions.add("dynamicmappings", MeddlePluginExtension)
project.extensions.add("meddleapi", MeddlePluginExtension)
project.extensions.add("minecraft", MeddlePluginExtension)
project.extensions.add("greddle", GreddlePluginExtension)
class MeddlePluginExtension {
String version
String location = null
}
class GreddlePluginExtension {
String cacheDir = 'cache/'
}
project.ext {
mcJarFilename = "${->project.minecraft.version}.jar"
remappedJarFilename = "remapped-${->project.minecraft.version}.jar"
}
repositories {
maven {
//mavenCentral()
url "http://fybertech.net/maven/"
//url "https://libraries.minecraft.net/"
}
}
dependencies {
getmc "net.fybertech:greddle:1.0"
compile fileTree(dir:'cache/libraries', include: '*.jar')
}
afterEvaluate {
println 'Using Minecraft ' + project.minecraft.version
println 'Using Meddle v' + project.meddle.version
println 'Using DynamicMappings ' + project.dynamicmappings.version
println 'Using MeddleAPI v' + project.meddleapi.version
println ''
if (project.meddle.location == null) {
dependencies { compile group: "net.fybertech", name: "meddle", version: "${project.meddle.version}" }
}
else {
dependencies { compile files(project.meddle.location) }
}
if (project.dynamicmappings.location == null) {
dependencies { compile group: "net.fybertech", name: "dynamicmappings", version: "${project.dynamicmappings.version}" }
}
else {
dependencies { compile files(project.dynamicmappings.location) }
}
if (project.meddleapi.location == null) {
dependencies { compile group: "net.fybertech", name: "meddleapi", version: "${project.meddleapi.version}" }
}
else {
dependencies { compile files(project.meddleapi.location) }
}
dependencies { runtime files(new File("${->project.greddle.cacheDir}", "${->project.ext.mcJarFilename}")) }
dependencies { provided files(new File("${->project.greddle.cacheDir}", "${->project.ext.remappedJarFilename}")) }
}
idea {
module {
scopes.PROVIDED.plus += [ configurations.provided ]
}
}
jar {
dependsOn('findMappings')
}
task findMappings(type: JavaExec, dependsOn:[classes]) {
main = 'net.fybertech.dynamicmappings.ModMappings'
args = [sourceSets.main.output.classesDir.getAbsolutePath(), sourceSets.main.output.resourcesDir.getAbsolutePath() + "/requiredmappings.cfg"]
doFirst {
// TODO - Look into why both jars needed
classpath = sourceSets.main.runtimeClasspath + configurations.provided
}
}
task getMinecraft(type: JavaExec) {
main = 'net.fybertech.greddle.Greddle'
classpath = configurations.getmc //files('greddle-1.0.jar')
args = ["${->project.minecraft.version}", "${->project.greddle.cacheDir}"]
outputs.dir { "${->project.greddle.cacheDir}" }
}
task remapMinecraft(type: JavaExec, dependsOn: 'getMinecraft') {
doFirst {
classpath files(new File(project.greddle.cacheDir, "${->project.minecraft.version}" + '.jar'))
configurations.compile.resolvedConfiguration.getResolvedArtifacts().each {
if (it.name.equals('meddle')) classpath it.getFile()
else if (it.name.equals('dynamicmappings')) classpath it.getFile()
else if (it.name.equals('meddleapi')) classpath it.getFile()
}
if (project.meddle.location != null) classpath project.meddle.location
if (project.meddleapi.location != null) classpath project.meddleapi.location
if (project.dynamicmappings.location != null) classpath project.dynamicmappings.location
classpath fileTree(new File("${->project.greddle.cacheDir}", 'libraries/'))
args = ['-o', "${->project.greddle.cacheDir}/${->project.remappedJarFilename}"]
}
classpath sourceSets.main.resources.getSrcDirs()
main = 'net.fybertech.dynamicmappings.DynamicRemap'
inputs.file { files(new File("${->project.greddle.cacheDir}", "${->project.mcJarFilename}")) }
outputs.file { files(new File("${->project.greddle.cacheDir}", "${->project.remappedJarFilename}")) }
}
compileJava.dependsOn(remapMinecraft)
task run(type: JavaExec) {
}