forked from montoyo/mcef
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbuild.gradle
88 lines (77 loc) · 2.18 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
plugins {
id 'fabric-loom' version "${fabric_loom_version}" apply false
}
tasks.register('cloneJcef', Exec) {
commandLine 'git', 'submodule', 'update', '--init', '--recursive', 'common/java-cef'
}
// https://gist.github.com/JonasGroeger/7620911
def getCheckedOutGitCommitHash(Project mcefParent) {
def gitFolder = "$mcefParent.projectDir/.git/modules/common/java-cef/"
def takeFromHash = 40
/*
* '.git/HEAD' contains either
* in case of detached head: the currently checked out commit hash
* otherwise: a reference to a file containing the current commit hash
*/
def gitHeadFile = new File(gitFolder + "HEAD");
if (gitHeadFile.exists()) {
def head = gitHeadFile.text.split(":") // .git/HEAD
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd
// def isRef = head.length > 1 // ref: refs/heads/master
if (isCommit) return head[0].trim().take(takeFromHash) // e5a7c79edabb
def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master
refHead.text.trim().take takeFromHash
} else {
return ""
}
}
tasks.register('publishMaven', GradleBuild) {
group = 'mcef'
tasks = [
':common:publish',
':fabric:publish',
':neoforge:publish'
]
}
tasks.register('publishCurseforge', GradleBuild) {
group = 'mcef'
tasks = [
':common:clean',
':neoforge:clean',
':fabric:clean',
':neoforge:curseforge',
':fabric:curseforge'
]
}
tasks.register('fabricClient', GradleBuild) {
group = 'mcef'
tasks = [
':fabric:runClient'
]
}
tasks.register('neoforgeClient', GradleBuild) {
group = 'mcef'
tasks = [
':neoforge:runClient'
]
}
tasks.register('fabricServer', GradleBuild) {
group = 'mcef'
tasks = [
':fabric:runServer'
]
}
tasks.register('neoforgeServer', GradleBuild) {
group = 'mcef'
tasks = [
':neoforge:runServer'
]
}
tasks.register('cleanAll', GradleBuild) {
group = 'mcef'
tasks = [
':common:clean',
':fabric:clean',
':neoforge:clean',
]
}