forked from nusco/narjillos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (131 loc) · 4.8 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
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
// Plugins
plugins {
id 'java'
id 'application' // also loads the 'distribution' plugin
id 'eclipse'
id 'idea'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
// Basic Configuration
sourceCompatibility = JavaVersion.VERSION_12
mainClassName = 'org.nusco.narjillos.NarjillosRunner'
javafx {
version = "12.0.1"
modules = [ 'javafx.controls' ]
}
// Dependencies
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.code.gson:gson:2.3.1'
implementation 'commons-cli:commons-cli:1.2'
implementation 'org.yaml:snakeyaml:1.15'
implementation 'org.xerial:sqlite-jdbc:3.8.11.1'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.8.4'
}
// Programs
createProgramTask('narjillos', 'org.nusco.narjillos.NarjillosRunner', 'Runs Narjillos (same arguments as the \'narjillos\' script).')
createProgramTask('dnabrowser', 'org.nusco.narjillos.DNABrowserRunner', 'Runs the DNA Browser (pass it the *.germline filename).')
createProgramTask('lab', 'org.nusco.narjillos.Lab', 'Runs lab analysis (pass it the *.exp filename).')
// Tests
test {
description "Runs standard suite of unit tests."
include '**/*Test*'
exclude '**/*PerformanceTest*'
exclude '**/*DeterministicExperimentTest*'
testLogging.showStandardStreams = true
}
task(testPerformance, dependsOn: 'compileJava', type: JavaExec) {
description = 'Runs performance test.'
group = 'verification'
main = 'org.nusco.narjillos.PerformanceTest'
classpath = sourceSets.test.runtimeClasspath
}
task(testDeterministic, dependsOn: 'compileJava', type: JavaExec) {
description = 'Runs the (slow) test that checks whether the system is deterministic.'
group = 'verification'
main = 'org.nusco.narjillos.DeterministicExperimentTest'
classpath = sourceSets.test.runtimeClasspath
}
task testAll(dependsOn: ['test', 'testDeterministic', 'testPerformance']) {
description = 'Runs all the tests, including the slow tests, the database tests and the performance tests.'
group = 'verification'
}
// Backlog Management
task(bl, dependsOn: 'build', type: JavaExec) {
main = 'org.nusco.narjillos.Backlog'
classpath = sourceSets.main.runtimeClasspath
args commandLineArgsOr('all')
}
task(backlog, dependsOn: 'bl') {
description = 'Prints the top of the backlog. Also aliased to \'bl\'.'
group = 'development'
}
// Packaging
// TODO: remove these once the issue with duplicatesStrategy has been fixed
// (see: https://github.com/gradle/gradle/issues/17236)
tasks.named('distTar') { duplicatesStrategy = 'include' }
tasks.named('distZip') { duplicatesStrategy = 'include' }
tasks.named('installDist') { duplicatesStrategy = 'include' }
// END TODO
applicationDistribution.from(
files(
'version',
'LICENSE',
'README.md',
'config.yaml'
)
)
task writeDockerfile() {
description = 'Generates a new Dockerfile for the current version.'
def dockerfile = new File('Dockerfile')
dockerfile.write ""
dockerfile << "FROM java\n"
dockerfile << "MAINTAINER Paolo \"Nusco\" Perrotta <[email protected]>\n\n"
dockerfile << "RUN wget https://github.com/nusco/narjillos/releases/download/v0.8.1/narjillos.zip -O narjillos.zip && unzip -o narjillos.zip && rm narjillos.zip\n"
dockerfile << "WORKDIR narjillos\n"
dockerfile << "CMD sh narjillos -f -s\n"
}
task createStartupScripts(dependsOn: 'installDist') {
createScript('lab', 'org.nusco.narjillos.Lab')
createScript('dnabrowser', 'org.nusco.narjillos.DNABrowserRunner')
}
task release(dependsOn: ['writeDockerfile', 'testAll', 'createStartupScripts', 'assemble']) {
description = 'Runs all tests and packages a release.'
group = 'distribution'
}
// Helpers
def createProgramTask(taskName, mainClassName, taskDescription) {
tasks.create(name: taskName, type: JavaExec) {
description = taskDescription
group = 'programs'
main = mainClassName
classpath = sourceSets.main.runtimeClasspath
args commandLineArgsOr([])
}
}
def commandLineArgsOr(defaultArgs) {
if (project.hasProperty('args') && project.getProperty('args').trim().length() > 0)
return project.args.split('\\s+')
else
return defaultArgs
}
def createScript(name, mainClass) {
def taskName = name + 'StartScript'
tasks.create(name: taskName, type: CreateStartScripts) {
outputDir = new File(buildDir, 'scripts')
mainClassName = mainClass
applicationName = name
classpath = tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + configurations.runtimeClasspath
}
tasks[taskName].dependsOn(project.jar)
applicationDistribution.with {
into('bin/') {
from(tasks[taskName])
fileMode = 0755
}
}
}