-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
84 lines (72 loc) · 3.31 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
plugins {
id 'java'
id 'base'
}
apply plugin: 'java'
apply plugin: 'base'
group 'com.tomcatsaddons'
version '1.0-SNAPSHOT'
sourceCompatibility = '16'
repositories {
mavenCentral()
}
dependencies {
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.29'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
}
import com.tomcatsaddons.gradle.BuildAddonTask
import com.tomcatsaddons.gradle.WowToolsDownloadTask
import org.apache.tools.ant.filters.ReplaceTokens
def wowToolsDownloadTask = tasks.register("wowtools-download", WowToolsDownloadTask) { WowToolsDownloadTask task ->
group = "data"
}
def wowdirectory = project.property('com.tomcatsaddons.wowdirectory')
def addonProperties = new Properties()
addonProperties.load(file('addon.properties').newReader())
def currentTS = Long.toString((long)(System.currentTimeMillis() / 1000))
def expiry1day = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 1))
def expiry3days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 3))
def expiry5days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 5))
def expiry7days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 7))
def expiry10days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 10))
def expiry14days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 14))
def expiry30days = Long.toString(((long)(System.currentTimeMillis() / 1000)) + (60 * 60 * 24 * 30))
addonProperties.setProperty("expiry1day", expiry1day)
addonProperties.setProperty("expiry3days", expiry3days)
addonProperties.setProperty("expiry5days", expiry5days)
addonProperties.setProperty("expiry7days", expiry7days)
addonProperties.setProperty("expiry10days", expiry10days)
addonProperties.setProperty("expiry14days", expiry14days)
addonProperties.setProperty("expiry30days", expiry30days)
addonProperties.setProperty("currentTS", currentTS)
project.property('com.tomcatsaddons.games').split(',').each { String game ->
def buildTask = tasks.register("$game-build", BuildAddonTask) { BuildAddonTask task ->
dependsOn wowToolsDownloadTask
group = "addons"
task.tokens = addonProperties
task.game = game
task.includeFrom = project.property("com.tomcatsaddons.games.${game}.includeFrom").split(',')
}
project.property("com.tomcatsaddons.games.${game}.targets").split(',').each { String target ->
tasks.register("$game-deploy-$target", Copy) {
dependsOn buildTask
group = "addons"
doFirst {
delete("${wowdirectory}\\${target}\\Interface\\AddOns\\TomCats")
}
from("$buildDir/$game") {
include '**/*'
filesMatching(['**/*.toc', '**/*.xml', '**/*.lua', '**/*.html']) {
filteringCharset = 'UTF-8'
filter(ReplaceTokens, tokens: addonProperties)
}
}
from("$buildDir/${game}-mvel") {
include '**/*'
}
into "${wowdirectory}\\${target}\\Interface\\AddOns\\TomCats"
it.outputs.upToDateWhen{ false }
}
}
}