-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexamples.gradle
57 lines (50 loc) · 1.94 KB
/
examples.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
/* This is where all tasks for example usages of Slope-ECS go.
*
* When creating an example usage, a task must be created for the program here, following the
* provided template.
*
* For those of you aspiring to make examples, give it your best effort! Remember, we require clean
* code in order for the example to be accepted -- try to make the program relatively easy to
* understand, execute, and (if it's a game) play through.
*
* This is heavily based on RichTextFX's demos implementation, so give them a look-see when you get
* a chance: https://github.com/FXMisc/RichTextFX */
task examples(description: "Lists each example program, and a short description of it such that it can be run by a Gradle task.") {
doLast {
// get examples
def examplesList = []
tasks.withType(JavaExec) {
if (it.name.endsWith("Example")) {
examplesList.add(it)
}
}
// sort examples
examplesList.sort {
first, next -> first.name <=> next.name
}.each {
println("""
Slope-ECS Examples
------------------""")
println("$it.name: $it.description")
}
}
}
sourceSets {
examples {
/*
To add a task for an example, use the following template:
task MainClassExample(type: JavaExec) {
// standardInput = System.in // Uncomment this if you need user input.
description('A description of your Slope-ECS example usage.')
classpath = sourceSets.examples.runtimeClasspath
main = 'examples.classpackage.MainClassExample'
}
*/
task GuessingGameExample(type: JavaExec) {
standardInput = System.in
description('An example usage of Slope-ECS: a guessing game.')
classpath = files(sourceSets.main.output, sourceSets.examples.runtimeClasspath)
main = 'examples.guessinggame.GuessingGameExample'
}
}
}