-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
110 lines (86 loc) · 2.92 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
group 'eu.thijslemmens'
version '1.0-SNAPSHOT'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:3.0.11'
classpath "com.avast.gradle:gradle-docker-compose-plugin:0.6.9"
}
}
apply plugin: 'scala'
apply plugin: 'idea'
apply plugin: 'application'
apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin
apply plugin: 'docker-compose'
sourceSets {
integrationTest {
scala {
srcDir 'src/integration-test/scala'
}
}
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'org.scala-lang:scala-library:2.12.3'
compile group: 'com.typesafe.akka', name: 'akka-actor_2.12', version: '2.5.6'
compile group: 'com.typesafe.akka', name: 'akka-stream_2.12', version:'2.5.6'
compile 'com.github.mauricio:postgresql-async_2.12:0.2.21'
testCompile 'org.scalatest:scalatest_2.12:3.0.4'
testCompile group: 'com.typesafe.akka', name: 'akka-testkit_2.12', version: '2.5.6'
testCompile 'org.scalamock:scalamock_2.12:4.0.0'
testCompile 'junit:junit:4.12'
integrationTestCompile configurations.testCompile
integrationTestCompile group: 'org.postgresql', name: 'postgresql', version: '42.1.4'
integrationTestRuntime configurations.testRuntime
}
task wrapper(type: Wrapper) {
gradleVersion = '4.3'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
mainClassName = 'eu.thijslemmens.carbonpostgres.Main'
import com.bmuschko.gradle.docker.tasks.image.*
task prepareDockerBuild(type: Copy){
dependsOn installDist
from 'src/main/docker'
from installDist.destinationDir.parent
into "$buildDir/docker"
}
task buildDockerImage(type: DockerBuildImage){
dependsOn prepareDockerBuild
inputDir = project.file("$buildDir/docker")
buildArgs = ['PROJECT_NAME': installDist.destinationDir.name]
doLast {
project.extensions.getByName('dockerCompose').environment.put('DOCKER_IMAGE', imageId)
}
}
dockerCompose {
useComposeFiles = ['src/main/docker-compose/docker-compose.yml']
projectName = project.name
}
composeUp.dependsOn(buildDockerImage)
task integrationTest(type: Test) {
dependsOn(composeUp)
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen {false}
//getting the port info
doFirst {
def cpServiceInfo = composeUp.getServicesInfos().get("carbon-postgres")
systemProperty("tcp.host", cpServiceInfo.host)
systemProperty("tcp.port", cpServiceInfo.port)
def tsServiceInfo = composeUp.getServicesInfos().get("timescaledb")
systemProperty("timescaledb.host", tsServiceInfo.host)
systemProperty("timescaledb.port", tsServiceInfo.port)
}
finalizedBy {
composeDown
}
}
test {
outputs.upToDateWhen {false}
}