feat: ネイティブイメージのリフレクションを改善

This commit is contained in:
usbharu 2023-04-22 11:20:11 +09:00
parent d91d7b58cd
commit 5ff0f4d581
3 changed files with 760 additions and 6 deletions

View File

@ -8,7 +8,7 @@ val koin_version: String by project
plugins {
kotlin("jvm") version "1.8.10"
id("io.ktor.plugin") version "2.2.4"
id("org.graalvm.buildtools.native") version "0.9.11"
id("org.graalvm.buildtools.native") version "0.9.21"
// id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10"
}
@ -104,19 +104,22 @@ graalvmNative {
named("main") {
fallback.set(false)
verbose.set(true)
agent{
enabled.set(false)
}
buildArgs.add("--initialize-at-build-time=io.ktor,kotlin,kotlinx")
buildArgs.add("--trace-class-initialization=ch.qos.logback.classic.Logger")
buildArgs.add("--trace-object-instantiation=ch.qos.logback.core.AsyncAppenderBase"+"$"+"Worker")
buildArgs.add("--trace-object-instantiation=ch.qos.logback.classic.Logger")
// buildArgs.add("--trace-class-initialization=ch.qos.logback.classic.Logger")
// buildArgs.add("--trace-object-instantiation=ch.qos.logback.core.AsyncAppenderBase"+"$"+"Worker")
// buildArgs.add("--trace-object-instantiation=ch.qos.logback.classic.Logger")
buildArgs.add("--initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback")
buildArgs.add("--trace-object-instantiation=kotlinx.coroutines.channels.ArrayChannel")
// buildArgs.add("--trace-object-instantiation=kotlinx.coroutines.channels.ArrayChannel")
buildArgs.add("--initialize-at-build-time=kotlinx.coroutines.channels.ArrayChannel")
buildArgs.add("-H:+InstallExitHandlers")
buildArgs.add("-H:+ReportUnsupportedElementsAtRuntime")
buildArgs.add("-H:+ReportExceptionStackTraces")
runtimeArgs.add("-config=$buildDir/resources/main/application-native.conf")
imageName.set("graal-server")
}
}

View File

@ -128,6 +128,12 @@
"name": "setPattern",
"parameterTypes": [
]
},
{
"name": "setPattern",
"parameterTypes": [
"java.lang.String"
]
}
]
},
@ -627,5 +633,728 @@
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.api.StatusForPost",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Follow",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "dev.usbharu.hideout.EmptyKt",
"allDeclaredClasses": true,
"queryAllDeclaredMethods": true,
"queryAllPublicMethods": true,
"methods": [
{
"name": "empty",
"parameterTypes": [
"io.ktor.server.application.Application"
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.PostEntity",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
"long",
"long",
"long",
"int"
]
},
{
"name": "<init>",
"parameterTypes": [
"long",
"long",
"long",
"int",
"int",
"kotlin.jvm.internal.DefaultConstructorMarker"
]
},
{
"name": "getCreatedAt",
"parameterTypes": [
]
},
{
"name": "getId",
"parameterTypes": [
]
},
{
"name": "getOverview",
"parameterTypes": [
]
},
{
"name": "getReplyId",
"parameterTypes": [
]
},
{
"name": "getRepostId",
"parameterTypes": [
]
},
{
"name": "getText",
"parameterTypes": [
]
},
{
"name": "getUrl",
"parameterTypes": [
]
},
{
"name": "getUserId",
"parameterTypes": [
]
},
{
"name": "getVisibility",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Accept",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.ap.Object"
]
},
{
"name": "getActor",
"parameterTypes": [
]
},
{
"name": "getObject",
"parameterTypes": [
]
},
{
"name": "setActor",
"parameterTypes": [
]
},
{
"name": "setObject",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.ap.Object"
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.ContextDeserializer",
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.ContextSerializer",
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Create",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.ap.Object"
]
},
{
"name": "getObject",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Follow",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "getActor",
"parameterTypes": [
]
},
{
"name": "getObject",
"parameterTypes": [
]
},
{
"name": "setActor",
"parameterTypes": [
]
},
{
"name": "setObject",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Image",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.JsonLd",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "getContext",
"parameterTypes": [
]
},
{
"name": "setContext",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Key",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "getId",
"parameterTypes": [
]
},
{
"name": "getOwner",
"parameterTypes": [
]
},
{
"name": "getPublicKeyPem",
"parameterTypes": [
]
},
{
"name": "setId",
"parameterTypes": [
]
},
{
"name": "setOwner",
"parameterTypes": [
]
},
{
"name": "setPublicKeyPem",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Note",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "getAttributedTo",
"parameterTypes": [
]
},
{
"name": "getContent",
"parameterTypes": [
]
},
{
"name": "getId",
"parameterTypes": [
]
},
{
"name": "getPublished",
"parameterTypes": [
]
},
{
"name": "getTo",
"parameterTypes": [
]
},
{
"name": "setAttributedTo",
"parameterTypes": [
]
},
{
"name": "setContent",
"parameterTypes": [
]
},
{
"name": "setId",
"parameterTypes": [
]
},
{
"name": "setPublished",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Object",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "getName",
"parameterTypes": [
]
},
{
"name": "setName",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Object$Companion",
"methods": [
{
"name": "add",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.Person",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
},
{
"name": "<init>",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.ap.Image",
"dev.usbharu.hideout.domain.model.ap.Key"
]
},
{
"name": "getInbox",
"parameterTypes": [
]
},
{
"name": "getOutbox",
"parameterTypes": [
]
},
{
"name": "getPreferredUsername",
"parameterTypes": [
]
},
{
"name": "getPublicKey",
"parameterTypes": [
]
},
{
"name": "getSummary",
"parameterTypes": [
]
},
{
"name": "setInbox",
"parameterTypes": [
]
},
{
"name": "setOutbox",
"parameterTypes": [
]
},
{
"name": "setPreferredUsername",
"parameterTypes": [
]
},
{
"name": "setPublicKey",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.ap.Key"
]
},
{
"name": "setSummary",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.domain.model.ap.TypeSerializer",
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
}
]
},
{
"name": "dev.usbharu.hideout.exception.JsonParseException",
"allDeclaredFields": true,
"queryAllPublicConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
}
]
},
{
"allDeclaredClasses": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "create",
"parameterTypes": [
"dev.usbharu.hideout.domain.model.Post",
"kotlin.coroutines.Continuation"
]
}
],
"name": "dev.usbharu.hideout.service.IPostService",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"allDeclaredClasses": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "parseActivity",
"parameterTypes": [
]
},
{
"name": "processActivity",
"parameterTypes": [
"dev.usbharu.hideout.service.activitypub.ActivityType",
"kotlin.coroutines.Continuation"
]
},
{
"name": "processActivity",
"parameterTypes": [
"kjob.core.dsl.JobContextWithProps",
"dev.usbharu.hideout.domain.model.job.HideoutJob",
"kotlin.coroutines.Continuation"
]
}
],
"name": "dev.usbharu.hideout.service.activitypub.ActivityPubService",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"allDeclaredClasses": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "fetchPerson",
"parameterTypes": [
"kotlin.coroutines.Continuation"
]
},
{
"name": "getPersonByName",
"parameterTypes": [
"kotlin.coroutines.Continuation"
]
}
],
"name": "dev.usbharu.hideout.service.activitypub.ActivityPubUserService",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "dev.usbharu.hideout.service.impl.UserService",
"allDeclaredClasses": true,
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "<init>",
"parameterTypes": [
"dev.usbharu.hideout.repository.IUserRepository"
]
},
{
"name": "addFollowers",
"parameterTypes": [
"long",
"long",
"kotlin.coroutines.Continuation"
]
},
{
"name": "findById",
"parameterTypes": [
"long",
"kotlin.coroutines.Continuation"
]
},
{
"name": "findByUrls",
"parameterTypes": [
"kotlin.coroutines.Continuation"
]
},
{
"name": "findFollowersById",
"parameterTypes": [
"long",
"kotlin.coroutines.Continuation"
]
}
]
},
{
"allDeclaredClasses": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "init",
"parameterTypes": [
]
},
{
"name": "schedule",
"parameterTypes": [
"kjob.core.Job",
"kotlin.jvm.functions.Function2",
"kotlin.coroutines.Continuation"
]
}
],
"name": "dev.usbharu.hideout.service.job.JobQueueParentService",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"allDeclaredClasses": true,
"queryAllDeclaredConstructors": true,
"methods": [
{
"name": "verify",
"parameterTypes": [
"io.ktor.http.Headers"
]
}
],
"name": "dev.usbharu.hideout.service.signature.HttpSignatureVerifyService",
"queryAllDeclaredMethods": true,
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]

View File

@ -0,0 +1,22 @@
ktor {
development = false
deployment {
port = 8080
port = ${?PORT}
// watch = [classes, resources]
}
application {
modules = [dev.usbharu.hideout.ApplicationKt.parent,dev.usbharu.hideout.ApplicationKt.worker]
}
}
hideout {
url = "http://localhost:8080"
database {
url = "jdbc:h2:./test;MODE=POSTGRESQL"
driver = "org.h2.Driver"
username = ""
password = ""
}
}