-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
109 lines (99 loc) · 2.99 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
109 lines (99 loc) · 2.99 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
alias(libs.plugins.build.config)
alias(libs.plugins.maven.publish)
alias(libs.plugins.test.retry)
checkstyle
`java-library`
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
dependencies {
api(libs.gson)
implementation(libs.bundles.common)
compileOnly(libs.jetbrains)
implementation(project(":network-client-core"))
if (findProperty("okhttp") == null) {
runtimeOnly(project(":network-client-default"))
} else {
runtimeOnly(project(":network-client-okhttp"))
}
testImplementation(libs.bundles.tests)
}
buildConfig {
useJavaOutput()
packageName = "io.ably.lib"
buildConfigField("String", "LIBRARY_NAME", "\"java\"")
buildConfigField("String", "VERSION", "\"${property("VERSION_NAME")}\"")
}
sourceSets {
named("main") {
java {
srcDirs("src/main/java", "../lib/src/main/java")
}
}
named("test") {
java {
srcDirs("src/test/java", "../lib/src/test/java")
}
}
}
tasks.checkstyleMain.configure {
exclude("io/ably/lib/BuildConfig.java")
}
tasks.register<Test>("testRealtimeSuite") {
filter {
includeTestsMatching("*RealtimeSuite")
}
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED")
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
beforeTest(closureOf<TestDescriptor> { logger.lifecycle("-> $this") })
outputs.upToDateWhen { false }
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
retry {
maxRetries.set(3)
maxFailures.set(8)
failOnPassedAfterRetry.set(false)
failOnSkippedAfterRetry.set(false)
}
}
tasks.register<Test>("testRestSuite") {
filter {
includeTestsMatching("*RestSuite")
}
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED")
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
beforeTest(closureOf<TestDescriptor> { logger.lifecycle("-> $this") })
outputs.upToDateWhen { false }
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
retry {
maxRetries.set(3)
maxFailures.set(8)
failOnPassedAfterRetry.set(false)
failOnSkippedAfterRetry.set(false)
}
}
/*
Test task to run pure unit tests, where pure means that they only run
locally and do not need to communicate with Ably servers.
This is achieved by excluding everything in the io.ably.lib.test package,
as it only contains the REST and Realtime suites.
*/
tasks.register<Test>("runUnitTests") {
filter {
excludeTestsMatching("io.ably.lib.test.*")
}
jvmArgs("--add-opens", "java.base/java.time=ALL-UNNAMED")
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
beforeTest(closureOf<TestDescriptor> { logger.lifecycle("-> $this") })
outputs.upToDateWhen { false }
}