diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index eb6c31c..a848665 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -17,7 +17,7 @@ jobs: build: strategy: matrix: - java-version: [11, 17, 21] + java-version: [8, 11, 17, 21] os: - macos-latest - ubuntu-latest diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 48a5c25..68d009b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -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") } diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts index d41b539..3ceabc1 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts @@ -45,12 +45,12 @@ kotlin { tasks { withType().configureEach { - sourceCompatibility = JavaVersion.VERSION_11.toString() - targetCompatibility = JavaVersion.VERSION_11.toString() + sourceCompatibility = JavaVersion.VERSION_1_8.toString() + targetCompatibility = JavaVersion.VERSION_1_8.toString() } withType().configureEach { - compilerOptions.jvmTarget.set(JvmTarget.JVM_11) + compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8) } withType().configureEach { diff --git a/buildSrc/src/main/kotlin/buildsrc/utils/Rife2TestListener.kt b/buildSrc/src/main/kotlin/buildsrc/utils/Rife2TestListener.kt index 9e70473..59df2bd 100644 --- a/buildSrc/src/main/kotlin/buildsrc/utils/Rife2TestListener.kt +++ b/buildSrc/src/main/kotlin/buildsrc/utils/Rife2TestListener.kt @@ -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 @@ -41,23 +40,23 @@ class Rife2TestListener( if (apiKey != null) { println(apiKey) - val response: HttpResponse = 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) } } }