forked from DaFlight/DaFlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
148 lines (136 loc) · 3.89 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
buildscript {
repositories {
jcenter()
maven {
name 'forge'
url 'http://files.minecraftforge.net/maven'
}
maven {
name 'm2'
url 'https://plugins.gradle.org/m2'
}
maven {
name 'sponge'
url 'https://repo.spongepowered.org/maven'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
classpath 'gradle.plugin.mnm.mods.kappa:ap-ide:1.0.5'
}
}
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'mnm.gradle.ap-ide'
minecraft {
version = "1.11.2"
mappings = "snapshot_20161224"
runDir = 'run'
tweakClass = 'me.dags.daflight.launch.DaFlightTweaker'
}
group = 'me.dags'
version = "5.1pre0-mc$minecraft.version"
repositories {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/maven'
}
}
dependencies {
compile('org.spongepowered:mixin:0.6.4-SNAPSHOT') {
transitive = false
}
factory 'org.spongepowered:mixin:0.6.4-SNAPSHOT'
}
processor {
options.reobfSrgFile = project.tasks.genSrgs.mcpToSrg.path
}
sourceSets {
main {
refMap = 'mixin.daflight.refmap.json'
}
}
mixin {
// add sourceSets.main, 'mixin.daflight.refmap.json'
defaultObfuscationEnv notch
}
def commonManifest = [
'Built-By' : 'ForgeGradle',
'Implementation-Vendor' : 'dags',
'Implementation-Title' : project.name,
'Implementation-Version': project.version,
'TweakClass' : 'me.dags.daflight.launch.DaFlightLoaderTweaker',
'TweakName' : project.name,
'TweakVersion' : project.version,
'TweakAuthor' : 'dags'
]
jar {
classifier 'minimal'
afterEvaluate {
manifest {
attributes commonManifest
}
}
}
task allJar(type: Jar) {
from sourceSets.main.output
from configurations.compile.collect { zipTree(it) }
exclude 'META-INF/**'
manifest {
attributes commonManifest
}
}
artifacts.archives allJar
reobf {
allJar {}
}
import net.minecraftforge.gradle.tasks.EtagDownloadTask
task processJson(type: Copy) {
def things = [
version : project.version,
project : project.name,
timestamp : new Date().format("yyyy'-'MM'-'dd'T'hh':'mm':'ssZZZZ"),
mcversion : project.minecraft.version,
artifact : "$project.group:$project.name:$version",
universal_jar: project.allJar.archivePath.name,
tweak_class : project.minecraft.tweakClass
]
from('install_profile.json') {
filter { line ->
def replaces = (line =~ /@(.+?)@/)
replaces.each {
def key = it[0]
def val = things[it[1]] ?: 'null'
line = line.replace(it[0], things[it[1]] ?: 'null')
}
line
}
}
from('.') {
include 'daflight-logo.png'
rename { 'daflight-installer-logo.png' }
}
into 'build/distributions/packaging/resources'
outputs.upToDateWhen { false }
}
task downloadInstaller(type: EtagDownloadTask) {
url = 'http://files.minecraftforge.net/maven/net/minecraftforge/installer/1.5/installer-1.5-shrunk.jar'
dieWithError = true
file = 'build/distributions/packaging/installer-fresh.jar'
}
task installer(type: Zip) {
from allJar
from processJson
from(zipTree(downloadInstaller.file)) {
exclude '*.json'
exclude '*.png'
}
baseName = project.name
classifier = 'installer'
extension = 'jar'
destinationDir = file('build/distributions')
duplicatesStrategy = 'EXCLUDE'
outputs.upToDateWhen { false }
dependsOn downloadInstaller, build, processJson
}