-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
205 lines (153 loc) · 5.15 KB
/
Copy pathbuild.gradle
File metadata and controls
205 lines (153 loc) · 5.15 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* Build file HotCiv mandatory project in SWEA.
Code **cannot** compile and test using Gradle prior to 4.6, so
you need to use the gradle wrapper! And there is a bootstrap
issue, as the useJunitPlatform() call in this build file will
generate a build failure for gradle 4.4 which is the default
on Linux 20.04.
So - start the project by COMMENTING OUT THE useJUnitPlatform() call
in the build file below, and next issuing the following commands in
your shell
gradle wrapper
Next, remove the comment so the useJUnitPlatform() again becomes
active, and all following gradle command must then have the format
ala
./gradlew test
History:
Updated to provide more partial solution code, Sep 2020
Converted to Gradle 6.5, Jacoco 0.8.5, and JUnit 5, Aug 2020
Converted to Gradle build system, Mar 2018
Adapted for the SWEA course,
added the 'review' target, Jun 2017
Updated for hamcrest libraries, Oct 2015
This source code is from the book
"Flexible, Reliable Software:
Using Patterns and Agile Development"
published 2010 by CRC Press.
Author:
Henrik B Christensen
Computer Science Department
Aarhus University
This source code is provided WITHOUT ANY WARRANTY either
expressed or implied. You may study, use, modify, and
distribute it for non-commercial purposes. For any
commercial use, see http://www.baerbak.com/
*/
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/henrikbaerbak/maven'
}
}
dependencies {
// Depend on the MiniDraw library
implementation 'com.baerbak.maven:minidraw:1.13'
implementation 'com.baerbak.maven:broker:2.0'
// Depend on JUnit 5. Require both API and Engine
testImplementation group: 'org.junit.jupiter',
name: 'junit-jupiter-api', version: '5.6.2'
testRuntimeOnly group: 'org.junit.jupiter',
name: 'junit-jupiter-engine', version: '5.6.2'
// Use the Hamcrest matcher library
testImplementation group: 'org.hamcrest',
name: 'hamcrest-library', version: '2.2'
// fractal map dependency
implementation 'com.baerbak.maven:hotciv-fractal:1.0'
}
// Tell to use JUnit as testing platform
test {
useJUnitPlatform()
}
// Sigh, JUnit 5 only works with JUnit 4.6+, so upgrade gradle
wrapper {
gradleVersion = '6.5'
}
// Use latest Jacoco test coverage tool
jacoco {
toolVersion = "0.8.5"
}
// === Execution tasks - for running the various integration tests
// for manual test-driving the MiniDraw framework customization.
// === Demonstrate specialized MiniDraw implementations
task show(type: JavaExec) {
group 'SWEA HotCiv Demonstration'
description 'Demonstrate MapView'
main = 'hotciv.visual.ShowWorld'
classpath = sourceSets.main.runtimeClasspath
}
task text(type: JavaExec) {
group 'SWEA HotCiv Demonstration'
description 'Demonstrate TextFigure'
main = 'hotciv.visual.ShowText'
classpath = sourceSets.main.runtimeClasspath
}
task city(type: JavaExec) {
group 'SWEA HotCiv Demonstration'
description 'Demonstrate CityFigure'
main = 'hotciv.visual.ShowCity'
classpath = sourceSets.main.runtimeClasspath
}
// === Placeholders for YOUR work on solving SWEA exercises
task update(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test CivDrawing, FRAS 36.38'
main = 'hotciv.visual.ShowUpdating'
classpath = sourceSets.main.runtimeClasspath
}
task move(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test UnitMoveTool, FRS 36.39'
main = 'hotciv.visual.ShowMove'
classpath = sourceSets.main.runtimeClasspath
}
task setfocus(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test SetFocusTool, FRS 36.40'
main = 'hotciv.visual.ShowSetFocus'
classpath = sourceSets.main.runtimeClasspath
}
task turn(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test EndOfTurnTool, FRS 36.42'
main = 'hotciv.visual.ShowEndOfTurn'
classpath = sourceSets.main.runtimeClasspath
}
task action(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test ActionTool, FRS 36.43'
main = 'hotciv.visual.ShowAction'
classpath = sourceSets.main.runtimeClasspath
}
task comp(type: JavaExec) {
group 'SWEA Mandatory'
description 'Test CompositionTool, FRS 36.44'
main = 'hotciv.visual.ShowComposition'
classpath = sourceSets.main.runtimeClasspath
}
task semi(type: JavaExec) {
group 'SWEA Mandatory'
description ' Play SemiCiv using the GUI :-)'
main = 'hotciv.visual.ShowSemiCiv'
classpath = sourceSets.main.runtimeClasspath
}
task hotcivServer(type: JavaExec) {
group 'SWEA Distribution'
description 'Run HotCiv server (Socket)'
classpath sourceSets.test.runtimeClasspath
main = 'hotciv.common.HotCivServer'
}
task hotcivClient(type: JavaExec) {
group 'SWEA Distribution'
description 'Run HotCiv Client (Socket)'
classpath sourceSets.test.runtimeClasspath
main = 'hotciv.common.HotCivClient'
args "test"
}
task hotcivStoryTest(type: JavaExec) {
group 'SWEA Distribution'
description 'Run HotCiv Story test (Socket)'
classpath sourceSets.test.runtimeClasspath
main = 'hotciv.common.HotCivClient'
args "story"
}