Adapt to breaking changes to AotProcessor settings

See gh-32696
This commit is contained in:
Andy Wilkinson
2022-10-18 17:42:00 +01:00
parent d53c2b25d0
commit 7bae02be2d
3 changed files with 7 additions and 7 deletions

View File

@@ -52,8 +52,8 @@ public class SpringBootTestAotProcessor extends TestAotProcessor {
.formatted(TestAotProcessor.class.getName()));
Set<Path> classpathRoots = Arrays.stream(args[0].split(File.pathSeparator)).map(Paths::get)
.collect(Collectors.toSet());
Settings settings = new Settings().setSourceOutput(Paths.get(args[1])).setResourceOutput(Paths.get(args[2]))
.setClassOutput(Paths.get(args[3])).setGroupId(args[4]).setArtifactId(args[5]);
Settings settings = Settings.builder().sourceOutput(Paths.get(args[1])).resourceOutput(Paths.get(args[2]))
.classOutput(Paths.get(args[3])).groupId(args[4]).artifactId(args[5]).build();
new SpringBootTestAotProcessor(classpathRoots, settings).process();
}

View File

@@ -67,8 +67,8 @@ public class SpringApplicationAotProcessor extends ContextAotProcessor {
Assert.isTrue(args.length >= requiredArgs, () -> "Usage: " + SpringApplicationAotProcessor.class.getName()
+ " <applicationName> <sourceOutput> <resourceOutput> <classOutput> <groupId> <artifactId> <originalArgs...>");
Class<?> application = Class.forName(args[0]);
Settings settings = new Settings().setSourceOutput(Paths.get(args[1])).setResourceOutput(Paths.get(args[2]))
.setClassOutput(Paths.get(args[3])).setGroupId(args[4]).setArtifactId(args[5]);
Settings settings = Settings.builder().sourceOutput(Paths.get(args[1])).resourceOutput(Paths.get(args[2]))
.classOutput(Paths.get(args[3])).groupId(args[4]).artifactId(args[5]).build();
String[] applicationArgs = (args.length > requiredArgs) ? Arrays.copyOfRange(args, requiredArgs, args.length)
: new String[0];
new SpringApplicationAotProcessor(application, settings, applicationArgs).process();

View File

@@ -80,9 +80,9 @@ class SpringApplicationAotProcessorTests {
}
private Settings settings(Path directory) {
return new Settings().setSourceOutput(directory.resolve("source"))
.setResourceOutput(directory.resolve("resource")).setClassOutput(directory.resolve("class"))
.setGroupId("com.example").setArtifactId("example");
return Settings.builder().sourceOutput(directory.resolve("source"))
.resourceOutput(directory.resolve("resource")).classOutput(directory.resolve("class"))
.groupId("com.example").artifactId("example").build();
}