Skip to content

Commit

Permalink
Make sure ProjectDescriptionDiff is created eagerly
Browse files Browse the repository at this point in the history
This commit makes sure that the diff instance is created immediately,
taking a snapshot of the ProjectDescription before the customizers are
applied on it.

Previously, the instance was created as part of the supplier and
therefore created only once a component was requiring it.

See gh-1023
  • Loading branch information
snicoll committed Dec 27, 2019
1 parent 591f688 commit 6c261fd
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ private Supplier<ProjectDescription> resolve(ProjectDescription description, Pro
MutableProjectDescription mutableDescription = (MutableProjectDescription) description;
ProjectDescriptionDiffFactory diffFactory = context.getBeanProvider(ProjectDescriptionDiffFactory.class)
.getIfAvailable(DefaultProjectDescriptionDiffFactory::new);
context.registerBean(ProjectDescriptionDiff.class, () -> diffFactory.create(mutableDescription));
// Create the diff here so that it takes a copy of the description
// immediately
ProjectDescriptionDiff diff = diffFactory.create(mutableDescription);
context.registerBean(ProjectDescriptionDiff.class, () -> diff);
context.getBeanProvider(ProjectDescriptionCustomizer.class).orderedStream()
.forEach((customizer) -> customizer.customize(mutableDescription));
}
Expand Down

0 comments on commit 6c261fd

Please sign in to comment.