fix pdns api clients (retry 16x)

reflect-config.json add
This commit is contained in:
dalbodeule 2024-06-07 13:35:35 +09:00
parent 9a406f1b3e
commit bc537299e5
No known key found for this signature in database
GPG Key ID: EFA860D069C9FA65
5 changed files with 18 additions and 11 deletions

View File

@ -81,7 +81,7 @@ tasks.withType<BootBuildImage> {
environment = mapOf(
"BP_NATIVE_IMAGE" to "true",
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "-H:+UnlockExperimentalVMOptions -H:ReflectionConfigurationFiles=src/main/resources/reflect-config.json",
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "-H:+UnlockExperimentalVMOptions",
"BP_JVM_TYPE" to "JDK",
"BP_JVM_VERSION" to "21",
)
@ -100,6 +100,5 @@ tasks.named<org.springframework.boot.gradle.tasks.run.BootRun>("bootRun") {
graalvmNative {
binaries.all {
buildArgs.add("--initialize-at-build-time=org.slf4j.helpers")
buildArgs.add("-H:ReflectionConfigurationFiles=src/main/resources/reflect-config.json")
}
}

6
reflect-config.json Normal file
View File

@ -0,0 +1,6 @@
[
{
"name": "java.lang.reflect.RecordComponent",
"allPublicMethods": true
}
]

View File

@ -1,6 +1,7 @@
package space.mori.dnsapi
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
@ -126,7 +127,11 @@ class PowerDNSAPIClient() {
}
}
class PowerDNSAPIError(val error: String, val errors: List<String>)
@ReflectiveAccess
data class PowerDNSAPIError(
@SerializedName("error") val error: String,
@SerializedName("errors") val errors: List<String>
)
class PowerDNSAPIException(private val error: PowerDNSAPIError): RuntimeException(error.error) {
val errors: List<String>
get() = error.errors

View File

@ -0,0 +1,5 @@
package space.mori.dnsapi
@Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class ReflectiveAccess

View File

@ -1,8 +0,0 @@
[
{
"name": "space.mori.dnsapi.PowerDNSAPIError",
"allDeclaredConstructors": true,
"allDeclaredFields": true,
"allDeclaredMethods": true
}
]