mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Lazily query attributes when copying from base configuration
See gh-37343
This commit is contained in:
parent
3eb89343d0
commit
7edc9ebc28
@ -35,6 +35,7 @@ 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.provider.ProviderFactory;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
@ -152,6 +153,7 @@ public class SpringBootAotPlugin implements Plugin<Project> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Configuration createAotProcessingClasspath(Project project, String taskName, SourceSet inputSourceSet) {
|
||||
ProviderFactory providers = project.getProviders();
|
||||
Configuration base = project.getConfigurations()
|
||||
.getByName(inputSourceSet.getRuntimeClasspathConfigurationName());
|
||||
Configuration aotClasspath = project.getConfigurations().create(taskName + "Classpath", (classpath) -> {
|
||||
@ -162,7 +164,8 @@ public class SpringBootAotPlugin implements Plugin<Project> {
|
||||
classpath.attributes((attributes) -> {
|
||||
AttributeContainer baseAttributes = base.getAttributes();
|
||||
for (Attribute<?> attribute : baseAttributes.keySet()) {
|
||||
attributes.attribute((Attribute<Object>) attribute, baseAttributes.getAttribute(attribute));
|
||||
Attribute<Object> attr = (Attribute<Object>) attribute;
|
||||
attributes.attributeProvider(attr, providers.provider(() -> baseAttributes.getAttribute(attr)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user