-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
235 lines (208 loc) · 7.27 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
// For those who want the bleeding edge
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.1.0"
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'java'
repositories {
maven { // The repo from which to get waila
url "http://mobiusstrip.eu/maven"
}
maven { // the repo from which to get NEI and stuff
url "http://chickenbones.net/maven/"
}
maven {
url "https://maven.cil.li/"
}
maven { // the repo from which to get EnderIO and tterrags mods
url "https://maven.tterrag.com/"
}
maven { // the repo from which to get EnderIO and tterrags mods
url "https://maven2.tterrag.com/"
}
maven {
name "ic2"
url "http://maven.ic2.player.to/"
}
maven {
url "https://tehnut.info/maven"
}
maven {
url "https://maven.ironhide.de/"
}
maven { // JEI
url "https://dvs1.progwml6.com/files/maven"
}
//maven { url = "http://dl.tsr.me/artifactory/libs-release-local" }
maven { // CoFH
name = "Covers Maven"
url = "http://maven.covers1624.net"
}
maven {
url 'https://maven.mcmoddev.com'
}
maven {
url = "https://files.minecraftforge.net/maven"
}
}
sourceCompatibility = targetCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
version = "${mod_version}"
if (hasProperty('appendBuildNumber')) {
version = version + "-" + appendBuildNumber.toString()
} else {
version = version + "-0"
}
group = "${group_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${mod_id}-${minecraft_version}"
String omlib_max_version= omlib_version.toString().replaceAll("[0-9]-[0-9]*", "99-9999")
minecraft {
version = "${forge_version}"
runDir = "run"
replace "@VERSION@", project.version
replace "omlib@[0.0.0,)", "omlib@[" + omlib_version + "," + omlib_max_version + ")"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20171212"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
useDepAts = true
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// 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'
}
}
def omlib_local = false
if (project.allprojects.findAll({ it.name == "OMLib" }).size() > 0) {
omlib_local = true
}
if (rootProject.name == "OMTControl") {
omlib_local = true
}
dependencies {
deobfProvided "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
deobfProvided "cofh:RedstoneFlux:${minecraft_version_short}-${redstoneflux_version}:deobf"
deobfProvided "net.darkhax.tesla:Tesla-${minecraft_version}:${tesla_version}"
deobfProvided "mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_version_short}"
deobfProvided "mcjty.theoneprobe:TheOneProbe-${minecraft_version_short}:${minecraft_version_short}-${top_version}"
deobfProvided "li.cil.oc:OpenComputers:MC${minecraft_version_short}.1-${oc_version}"
if (!omlib_local) {
deobfProvided "omtteam:omlib:${minecraft_version}-${omlib_version}"
} else {
compileOnly project(':OMLib')
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
tasks.build.dependsOn deobfJar, sourceJar
publishing {
tasks.publish.dependsOn 'build'
publications {
mavenJava(MavenPublication) {
groupId group_prefix
version minecraft_version + "-" + project.version
artifactId mod_id
artifact jar
artifact sourceJar
artifact deobfJar
}
}
repositories {
mavenLocal()
}
}
//// DETECTING COMMIT NAME AND ACTIVATING CURSE RELEASE \\\\
def commit_release_type = getCommmitReleaseType()
def getCommmitReleaseType() {
if (project.hasProperty("curseforge_key")) {
def stdout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'log', '-1', '--pretty=tformat:%s'
standardOutput = stdout
}
} catch (Exception e) {
System.print("SKIPPING CURSE RELEASE - FAILED TO RETRIEVE LAST COMMIT")
e.printStackTrace()
return 'none'
}
String commit = stdout.toString().trim()
if (commit.startsWith("CRelease") || commit.startsWith("crelease")) {
System.out.println("FOUND NEW RELEASE - COMMIT: ".concat(commit)); return 'release'
} else if (commit.startsWith("CBeta") || commit.startsWith("cbeta")) {
System.out.println("FOUND NEW BETA - COMMIT: ".concat(commit)); return 'beta'
} else if (commit.startsWith("CAlpha") || commit.startsWith("calpha")) {
System.out.println("FOUND NEW ALPHA - COMMIT: ".concat(commit)); return 'alpha'
} else {
System.out.println("SKIPPING CURSE RELEASE - COMMIT: " + commit); return 'none'
}
}
System.out.println("SKIPPING CURSE RELEASE - NO CURSE API KEY")
return 'none'
}
tasks.curseforge.enabled = project.hasProperty("curseforge_key") && commit_release_type != 'none'
curseforge {
if (project.hasProperty("curseforge_key") && commit_release_type != 'none') {
System.out.println("ATTEMPTING CURSE RELEASE")
apiKey = project.properties["curseforge_key"]
} else {
return
}
project {
id = curse_project_id
addGameVersion '1.12.2'
relations {
requiredDependency 'omlib'
optionalDependency 'openmodularturrets'
optionalDependency 'ender-io'
optionalDependency 'redstone-flux'
optionalDependency 'thermal-expansion'
}
mainArtifact(jar) {
releaseType = commit_release_type
changelog = file("${projectDir}/change_log.html").text
changelogType = 'html'
}
addArtifact(sourceJar) {
releaseType = 'alpha'
changelog = file("${projectDir}/change_log.html").text
changelogType = 'html'
}
addArtifact(deobfJar) {
releaseType = 'alpha'
changelog = file("${projectDir}/change_log.html").text
changelogType = 'html'
}
}
}