-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for com.baomidou:dynamic-datasource-spring-boot-starter:3.6.1
#154
Conversation
graalvmNative { | ||
agent { | ||
defaultMode = "conditional" | ||
modes { | ||
conditional { | ||
userCodeFilterPath = "user-code-filter.json" | ||
} | ||
} | ||
metadataCopy { | ||
mergeWithExisting = true | ||
inputTaskNames.add("test") | ||
outputDirectories.add("src/test/resources/META-INF/native-image/com.baomidou/dynamic-datasource-spring-boot-starter") | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Hi, I noticed that when Spring Boot's Gradle Plugin is introduced, the following error will occur when executing
./gradlew -Pagent clean test
.
01:21:29.638 [main] INFO org.springframework.test.context.aot.TestClassScanner - Scanning for Spring test classes in all packages in classpath roots [/home/linghengqian/TwinklingLiftWorks/git/public/graalvm-trace-metadata-smoketest/dynamic-datasource-spring-boot-starter/build/classes/java/test, /home/linghengqian/TwinklingLiftWorks/git/public/graalvm-trace-metadata-smoketest/dynamic-datasource-spring-boot-starter/build/resources/test]
Exception in thread "main" java.lang.IllegalStateException: Cannot perform AOT processing during AOT run-time execution
at org.springframework.util.Assert.state(Assert.java:76)
at org.springframework.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:126)
at org.springframework.test.context.aot.TestAotProcessor.performAotProcessing(TestAotProcessor.java:91)
at org.springframework.test.context.aot.TestAotProcessor.doProcess(TestAotProcessor.java:72)
at org.springframework.test.context.aot.TestAotProcessor.doProcess(TestAotProcessor.java:39)
at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
at org.springframework.boot.test.context.SpringBootTestAotProcessor.main(SpringBootTestAotProcessor.java:57)
- If I just execute
./gradlew clean test
, everything works fine, but cannot useuser-code-filter.json
to generate GraalVM reachability metadata in Conditional Agent Mode. - Spring AOT overrides my configuration for Native Build Tools. I wonder if this is the expected behavior of Classpath-based filtering of the native configuration generation spring-projects/spring-framework#28163 ? Or am I overlooking something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linghengqian Looks like Native Build Tools sets org.graalvm.nativeimage.imagecode
system property when the agent profile is enabled (expected) but that impacts the code running in the Gradle plugin JVM potentially because the JVM is not forked and in term of lifecycle that maybe happens too early.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running in agent mode with the NBT will set org.graalvm.nativeimage.imagecode=agent
.
And AotDetector.useGeneratedArtifacts()
returns true
if that's the case.
So that would explain the cause of the IllegalStateException
in TestContextAotGenerator
.
That may be problematic in and of itself.
In any case, why is TestContextAotGenerator
used when executing ./gradlew -Pagent clean test
?
Is that command supposed to trigger AOT processing of the test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
This involves an idea that I want to use GraalVM Tracing Agent to collect GraalVM Reachability Metadata in Conditional form for the corresponding unit tests for some third-party Spring Boot Starters that must use Spring Boot's unique classes.
-
I've been involved with too many deadlines lately, and haven't had time to investigate this PR.
-
Do you want me to open a new issue with a minimal reproducible example on the Spring Boot side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to open a new issue with a minimal reproducible example on the Spring Boot side?
@linghengqian, yes that would be great!
Though it may be better to file the issue against the Spring Framework, since changes will likely need to be made in Framework -- even if the example you provide uses Boot and its plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to open a new issue with a minimal reproducible example on the Spring Boot side?
@linghengqian, yes that would be great!
Though it may be better to file the issue against the Spring Framework, since changes will likely need to be made in Framework -- even if the example you provide uses Boot and its plugins.
- @sbrannen I'm sorry I've been busy and forgot about this. I'm open at https://github.com/spring-projects/spring-boot/issues/34841. If you think it is necessary, you can move the issue to the Spring Framework side, because I think this is only related to Spring's Gradle Plugin.
246f363
to
a6a093e
Compare
|
1d3dec1
to
cbe2607
Compare
5a71182
to
047100e
Compare
|
714cc11
to
99a6442
Compare
99a6442
to
cd7b25c
Compare
cd7b25c
to
1573c8f
Compare
|
What does this PR do?
com.baomidou:dynamic-datasource-spring-boot-starter:3.6.0
#153 .Checklist before merging