use of org.gradle.api.publish.tasks.GenerateModuleMetadata in project gradle by gradle.
the class IvyPublishPlugin method disableGradleMetadataGenerationIfCustomLayout.
private void disableGradleMetadataGenerationIfCustomLayout(NamedDomainObjectList<IvyArtifactRepository> repositories, GenerateModuleMetadata generateTask) {
AtomicBoolean didWarn = new AtomicBoolean();
Spec<? super Task> checkStandardLayout = task -> {
boolean standard = repositories.stream().allMatch(this::hasStandardPattern);
if (!standard && !didWarn.getAndSet(true)) {
LOGGER.warn("Publication of Gradle Module Metadata is disabled because you have configured an Ivy repository with a non-standard layout");
}
return standard;
};
Spec<TaskInternal> spec = new AndSpec<TaskInternal>(generateTask.getOnlyIf(), checkStandardLayout);
generateTask.setOnlyIf(Cast.<Spec<? super Task>>uncheckedCast(spec));
}
Aggregations