mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Fix arguments passed to AOT processing in Gradle plugin
See gh-30527
This commit is contained in:
parent
8cf63a28b8
commit
293a3c9ec1
@ -22,9 +22,11 @@ import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
||||
import org.gradle.api.file.Directory;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.plugins.PluginContainer;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
@ -82,10 +84,14 @@ public class SpringBootAotPlugin implements Plugin<Project> {
|
||||
.named(SpringBootPlugin.RESOLVE_MAIN_CLASS_NAME_TASK_NAME, ResolveMainClassName.class);
|
||||
TaskProvider<GenerateAotSources> generateAotSources = project.getTasks()
|
||||
.register(GENERATE_AOT_SOURCES_TASK_NAME, GenerateAotSources.class, (task) -> {
|
||||
Provider<Directory> generatedClasses = project.getLayout().getBuildDirectory()
|
||||
.dir(GENERATE_AOT_SOURCES_TASK_NAME);
|
||||
aotSourceSet.getOutput().dir(generatedClasses);
|
||||
task.getApplicationClass().set(resolveMainClassName.flatMap((thing) -> thing.readMainClassName()));
|
||||
task.setClasspath(aotSourceSet.getCompileClasspath());
|
||||
task.getSourcesDir().set(aotSourceSet.getJava().getSrcDirs().iterator().next());
|
||||
task.getResourcesDir().set(aotSourceSet.getResources().getSrcDirs().iterator().next());
|
||||
task.getClassesDir().set(generatedClasses);
|
||||
task.getGroupId().set(project.provider(() -> String.valueOf(project.getGroup())));
|
||||
task.getArtifactId().set(project.provider(() -> project.getName()));
|
||||
});
|
||||
|
@ -96,6 +96,8 @@ public class GenerateAotSources extends JavaExec {
|
||||
args.add(this.sourcesDir.getAsFile().get().getAbsolutePath());
|
||||
args.add(this.resourcesDir.getAsFile().get().getAbsolutePath());
|
||||
args.add(this.classesDir.getAsFile().get().getAbsolutePath());
|
||||
args.add(this.groupId.get());
|
||||
args.add(this.artifactId.get());
|
||||
args.addAll(super.getArgs());
|
||||
this.setArgs(args);
|
||||
super.exec();
|
||||
|
Loading…
Reference in New Issue
Block a user