-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
105 lines (92 loc) · 2.74 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
plugins {
id 'java'
id "com.bmuschko.docker-java-application" version "6.7.0"
}
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
apply plugin: 'application'
group 'com.parallel.computing'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'com.bmuschko.docker-java-application'
task createMainDockerfile(type: Dockerfile) {
dependsOn jar
ext {javaMainClass = "com.parallel.computing.Main"}
destFile = project.file("app_server.Dockerfile")
from 'openjdk:8'
copyFile 'build/libs/'+jar.archiveName, 'app.jar'
entryPoint 'java', '-cp', 'app.jar', javaMainClass
exposePort 3333
}
task createClientDockerfile(type: Dockerfile) {
dependsOn jar
ext {javaMainClass = "com.parallel.computing.ClientSession"}
destFile = project.file("app_client.Dockerfile")
from 'openjdk:8'
copyFile 'build/libs/'+jar.archiveName, 'app.jar'
entryPoint 'java', '-cp', 'app.jar', javaMainClass
exposePort 3333
}
sourceSets {
main {
java {
srcDirs = ['src']
}
}
test {
java {
srcDirs = ['tests']
}
}
}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.2'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.5.0'
compile 'org.json:json:20210307'
compile 'junit:junit:4.12'
compile 'org.junit.jupiter:junit-jupiter:5.8.0-M1'
}
test {
useJUnitPlatform()
reports.html.enabled = false
}
configurations {
binaryTestResultsElements {
canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'test-report-data'))
}
outgoing.artifact(test.binaryResultsDirectory)
}
}
jar {
manifest {
attributes(
'Implementation-Title': 'gscc-groupme-logs',
'Class-Path': configurations.compile.collect { it.getName() }.join(' ')
)
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task runServer(type: Exec) {
dependsOn jar
group = "Execution"
description = "Run server"
ext {javaMainClass = "com.parallel.computing.Main"}
commandLine "java", "-classpath", jar.archiveFile.get(), javaMainClass
}
task runClient(type: Exec) {
dependsOn jar
group = "Execution"
description = "Run client"
standardInput = System.in
ext {javaMainClass = "com.parallel.computing.ClientSession"}
commandLine "java", "-classpath", jar.archiveFile.get(), javaMainClass
}