-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.gradle
98 lines (80 loc) · 2.66 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
plugins {
// Use metadata from git
id 'git-metadata'
// Ensure archives are reproducible
id 'reproducible-archives'
}
ext.releaseName = { ->
return "${rootProject.getName()} - ${gitCommitDate()}-${gitCommitCount()}-${gitCommitHash()}"
}
tasks.register('run', JavaExec) {
group 'build'
description 'Run IdleRSC.'
dependsOn ':app:build'
File appJar = new File(project(':app').getBuildDir(), "libs/${project(':app').getName()}.jar")
classpath = files(appJar)
}
tasks.register('buildPatchedClient', JavaExec) {
group 'build'
description 'Create patched client jar archive.'
dependsOn ':client:build', ':patcher:build', ':patcher:spotlessApply'
File patcherJar = new File(project(':patcher').getBuildDir(), "libs/${project(':patcher').getName()}.jar")
File clientJar = new File(project(':client').getBuildDir(), "libs/${project(':client').getName()}.jar")
File patchedClientJar = new File(project(':patcher').getBuildDir(), 'libs/patched_client.jar')
classpath = files(patcherJar)
args clientJar, patchedClientJar
outputs.upToDateWhen {
patchedClientJar.exists()
}
}
tasks.register('createClientCache', Zip) {
group 'build'
description 'Create client cache for inclusion in the jar archive.'
archiveFileName = 'ZipCache.zip'
destinationDirectory = project(':app').file('src/main/resources/cache/')
from('assets/cache/')
include '**/*'
}
tasks.register('copyMapData', Copy) {
group 'build'
description 'Copy map data for inclusion in the jar archive.'
from 'assets/map'
into project(':app').file('src/main/resources/assets/map')
}
tasks.register('copySleepData', Copy) {
group 'build'
description 'Copy asset data for inclusion in the jar archive.'
from 'assets/sleep'
into project(':app').file('src/main/resources/assets/sleep')
}
tasks.register('prepareRelease', Copy) {
group 'Distribution'
description 'Prepare files for release zip.'
dependsOn ':app:build'
// Final JAR
from("${project(':app').getBuildDir()}/libs") {
rename 'app.jar', "${rootProject.name}.jar"
}
// documentation and cache
from ("${rootProject.projectDir}") {
include 'scripts/'
include 'doc/'
include 'README.md', 'LICENSE'
}
into "build/${releaseName()}"
}
tasks.register('release', Zip) {
release.mustRunAfter(prepareRelease)
group 'Distribution'
description 'Create release zip for end-users.'
dependsOn prepareRelease
archiveFileName = "${releaseName()}.zip"
destinationDirectory = rootProject.getProjectDir()
// Configure zip task to place contents in IdleRSC folder
into('IdleRSC') {
from("build/${releaseName()}") {
include '**/*' // Ensure all files are included
//into('.')
}
}
}