forked from AppliedEnergistics/Applied-Energistics-2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
255 lines (220 loc) · 8.29 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
245
246
247
248
249
250
251
252
253
254
255
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.9"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'signing'
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
apply from: 'gradle/scripts/dependencies.gradle'
apply from: 'gradle/scripts/artifacts.gradle'
apply from: 'gradle/scripts/optional.gradle'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = aeversion + "-" + aechannel + "-" + aebuild
group = aegroup
archivesBaseName = aebasename + "-" + minecraft_version
// Add Coremod Manifest
jar {
manifest {
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLAT': 'appeng_at.cfg'
}
from sourceSets.api.output
dependsOn apiClasses
// specify which files are really included, can control which APIs should be in
include "appeng/**"
include "assets/**"
include "mcmod.info"
include "pack.mcmeta"
include "META-INF/appeng_at.cfg"
}
minecraft {
coreMod = "appeng.coremod.CoreModLoader"
version = minecraft_version + "-" + forge_version
replaceIn "AEConfig.java"
replaceIn "package-info.java"
replace "@version@", project.version
replace "@aeversion@", aeversion
replace "@aechannel@", aechannel
replace "@aebuild@", aebuild
// used when launching minecraft in dev env
runDir = "run"
mappings = mcp_mappings
makeObfSourceJar = false
}
sourceSets {
api
// This source set will contain third party API code that we need to compile, but which is not shipped with the jar
thirdparty {
// Third Party APIs often need access to Minecraft classes (i.e. EnumFacing), so set this up here
compileClasspath += configurations.forgeGradleMc + configurations.forgeGradleMcDeps
}
main
}
dependencies {
compile sourceSets.thirdparty.output
}
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'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
// move access transformer to META-INF
rename '(.+_at.cfg)', 'META-INF/$1'
}
runServer {
args 'nogui'
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
uploadArchives {
if(System.getenv("LOCAL_MAVEN") != null) {
repositories {
mavenDeployer {
/*if (System.getenv("SIGN_KEYSTORE") != null){
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}*/
repository(url: "file://"+System.getenv("LOCAL_MAVEN"))
pom {
groupId = project.group
version = project.version
if (System.getenv("MAVEN_ARTIFACT") != null) {
artifactId = System.getenv("MAVEN_ARTIFACT")
} else {
artifactId = project.archivesBaseName
}
project {
name project.archivesBaseName
packaging 'jar'
description 'A Minecraft Mod about Matter, Energy and using them to conquer the world..'
url 'http://ae-mod.info/'
scm {
url 'https://github.com/thiakil/Applied-Energistics-2.git'
}
issueManagement {
system 'github'
url 'https://github.com/thiakil/Applied-Energistics-2/issues'
}
licenses {
license {
name 'LGPLv3'
url 'https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/master/LICENSE'
distribution 'repo'
}
}
}
}
}
}
}
}
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import java.util.function.Predicate
task addRelease() {
doFirst {
def curTag = "git describe --abbrev=0".execute().getText().trim()
println curTag
def updaterFileName = "forge_update.json"
def updaterFile = (Map)(new JsonSlurper().parse(new File(updaterFileName)))
println "git log --no-merges --oneline --date-order --reverse $curTag..HEAD"
//Process proc = "git log --no-merges --oneline --date-order --reverse $curTag..HEAD".execute()
//proc.waitFor()
def changeLog = "git log --no-merges --oneline --date-order --reverse $curTag..HEAD".execute().getText().trim()
List<String> cl_List = new ArrayList<>(Arrays.asList(changeLog.split('\n')))
cl_List.removeIf(new Predicate<String>() {
@Override
boolean test(String s) {
return s.contains("[no-cl]")
}
})
changeLog = cl_List.join("\n")
println changeLog
Map<String,Object> mcVersion = updaterFile.containsKey(project.minecraft.version) ? (Map)updaterFile.get(project.minecraft.version) : new HashMap<String,Object>()
if (!updaterFile.containsKey(project.minecraft.version))
updaterFile.put(project.minecraft.version, mcVersion)
mcVersion.put(project.version.toString(), changeLog)
Map<String,Object> promos = (Map)updaterFile.get("promos")
promos.put(project.minecraft.version+"-latest", project.version.toString())
//TODO only set recommended if not alpha/beta
promos.put(project.minecraft.version+"-recommended", project.version.toString())
new File(updaterFileName).write(JsonOutput.prettyPrint(JsonOutput.toJson(updaterFile)))
}
}
ext.getCurrentChanges = { ->
def updaterFileName = "forge_update.json"
def updaterFile = (Map)(new JsonSlurper().parse(new File(updaterFileName)))
return updaterFile.get(project.minecraft.version).get(project.version.toString())
}
//signing {
// sign configurations.archives
//}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf{
System.getenv("SIGN_KEYSTORE") != null
}
inputFile = jar.archivePath
outputFile = jar.archivePath
keyStore=System.getenv("SIGN_KEYSTORE")
alias="signFiles"
storePass=System.getenv("SIGN_KEYSTORE_PASS")
keyPass=System.getenv("SIGN_KEY_PASS")
}
build.dependsOn signJar
uploadArchives.dependsOn signJar
tasks.curseforge.dependsOn signJar
if (System.getenv("CURSEFORGE_KEY") != null) {
curseforge {
apiKey = System.getenv("CURSEFORGE_KEY")
project {
id = '271174'
changelog = getCurrentChanges() // A file can also be set using: changelog = file('changelog.txt')
releaseType = 'beta'
}
}
}