feat: Java 8 compatibility (#19)
Closes #18 Co-authored-by: Ronny Bräunlich <ronny.braeunlich@cbc.de>
This commit is contained in:
parent
dd3d500496
commit
6f33f9c2a9
4 changed files with 25 additions and 25 deletions
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [11, 17, 21]
|
||||
java-version: [8, 11, 17, 21]
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
|
|
|
@ -8,4 +8,5 @@ dependencies {
|
|||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
||||
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4")
|
||||
implementation("org.apache.httpcomponents:httpclient:4.5.13")
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ kotlin {
|
|||
|
||||
tasks {
|
||||
withType<JavaCompile>().configureEach {
|
||||
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||
targetCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||
}
|
||||
|
||||
withType<KotlinJvmCompile>().configureEach {
|
||||
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
|
||||
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
|
||||
}
|
||||
|
||||
withType<Test>().configureEach {
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
|
||||
package buildsrc.utils
|
||||
|
||||
import org.apache.http.client.methods.HttpPost
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import org.apache.http.util.EntityUtils
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.testing.TestDescriptor
|
||||
import org.gradle.api.tasks.testing.TestListener
|
||||
import org.gradle.api.tasks.testing.TestResult
|
||||
import java.net.URI
|
||||
import java.net.http.HttpClient
|
||||
import java.net.http.HttpRequest
|
||||
import java.net.http.HttpResponse
|
||||
|
||||
class Rife2TestListener(
|
||||
private val testBadgeApiKey: Provider<String>
|
||||
|
@ -41,23 +40,23 @@ class Rife2TestListener(
|
|||
|
||||
if (apiKey != null) {
|
||||
println(apiKey)
|
||||
val response: HttpResponse<String> = HttpClient.newHttpClient()
|
||||
.send(
|
||||
HttpRequest.newBuilder()
|
||||
.uri(
|
||||
URI(
|
||||
"https://rife2.com/tests-badge/update/net.thauvin.erik/urlencoder?" +
|
||||
"apiKey=$apiKey&" +
|
||||
"passed=$passed&" +
|
||||
"failed=$failed&" +
|
||||
"skipped=$skipped"
|
||||
)
|
||||
)
|
||||
.POST(HttpRequest.BodyPublishers.noBody())
|
||||
.build(), HttpResponse.BodyHandlers.ofString()
|
||||
)
|
||||
println("RESPONSE: ${response.statusCode()}")
|
||||
println(response.body())
|
||||
val url = "https://rife2.com/tests-badge/update/net.thauvin.erik/urlencoder?" +
|
||||
"apiKey=$apiKey&" +
|
||||
"passed=$passed&" +
|
||||
"failed=$failed&" +
|
||||
"skipped=$skipped"
|
||||
|
||||
val client = HttpClients.createDefault()
|
||||
val post = HttpPost(url)
|
||||
|
||||
val response = client.execute(post)
|
||||
val entity = response.entity
|
||||
|
||||
val statusCode = response.statusLine.statusCode
|
||||
val responseBody = EntityUtils.toString(entity, "UTF-8")
|
||||
|
||||
println("RESPONSE: $statusCode")
|
||||
println(responseBody)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue