-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
131 lines (118 loc) · 4.4 KB
/
build.gradle.kts
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
plugins {
java
kotlin("jvm") version "2.0.20"
id("maven-publish")
id("java-library")
id("org.jetbrains.dokka") version "1.9.20"
id("com.avast.gradle.docker-compose") version ("0.17.8")
}
group = "it.testee"
version = "1.7.5"
repositories {
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
}
dependencies {
// kotlin
implementation("org.jetbrains.kotlin:kotlin-stdlib")
// selenium
implementation("org.seleniumhq.selenium:selenium-java:4.25.0")
// testng
implementation("org.testng", "testng", "7.5")
// reportng
implementation("com.github.hibissscus:reportng:1.5.6")
}
tasks {
test {
description = "run e2e test locally"
group = "verification"
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
reports.html.required.set(false)
reports.junitXml.required.set(false)
useTestNG {
suites("src/test/resources/local.xml")
useDefaultListeners = false
listeners = setOf("testee.it.reportng.HTMLReporter")
systemProperties = mapOf(
"testee.it.version" to "$version",
"testee.it.reportng.title" to "testee-e2e",
"testee.it.reportng.color" to "#f0f8ff",
"testee.it.reportng.zip" to "true",
"testee.it.reportng.slack" to "false",
"testee.it.reportng.slack.token" to "xxxx-xxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",
"testee.it.reportng.slack.channel" to "xxxx"
)
}
}
}
tasks.register<Test>("docker") {
description = "run entire e2e test suite"
group = "verification"
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
reports.html.required.set(false)
reports.junitXml.required.set(false)
useTestNG {
suites("src/test/resources/docker.xml")
useDefaultListeners = false
listeners = setOf("testee.it.reportng.HTMLReporterRuntime", "testee.it.reportng.HTMLReporter")
systemProperties = mapOf(
"e2e.selenium" to System.getProperty("e2e.selenium", ""),
"e2e.url" to System.getProperty("e2e.url", ""),
"testee.it.version" to "$version",
"testee.it.reportng.title" to "testee-e2e-docker",
"testee.it.reportng.color" to "#fff0f5",
"testee.it.reportng.zip" to "true",
"testee.it.reportng.slack" to "false",
"testee.it.reportng.slack.token" to "xxxx-xxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",
"testee.it.reportng.slack.channel" to "xxxx"
)
}
}
val dokkaJavadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.get().outputDirectory.get())
archiveClassifier.set("javadoc")
}
val sourcesJar by tasks.creating(Jar::class) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
from("LICENSE.txt") { into("META-INF") }
from("README.md") { into("META-INF") }
}
tasks {
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().filter {
it.name.contains("reportng") || it.name.contains("velocity") || it.name.contains("spring-web") || it.name.contains("commons-collections") || it.name.contains(
"commons-lang"
) || it.name.contains("gson") || it.name.contains("guice") || it.name.contains("inject") || it.name.contains("aopalliance")
}.onEach { println("add from dependencies: ${it.name}") }.map { if (it.isDirectory) it else zipTree(it) })
val sourcesMain = sourceSets.main.get()
sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
from(sourcesMain.output)
}
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = rootProject.name
groupId = project.group.toString()
version = project.version.toString()
from(components["java"])
}
}
}
dockerCompose {
useComposeFiles.add(
if (org.gradle.internal.os.OperatingSystem.current() != null &&
org.gradle.internal.os.OperatingSystem.current().toString().contains("aarch64")
) "docker-compose-arm.yml"
else "docker-compose.yml"
)
isRequiredBy(tasks.getByName("docker"))
}