This repository has been archived by the owner on Mar 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
build.gradle
210 lines (177 loc) · 5.55 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
repositories {
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'eclipse'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
ext.configFile = file('build.properties')
ext.config = parseConfig(configFile)
//ext.priv = parseConfig(file('private.properties'))
version = "${config.version}-${config.build_number}"
group = "vazkii.ambience" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name
minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "eclipse/assets"
mappings = config.mc_mappings
//This, does the token replacement.
//Though, I reccomend this to be replaced with a token such as @VERSION@
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', config.version
replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
}
repositories {
mavenCentral()
}
dependencies {
}
processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info', '**/psd/**'
}
}
/**
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
*/
task deobfJar(type: Jar) {
from(sourceSets.main.output)
archiveName = "${baseName} ${version}-deobf.${extension}"
}
artifacts {
archives deobfJar
}
/**
* Increments the buildnumber in your config file, and saves it
*/
task incrementBuildNumber {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
}
//file('web/versions.ini').append("\n${version}=${minecraft.version}")
//file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
}
// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
into file("${config.dir_output}/wtf")
}
// Seriously, I'm desperate to make this work
task wtfGradle1(type: Delete) {
dependsOn "wtfGradle2"
delete "${config.dir_output}/wtf/${deobfJar.archiveName}"
}
task output(type: Copy) {
dependsOn "wtfGradle1"
from(jar.destinationDir)
into file(config.dir_output)
}
task outputDeobf(type: Copy) {
dependsOn "output"
from(config.dir_output) {
include deobfJar.archiveName
}
into file("${config.dir_output}/deobf")
}
/*task forgecraft(type: Copy) {
dependsOn "outputDeobf"
from "${config.dir_output}/wtf"
into file(config.dir_forgecraft)
}*/
task sort(type: Delete) {
dependsOn /*"forgecraft"*/ "outputDeobf"
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}
/**
* This is the upload task from the build.xml
*/
/*task upload(dependsOn: 'reobf') << {
ftp(action: 'mkdir', remotedir: '/files')
ftp(action: 'send', remotedir: '/files') {
fileset(file: jar.archivePath)
}
ftp(action: 'send', remotedir: '/files/deobf') {
fileset(file: deobfJar.archivePath)
}
ftp(action: 'send', remotedir: '.') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
}
}*/
/**
* This is deply_web task
*/
task deployWeb << {
ftp(action: 'send', remotedir: '.') {
fileset(dir: 'web') //everything from the web directory
}
}
//simple function that we can use
//Got this from: http://svn.codehaus.org/gradle/website/build.gradle
/*void ftp(Map args, Closure antFileset = {}) {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
Map ftpArgs = args + [ //some default options
verbose : 'yes',
server : priv.host,
userid : priv.user,
password: priv.pass
]
delegate.ftp(ftpArgs) {
antFileset.delegate = delegate
antFileset()
}
}
}*/
def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}
jar {
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName} ${version}.${extension}"
}
/*curse {
apiKey = priv.cfkey
projectId = "225643"
changelog = """
See http://vazkii.us/mod/Botania/changelog.php#${version}
"""
releaseType = "release"
}*/
//change this so it only increments on upload
//upload.dependsOn tasks.incrementBuildNumber
defaultTasks 'clean', 'build', 'sort', 'incrementBuildNumber'/*, 'forgecraft', 'curse', 'upload'*/ //remove clean if you want faster builds, this will stop rare inconsistancies.