forked from Glitchfiend/ToughAsNails
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
229 lines (191 loc) · 6.44 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.0.9"
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
// define the properties file
ext.configFile = file "build.properties"
configFile.withReader {
// read config. it shall from now on be referenced as simply config or as project.config
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
group = "com.github.glitchfiend.biomesoplenty"
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv().BUILD_NUMBER}"
archivesBaseName = "ToughAsNails"
config.build_number = (System.getenv().BUILD_NUMBER) ? System.getenv().BUILD_NUMBER : ""
minecraft {
version = config.minecraft_version + "-" + config.forge_version
useDepAts = true
mappings = project.config.mappings_version
// gradle complains if this isn't set when setting up/using IDEA workspace
runDir = "run"
// set a full version string with appended build number to be used in mod registration
def buildnum = (config.build_number!="") ? '.' + config.build_number : ""
replace '@MOD_VERSION@', config.mod_version + buildnum
replace '1.0.0.0', config.forge_version
replaceIn 'ToughAsNails.java'
}
def commonManifest = {
attributes (
"FMLAT": 'toughasnails_at.cfg'
)
}
jar {
manifest commonManifest
classifier = 'universal'
}
processResources {
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'
// replaces
expand ([
'modid': project.archivesBaseName,
'mod_version': project.config.mod_version,
'minecraft_version': project.config.minecraft_version,
'build_number': project.config.build_number
])
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
}
}
import net.minecraftforge.gradle.tasks.JenkinsChangelog
import net.minecraftforge.gradle.common.Constants
task changelog(type: JenkinsChangelog) {
def buildNumber = "${System.getenv().BUILD_NUMBER}"
serverRoot = 'http://ci.jenkins.minecraftforge.net/'
jobName = 'ToughAsNails'
authName = 'console_script';
authPassword = "$System.env.changelog_pass";
targetBuild = buildNumber.toString();
output = 'build/libs/' + project.getName() + '-' + project.version + '-changelog.txt';
}
tasks.build.dependsOn('changelog')
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
from (sourceSets.main.output) {
include 'LICENSE.txt'
}
classifier = 'sources'
}
task deobfJar(type: Jar) {
from sourceSets.main.output
manifest commonManifest
classifier = 'deobf'
}
task apiJar(type: Jar) {
from(sourceSets.main.allJava) {
include 'toughasnails/api/**'
}
from (sourceSets.main.output) {
include 'LICENSE.txt'
include 'toughasnails/api/**'
}
classifier = 'api'
}
task listOutputs << {
// This is needed by the Groovy Postbuild to append labels for each build used in the changelog.
println "Output files:"
println "--------------------"
def list = []
def dir = new File("build/libs/")
if (dir.exists()) {
dir.eachFileRecurse (FileType.FILES) { file ->
//Add each file to the list
list << file
}
//Print the names of all of the output files
list.each {
println it.getName()
}
}
println "--------------------"
}
tasks.build.finalizedBy('listOutputs')
artifacts {
archives changelog.output
archives sourcesJar
archives deobfJar
archives apiJar
}
curseforge {
apiKey = "$System.env.curse_api_key"
project {
id = '246391'
changelog = file('build/libs/' + project.getName() + '-' + project.version + '-changelog.txt');
releaseType = 'beta'
}
}
import groovy.io.FileType
uploadArchives {
repositories {
mavenDeployer {
if (project.hasProperty('forgeMavenPassword'))
{
repository(url: "https://files.minecraftforge.net/maven/manage/upload") {
authentication(userName: project.getProperty('forgeMavenUsername'), password: project.getProperty('forgeMavenPassword'))
}
}
else
{
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Tough As Nails'
url 'https://github.com/Glitchfiend/ToughAsNails'
scm {
url 'https://github.com/Glitchfiend/ToughAsNails'
connection 'scm:git:git://github.com/Glitchfiend/ToughAsNails.git'
developerConnection 'scm:git:[email protected]:Glitchfiend/ToughAsNails.git'
}
issueManagement {
system 'github'
url 'https://github.com/Glitchfiend/ToughAsNails/issues'
}
licenses {
license {
name 'Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International Public License'
url 'http://creativecommons.org/licenses/by-nc-nd/4.0/'
distribution 'repo'
}
}
developers {
developer {
id 'Adubbz'
name 'Adubbz'
roles { role 'developer' }
}
developer {
id 'Forstride'
name 'Forstride'
roles { role 'developer' }
}
}
}
}
}
}
}