added comments for native build investigation

This commit is contained in:
Kilian Schuettler 2023-07-27 17:12:16 +02:00
parent 72d1e6271a
commit 6388898cc0
2 changed files with 14 additions and 31 deletions

View File

@ -6,7 +6,10 @@ plugins {
dependencies { dependencies {
implementation(project(":layoutparser-service-internal-api")) implementation(project(":layoutparser-service-internal-api"))
implementation("com.iqser.red.service:persistence-service-shared-api-v1:2.36.0") implementation("com.iqser.red.service:persistence-service-shared-api-v1:2.36.0") {
exclude("org.springframework.boot", "spring-boot-starter-security")
exclude("org.springframework.boot", "spring-boot-starter-validation")
}
implementation("com.knecon.fforesight:tenant-commons:0.10.0") implementation("com.knecon.fforesight:tenant-commons:0.10.0")
implementation("com.iqser.red.commons:storage-commons:2.1.0") implementation("com.iqser.red.commons:storage-commons:2.1.0")

View File

@ -1,12 +1,13 @@
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins { plugins {
application
id("com.knecon.fforesight.java-conventions") id("com.knecon.fforesight.java-conventions")
id("org.springframework.boot") version "3.1.2" id("org.springframework.boot") version "3.1.2"
id("io.spring.dependency-management") version "1.1.0" id("io.spring.dependency-management") version "1.1.0"
id("org.sonarqube") version "4.2.1.3168" id("org.sonarqube") version "4.2.1.3168"
id("io.freefair.lombok") version "8.1.0" id("io.freefair.lombok") version "8.1.0"
//id("org.graalvm.buildtools.native") version "0.9.23" // id("org.graalvm.buildtools.native") version "0.9.23"
} }
dependencies { dependencies {
@ -14,11 +15,10 @@ dependencies {
implementation("com.iqser.red.commons:storage-commons:2.1.0") implementation("com.iqser.red.commons:storage-commons:2.1.0")
implementation("com.knecon.fforesight:tenant-commons:0.10.0") implementation("com.knecon.fforesight:tenant-commons:0.10.0")
implementation("org.springframework.boot:spring-boot-starter-actuator:3.1.2") implementation("org.springframework.boot:spring-boot-starter-actuator:3.1.2")
implementation("com.amazonaws:aws-java-sdk-s3:1.12.514") implementation("com.amazonaws:aws-java-sdk-s3:1.12.514")
implementation("com.azure.spring:spring-cloud-azure-native-configuration:4.0.0-beta.1")
// for integration testing only // for integration testing only
testImplementation(project(":layoutparser-service-internal-api")) testImplementation(project(":layoutparser-service-internal-api"))
@ -30,7 +30,6 @@ dependencies {
testImplementation("org.apache.pdfbox:pdfbox:3.0.0-alpha2") testImplementation("org.apache.pdfbox:pdfbox:3.0.0-alpha2")
testImplementation("org.apache.pdfbox:pdfbox-tools:3.0.0-alpha2") testImplementation("org.apache.pdfbox:pdfbox-tools:3.0.0-alpha2")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.6") testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.6")
testImplementation("org.apache.logging.log4j:log4j-slf4j-impl:2.19.0")
} }
description = "layoutparser-service-server" description = "layoutparser-service-server"
@ -40,13 +39,14 @@ java {
} }
/* /*
TODO: implement native build using GRAALVM, currently the problem is, logback needs runtime configuration using reflections or something //TODO: implement native build using GRAALVM, currently the problem is, logback needs runtime configuration using reflections or something
kinda weird behavior, since the buildArgs below seem to have no effect at all //kinda weird behavior, since the buildArgs below seem to have no effect at all
https://stackoverflow.com/questions/72770461/graalvm-native-image-can-not-compile-logback-dependencies //https://stackoverflow.com/questions/72770461/graalvm-native-image-can-not-compile-logback-dependencies
We traced the issue to storage-commons and there to azure blob storage, this is today an open bug with azure spring
https://github.com/Azure/azure-sdk-for-java/issues/36001
// AOT seems to be the name of the generated classes for native images //AOT is springs ahead of time compilation, it is a code analysis which generates new code, therefore checkstyle and pmd can be disabled on them.
// They are added as a SourceSet, and therefore checkstyle and pmd try to run on it
tasks.named<Checkstyle>("checkstyleAot") { tasks.named<Checkstyle>("checkstyleAot") {
enabled = false enabled = false
} }
@ -59,28 +59,8 @@ tasks.named<Pmd>("pmdAot") {
tasks.named<Pmd>("pmdAotTest") { tasks.named<Pmd>("pmdAotTest") {
enabled = false enabled = false
} }
graalvmNative {
binaries {
all {
resources.autodetect()
buildArgs.add("--verbose")
buildArgs.add("--add-opens=java.base/java.nio=ALL-UNNAMED")
buildArgs.add("--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED")
buildArgs.add("--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED")
buildArgs.add("--trace-class-initialization=ch.qos.logback.classic.Logger")
buildArgs.add("--trace-object-instantiation=ch.qos.logback.core.AsyncAppenderBase\$Worker")
buildArgs.add("--initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback")
buildArgs.add("--initialize-at-run-time=io.netty")
}
}
}
nativeBuild {
buildArgs("-H:ReflectionConfigurationFiles=../../../src/main/resources/reflection-config.json")
}
*/ */
tasks.named<BootBuildImage>("bootBuildImage") { tasks.named<BootBuildImage>("bootBuildImage") {
imageName.set("nexus.knecon.com:5001/ff/${project.name}:${project.version}") imageName.set("nexus.knecon.com:5001/ff/${project.name}:${project.version}")
if (project.hasProperty("buildbootDockerHostNetwork")) { if (project.hasProperty("buildbootDockerHostNetwork")) {