This repository has been archived by the owner on Dec 4, 2022. It is now read-only.
forked from Esteemed-Innovation/Esteemed-Innovation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
231 lines (188 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
import org.ajoberstar.grgit.Grgit
import java.nio.file.Files
import java.nio.file.Paths
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.ajoberstar:grgit:1.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
version = newModVersion + '-api' + newAPIVersion
/*
Usage: `gradle build -Palpha=<version>` where <version> is the next version (different from newModVersion because
that is updated when we are releasing an actual public update. Modifying that makes reading commit history much more
confusing). It increments the .alphaversion file's first line at the end, so it can be thought of as "the next alpha version".
Example: `gradle build -Palpha=1.0.0 -Pdev` => version # 1.0.0-alpha1-<commit>
*/
static def incrementAlphaVersion(int currentValue) {
def file = new File('.alphaversion')
file.newWriter()
file << "${currentValue + 1}"
}
def getAlphaVersion() {
if (!Files.exists(Paths.get('.alphaversion'))) {
new File('.alphaversion').createNewFile()
incrementAlphaVersion(0)
}
new File('.alphaversion').withReader { return it.readLine() }
}
int alpha = getAlphaVersion().toInteger()
if (project.hasProperty('alpha')) {
version = project.property('alpha') + "-alpha" + alpha
}
if (project.hasProperty('dev')) {
def git = Grgit.open(dir: '.')
project.version += '-' + git.head().getAbbreviatedId(6)
}
task finalize << {
if (project.hasProperty('alpha')) {
incrementAlphaVersion(alpha)
}
// This file is genereated by processResources before getting put into the jar.
new File('./mcmod.info').delete()
}
build.finalizedBy(finalize)
group = "eiteam.esteemedinnovation"
archivesBaseName = "EsteemedInnovation-1.12"
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
version = project.forgeVersion
mappings = project.mcpMappings
runDir = "eclipse"
replace "@VERSION@", newModVersion
replace "@APIVERSION@", newAPIVersion
}
repositories {
maven {
name = "ic2"
url = "http://maven.ic2.player.to/"
}
// Used for Mantle, Natura, Tinkers' Construct, and JEI.
maven {
name "progwml6"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name "tterrag Repo"
url "http://maven.tterrag.com"
}
maven {
name = "The CB Project"
url "http://chickenbones.net/maven"
}
maven {
name = "Jared"
url = "http://maven.blamejared.com/"
}
maven {
url = "https://minecraft.curseforge.com/api/maven/"
}
}
dependencies {
compile mantleVersion
compile ticVersion
compile naturaVersion
// compile ic2Version
compile jeiVersion
deobfCompile cclibVersion
compile craftTweaker2APIVersion
compile craftTweaker2Version
compile baublesVersion
// These are dependent on libs which do not compile successfully.
// compile eioVersion
// compile ecoreVersion
// Avoiding using the generic "lib".
compile fileTree(dir: 'eilib', include: '*.jar')
}
processResources {
// Combine the main and api mcmod.info files and replace their versions.
def slurper = new JsonSlurper()
def mainInfo = new File('src/main/resources/mcmod.info').text
def apiInfo = new File('src/api/resources/mcmod.info').text
def mainJson = slurper.parseText(mainInfo)
def apiJson = slurper.parseText(apiInfo)
mainJson[0].version = newModVersion
apiJson[0].version = newAPIVersion
def outputInfo = [
mainJson[0],
apiJson[0]
]
new File('./mcmod.info').write(JsonOutput.toJson(outputInfo))
from 'mcmod.info'
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
from(sourceSets.api.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// TODO: Automate for when a new API package is built/published.
javadoc {
source = sourceSets.api.allJava
destinationDir = file('./docs/')
options.memberLevel = JavadocMemberLevel.PRIVATE
title = 'Esteemed Innovation API version ' + newAPIVersion
}
task apiJar(type: Jar) {
version = newAPIVersion
classifier = 'api'
from sourceSets.api.output
from(sourceSets.api.resources.srcDirs) {
include 'mcmod.info'
filter {
it.replaceAll('@APIVERSION@', newAPIVersion)
}
}
from(sourceSets.api.resources) {
exclude 'mcmod.info'
}
}
jar {
dependsOn compileApiJava
from sourceSets.api.output.classesDir
}
artifacts {
archives apiJar
}
publishing {
publications {
apiPublication(MavenPublication) {
artifact apiJar
}
}
}
bintray {
if (System.hasProperty('bintray_user') && System.hasProperty('bintray_key')) {
user = bintray_user
key = bintray_key
publications = ['apiPublication']
pkg {
repo = 'Esteemed-Innovation'
name = 'Releases'
userOrg = 'esteemed-innovation'
version {
name = project.version
}
}
}
}