-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
118 lines (97 loc) · 3.2 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
import org.apache.tools.ant.filters.ReplaceTokens
import groovy.json.JsonSlurper
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id 'com.github.dkorotych.gradle-maven-exec' version '2.2.1' apply false
}
group "$GROUP"
version 'dev-SNAPSHOT'
task ilbluInit(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'init'
}
task ilbluApplyPatches(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'patch'
}
task ilbluInitApply(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'apply', 'init'
}
task ilbluRebuildPatches(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'rebuild'
}
task ilbluGenerateMCDEVSRC(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'mcdev'
}
task ilbluMergeUp(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'mergeup'
}
task ilbluSync(type: Exec, group: 'ilblu') {
commandLine "$BASH_PATH", 'ilblu', 'sync'
}
if ("true".equalsIgnoreCase(System.env.INIT_ON_STARTUP)) {
println "Starting with SETUP_ON_STARTUP enabled"
exec {
commandLine "$BASH_PATH", 'ilblu', 'patch', 'init'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
afterEvaluate {
artifactId project.name.toLowerCase()
}
}
}
}
task processJava(type: Copy) {
doFirst {
delete destinationDir
}
from project.sourceSets.main.java
into "$buildDir/generated/main/java"
filter ReplaceTokens, tokens: [
GROUP: GROUP,
FORK_NAME: FORK_NAME,
FORK_NAME_: FORK_NAME.toLowerCase(),
GITHUB: GITHUB,
BRANCH: BRANCH,
]
}
compileJava {
source = tasks.processJava
}
processResources {
filter ReplaceTokens, tokens: [FORK_NAME: FORK_NAME]
into({ "META-INF/maven/${project.group}/${project.name.toLowerCase()}" }) {
from { generatePomFileForMavenPublication }
rename { "pom.xml" }
}
into({ "META-INF/maven/${project.group}/${project.name.toLowerCase()}" }) {
from { generatePomProperties }
}
}
task generatePomProperties(type: WriteProperties) {
outputFile file("$buildDir/generated/pom.properties")
comment 'Generated by Gradle'
property 'artifactId', { project.name.toLowerCase() }
property 'groupId', { project.group }
property 'version', { project.version }
}
}
task parseBuildData() {
ext.mcver = ""
def buildDataInfo = file("./$WORK_PATH/BuildData/info.json")
inputs.file buildDataInfo
doLast {
ext.mcver = new JsonSlurper().parse(buildDataInfo)['minecraftVersion']
}
}
task gitDescribeFork(type: Exec) {
commandLine "$BASH_PATH", '-c', 'git rev-parse --short --always HEAD'
standardOutput = new ByteArrayOutputStream()
ext.output = { return standardOutput.toString().replaceAll("\\s", "") }
}