This repository has been archived by the owner on Jan 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
184 lines (142 loc) · 4.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
buildscript {
repositories {
jcenter()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/releases/"
}
}
dependencies {
classpath "org.ajoberstar:gradle-git:1.6.0"
}
}
apply plugin: "org.ajoberstar.grgit"
//Get Github commit hash
task tagRelease {
description = "Tags the current head with the project\"s version."
doLast {
grgit.tag.add {
name = version
message = "Release of ${version}"
}
}
}
file "modpack.json" withReader {
ext.modpack = new groovy.json.JsonSlurper().parseText( it.text )
}
def version = "${modpack.version}-${grgit.head().abbreviatedId}"
task versions {
group "modpack"
description "List Mod-Versions and create VERSIONS.md"
def commonMods = fileTree( dir: "common/mods/", include: "*.jar" ).sort()
def clientMods = fileTree( dir: "client/mods/", include: "*.jar" ).sort()
def serverMods = fileTree( dir: "server/mods/", include: "*.jar" ).sort()
def versions = new File( "VERSIONS.md" )
doLast {
versions.createNewFile()
versions.text = ""
versions.append "# Mod-Versions\n"
versions.append "\n## Common\n"
commonMods.each { File file -> versions.append "- ${file.name}\n" }
versions.append "\n## Client\n"
clientMods.each { File file -> versions.append "- ${file.name}\n" }
versions.append "\n## Server\n"
serverMods.each { File file -> versions.append "- ${file.name}\n" }
}
}
task sync( dependsOn: [ "syncCommon", "syncClient", "syncServer" ] ) {
group "modpack"
description "Sync files from development client and server folder to common, client and server folder"
}
task syncCommon( type : Sync ) {
group "modpack"
description "Sync files from development client folder to common folder"
from "development/client/"
into "common/"
includes = modpack.common.includes
excludes = modpack.common.excludes.plus( modpack.client.includes )
}
task syncClient( type : Sync ) {
group "modpack"
description "Sync files from development client folder to client folder"
from "development/client/"
into "client/"
includes = modpack.client.includes
}
task syncServer( type : Sync ) {
group "modpack"
description "Sync files from development server folder to server folder"
from "development/server/"
into "server/"
includes = modpack.server.includes
}
task dev( dependsOn: [ "devClient", "devServer" ] ) {
group "modpack"
description "Create development client and server"
}
task devClient( dependsOn: [ "devClientCommon" ], type: Copy ) {
group "modpack"
description "Create development client"
from "client/"
into "development/client/"
}
task devClientCommon( type: Copy) {
group "modpack"
description "Copy common files to development client"
from "common/"
into "development/client/"
}
task devServer( dependsOn: [ "devServerCommon" ], type: Copy ) {
group "modpack"
description "Create development server"
from "server/"
into "development/server/"
}
task devServerCommon( type: Copy) {
group "modpack"
description "Copy common files to development server"
from "common/"
into "development/server/"
}
task pub( dependsOn: [ "pubClient", "pubServer" ] ) {
group "modpack"
description "Publish client and server"
}
task pubClient( dependsOn: [ "versions", "pubClientCommon" ], type: Copy ) {
group "modpack"
description "Publish client"
from "client/"
into "publish/${version}/client/"
doLast{
copy {
from "./"
into "publish/${version}/client/"
includes = modpack.publish.includes
}
}
}
task pubClientCommon( type: Copy) {
group "modpack"
description "Copy client files to pubelopment client"
from "common/"
into "publish/${version}/client/"
}
task pubServer( dependsOn: [ "versions", "pubServerCommon" ], type: Copy ) {
group "modpack"
description "Copy common and server files to pubelopment server"
from "server/"
into "publish/${version}/server/"
doLast{
copy {
from "./"
into "publish/${version}/server/"
includes = modpack.publish.includes
}
}
}
task pubServerCommon( type: Copy) {
group "modpack"
description "Copy common files to pubelopment server"
from "common/"
into "publish/${version}/server/"
}