Break dependency between TestCompiler and AOT

This commit improves `TestCompiler` with a `with` function that allows
to customize a test compiler instance. Rather than `TestCompiler`
knowing about `TestGenerationContext`, the latter implements the
function so that it can be passed as is.

See gh-29175
This commit is contained in:
Stephane Nicoll
2022-09-20 14:24:22 +02:00
parent 2f84096af1
commit 4625e92eb8
17 changed files with 108 additions and 37 deletions

View File

@@ -151,7 +151,7 @@ class ScopedProxyBeanRegistrationAotProcessorTests {
.build());
});
this.generationContext.writeGeneratedContent();
TestCompiler.forSystem().withFiles(this.generationContext.getGeneratedFiles()).compile(compiled -> {
TestCompiler.forSystem().with(this.generationContext).compile(compiled -> {
DefaultListableBeanFactory freshBeanFactory = new DefaultListableBeanFactory();
freshBeanFactory.setBeanClassLoader(compiled.getClassLoader());
compiled.getInstance(Consumer.class).accept(freshBeanFactory);