-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
124 lines (102 loc) · 3.3 KB
/
build.gradle
File metadata and controls
124 lines (102 loc) · 3.3 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
plugins {
id 'java'
id 'application'
}
application {
mainClassName = 'se.clouds.javanet.app.Program'
}
dependencies {
compile project(':Components:shared')
compile project(':Components:core')
compile project(':Components:app')
}
subprojects {
version = '1.0'
}
sourceCompatibility = 12
targetCompatibility = 12
allprojects {
repositories {
jcenter()
}
}
sourceSets {
intTest {
java {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
intTestImplementation.extendsFrom implementation
intTestRuntimeOnly.extendsFrom runtimeOnly
}
dependencies {
intTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
}
task integrationTest(type: Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
}
check.dependsOn integrationTest
task DotnetBuild(type: Exec, group: '.NET', description: 'Build dotnet') {
workingDir './'
commandLine "dotnet", "build"
}
task DotnetPublish(type: Exec, group: '.NET', description: 'Publish dotnet') {
workingDir './'
commandLine "dotnet", "publish", "-c", "Release", "-o", "out"
}
task DotnetRun(type: Exec, group: '.NET', description: 'Run dotnet') {
workingDir './'
commandLine "dotnet", "run"
}
task CheckSwarm(type: Exec, group: 'Docker', description: 'Build dotnet docker') {
commandLine "sh", "-c", "./Tools/checkSwarm.sh"
doLast {
if(execResult.exitValue == 0) {
println('OK')
} else {
throw new GradleException('ERROR: Not a swarm node, see output above from checkSwarm')
}
}
}
task DockerBuildJava(type: Exec, group: 'Docker', description: 'Build java docker') {
workingDir './'
commandLine "docker", "build", "-t", "javanetapp", "-f", "docker/java.Dockerfile", "."
}
task DockerBuildDotnet(type: Exec, group: 'Docker', description: 'Build dotnet docker') {
workingDir './'
commandLine "docker", "build", "-t", "dotnetapp", "-f", "docker/dotnet.Dockerfile", "."
}
task DockerClean(type: Exec, group: 'Docker', description: 'Remove dotnet and java docker images') {
workingDir './'
commandLine "docker", "rmi", "javanetapp", "dotnetapp"
}
task StackStop(type: Exec, group: 'Docker', description: 'Stop stack') {
workingDir './'
commandLine "docker", "stack", "rm", "app"
}
task StackRun(type: Exec, group: 'Docker', description: 'Run stack') {
workingDir './'
commandLine "docker", "stack", "deploy", "-c", "stack.docker.yml", "app"
}
task StackBuildAndRun(type: Exec, group: 'Docker', description: 'Build and run stack') {
workingDir './'
commandLine "docker", "stack", "deploy", "-c", "stack.docker.yml", "app"
}
task Run(type: Exec, group: 'Docker', description: 'Run all in Docker swarm') {
workingDir './'
commandLine "echo", "Run stack..."
}
StackBuildAndRun.dependsOn CheckSwarm
StackBuildAndRun.dependsOn StackStop
StackBuildAndRun.dependsOn DockerBuildJava
StackBuildAndRun.dependsOn DockerBuildDotnet
Run.dependsOn StackBuildAndRun