This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
forked from pahimar/Equivalent-Exchange-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
244 lines (202 loc) · 7.68 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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:1.2-SNAPSHOT'
}
}
apply plugin: 'java'
apply plugin: 'forge'
apply plugin: 'curseforge'
apply plugin: 'maven'
repositories {
maven { // the repo from which to get NEI and stuff
name 'CB Repo'
url "http://chickenbones.net/maven/"
}
maven { // The repo from which to get waila
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
}
dependencies {
compile('mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10') {
exclude group: 'mcp.mobius.waila'
}
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.136:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.6.43:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.4.105:dev"
}
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = config.mod_version
group = "com.pahimar.ee3" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "EquivalentExchange3"
minecraft {
version = config.minecraft_version + "-" + config.forge_version
replaceIn "reference/Reference.java"
replace "@MOD_VERSION@", "${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"
if (project.hasProperty("ee3_sha1_signature")) {
replace "@FINGERPRINT@", project.ee3_sha1_signature
}
replaceIn "api/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/array/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/event/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/exchange/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/knowledge/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/recipe/package-info.java"
replace "@API_VERSION@", config.api_version
replaceIn "api/util/package-info.java"
replace "@API_VERSION@", config.api_version
}
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"
processResources {
// exclude xcf files, as they are for development only
exclude '**/*.xcf'
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include '*.info'
// replace version and mcversion
expand 'mod_version': project.version, 'minecraft_version': project.config.minecraft_version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
}
}
task devJar(type: Jar, dependsOn: 'classes') {
from(sourceSets.main.output) {
include '**'
}
extension = 'jar'
classifier = 'dev'
}
artifacts {
archives devJar
}
import net.minecraftforge.gradle.delayed.*
import net.minecraftforge.gradle.tasks.dev.ChangelogTask
task createChangelog(type: ChangelogTask) {
if (("${System.getenv().JOB_NAME}" != null) && project.hasProperty("jenkins_server") && project.hasProperty("jenkins_password")) {
def jobName = "${System.getenv().JOB_NAME}"
def buildNumber = "${System.getenv().BUILD_NUMBER}"
setServerRoot(new DelayedString(project, project.jenkins_server))
setJobName(new DelayedString(project, jobName.toString()))
setAuthName(new DelayedString(project, project.jenkins_user))
setAuthPassword(new DelayedString(project, project.jenkins_password))
setTargetBuild({ buildNumber.toString() });
setOutput(new DelayedFile(project, 'build/libs/' + project.archivesBaseName + '-' + project.version + '-changelog.txt'));
}
onlyIf {
return (("${System.getenv().JOB_NAME}" != null) && project.hasProperty("jenkins_server") && project.hasProperty("jenkins_password"))
}
}
tasks.build.dependsOn('createChangelog')
tasks.build.dependsOn('signJar')
if (!project.hasProperty("keystore_location")) // keystore stuff
ext.keystore_location = "."
if (!project.hasProperty("keystore_password")) // keystore stuff
ext.keystore_password = ""
if (!project.hasProperty("ee3_keystore_alias")) // keystore stuff
ext.ee3_keystore_alias = ""
task signJar(dependsOn: ["reobf", "devJar"]) {
inputs.dir jar.destinationDir
inputs.file keystore_location
inputs.property "ee3_keystore_alias", ee3_keystore_alias
inputs.property "keystore_password", keystore_password
outputs.dir devJar.destinationDir
// only sign if the keystore exists
onlyIf {
return keystore_location != "." && keystore_password != ""
}
// the actual action.. sign the jar.
doLast {
jar.destinationDir.eachFile { file ->
if (!file.getPath().endsWith(".jar"))
return; // skip non-jars
logger.lifecycle "signing $file"
ant.signjar(
destDir: file.getParentFile(), // same place it came from
jar: file,
keystore: keystore_location,
alias: ee3_keystore_alias,
storepass: keystore_password
)
}
}
}
curse {
dependsOn 'reobf'
onlyIf { return project.hasProperty('ee3_curseforge_apikey') }
projectId = project.hasProperty('ee3_curseforge_projectid') ? project.ee3_curseforge_projectid : ''
apiKey = project.hasProperty('ee3_curseforge_apikey') ? project.ee3_curseforge_apikey : ''
changelog = project.hasProperty('changelog') ? project.changelog : ''
releaseType = config.release_type
additionalArtifact devJar
}
uploadArchives {
repositories {
mavenDeployer {
if (project.hasProperty("forgemaven_url")) {
logger.info('Publishing to files server')
repository(url: project.forgemaven_url) {
authentication(userName: project.forgemaven_username, password: project.forgemaven_password)
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
}
pom.project {
name project.archivesBaseName
packaging 'jar'
description 'Equivalent Exchange 3'
url 'https://github.com/pahimar/Equivalent-Exchange-3/'
scm {
url 'https://github.com/pahimar/Equivalent-Exchange-3/'
connection 'scm:git:git://github.com/pahimar/Equivalent-Exchange-3.git'
developerConnection 'scm:git:git@github.com/pahimar/Equivalent-Exchange-3.git'
}
issueManagement {
system 'github'
url 'https://github.com/pahimar/Equivalent-Exchange-3/issues'
}
licenses {
license {
name 'GNU Lesser General Public License 3.0'
url 'https://www.gnu.org/licenses/lgpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'Pahimar'
name 'Pahimar'
roles {
role 'developer'
}
}
}
}
}
}
}