-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
98 lines (78 loc) · 2.01 KB
/
Copy pathbuild.gradle
File metadata and controls
98 lines (78 loc) · 2.01 KB
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
apply plugin: "java"
defaultTasks "wrapper", "watch", "dependencies", "build", "testSpock"
sourceCompatibility = 1.8
version = "0.6.0"
def aptPackages = ["libspock-java"]
def path = System.getProperty("user.dir")
def srcDir = "${path}/src"
def testDir = "${path}/test"
task wrapper(type: Wrapper) {
description "Creates the project wrapper."
gradleVersion = "3.4.1"
}
task watch(type: Exec) {
description "Watches for changes."
inputs.files(srcDir, testDir)
commandLine "true"
new ByteArrayOutputStream()
}
task dependencies() {
description "Installs all dependencies."
dependsOn {
tasks.findAll { task ->
task.name.startsWith("dependencies") && !task.name.equals("dependencies")
}
}
}
task aptUpdate(type: Exec) {
description "Updates APT repository information."
workingDir path
commandLine "apt-get"
args "update"
new ByteArrayOutputStream()
}
task dependenciesApt(type: Exec, dependsOn: aptUpdate) {
description "Installs APT dependencies."
workingDir path
commandLine "apt-get"
args = ["install", "-y"] + aptPackages
new ByteArrayOutputStream()
}
jar {
manifest {
attributes "Implementation-Title": "SkyScanner Business Client",
"Implementation-Version": version
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: "org.json", name: "json", version: "20160810"
testCompile group: "junit", name: "junit", version: "4.+"
}
uploadArchives {
repositories {
flatDir {
dirs "repos"
}
}
}
task testSpock() {
description "Runs all test cases."
dependsOn {
tasks.findAll { task ->
task.name.startsWith("testSpock") && !task.name.equals("testSpock")
}
}
}
fileTree(dir: "${testDir}", include: "**/*.groovy").each { File testFile ->
def fileName = testFile.getName().split("\\.")[0]
task "testSpock${fileName}"(type: Exec) {
description "Runs the ${fileName} case."
workingDir path
commandLine "groovy"
args "-cp", "/usr/share/java/spock-core.jar", testFile
new ByteArrayOutputStream()
}
}