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:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [11, 17, 21]
|
java-version: [8, 11, 17, 21]
|
||||||
os:
|
os:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
|
|
|
@ -8,4 +8,5 @@ dependencies {
|
||||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
||||||
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4")
|
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4")
|
||||||
|
implementation("org.apache.httpcomponents:httpclient:4.5.13")
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,12 @@ kotlin {
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<JavaCompile>().configureEach {
|
withType<JavaCompile>().configureEach {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||||
targetCompatibility = JavaVersion.VERSION_11.toString()
|
targetCompatibility = JavaVersion.VERSION_1_8.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<KotlinJvmCompile>().configureEach {
|
withType<KotlinJvmCompile>().configureEach {
|
||||||
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
|
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Test>().configureEach {
|
withType<Test>().configureEach {
|
||||||
|
|
|
@ -16,14 +16,13 @@
|
||||||
|
|
||||||
package buildsrc.utils
|
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.provider.Provider
|
||||||
import org.gradle.api.tasks.testing.TestDescriptor
|
import org.gradle.api.tasks.testing.TestDescriptor
|
||||||
import org.gradle.api.tasks.testing.TestListener
|
import org.gradle.api.tasks.testing.TestListener
|
||||||
import org.gradle.api.tasks.testing.TestResult
|
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(
|
class Rife2TestListener(
|
||||||
private val testBadgeApiKey: Provider<String>
|
private val testBadgeApiKey: Provider<String>
|
||||||
|
@ -41,23 +40,23 @@ class Rife2TestListener(
|
||||||
|
|
||||||
if (apiKey != null) {
|
if (apiKey != null) {
|
||||||
println(apiKey)
|
println(apiKey)
|
||||||
val response: HttpResponse<String> = HttpClient.newHttpClient()
|
val url = "https://rife2.com/tests-badge/update/net.thauvin.erik/urlencoder?" +
|
||||||
.send(
|
|
||||||
HttpRequest.newBuilder()
|
|
||||||
.uri(
|
|
||||||
URI(
|
|
||||||
"https://rife2.com/tests-badge/update/net.thauvin.erik/urlencoder?" +
|
|
||||||
"apiKey=$apiKey&" +
|
"apiKey=$apiKey&" +
|
||||||
"passed=$passed&" +
|
"passed=$passed&" +
|
||||||
"failed=$failed&" +
|
"failed=$failed&" +
|
||||||
"skipped=$skipped"
|
"skipped=$skipped"
|
||||||
)
|
|
||||||
)
|
val client = HttpClients.createDefault()
|
||||||
.POST(HttpRequest.BodyPublishers.noBody())
|
val post = HttpPost(url)
|
||||||
.build(), HttpResponse.BodyHandlers.ofString()
|
|
||||||
)
|
val response = client.execute(post)
|
||||||
println("RESPONSE: ${response.statusCode()}")
|
val entity = response.entity
|
||||||
println(response.body())
|
|
||||||
|
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