Search in sources :

Example 1 with GenerateModuleMetadata

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));
}
Also used : NamedDomainObjectFactory(org.gradle.api.NamedDomainObjectFactory) VersionMappingStrategyInternal(org.gradle.api.publish.internal.versionmapping.VersionMappingStrategyInternal) Path(org.gradle.model.Path) PluginManager(org.gradle.api.plugins.PluginManager) IvyArtifactNotationParserFactory(org.gradle.api.publish.ivy.internal.artifact.IvyArtifactNotationParserFactory) GenerateModuleMetadata(org.gradle.api.publish.tasks.GenerateModuleMetadata) NamedDomainObjectList(org.gradle.api.NamedDomainObjectList) Task(org.gradle.api.Task) PublishingExtension(org.gradle.api.publish.PublishingExtension) PublishingPlugin(org.gradle.api.publish.plugins.PublishingPlugin) IvyPublicationIdentity(org.gradle.api.publish.ivy.internal.publisher.IvyPublicationIdentity) TaskProvider(org.gradle.api.tasks.TaskProvider) ExtensionContainer(org.gradle.api.plugins.ExtensionContainer) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact) Project(org.gradle.api.Project) Set(java.util.Set) NamedDomainObjectSet(org.gradle.api.NamedDomainObjectSet) GenerateIvyDescriptor(org.gradle.api.publish.ivy.tasks.GenerateIvyDescriptor) IvyPublication(org.gradle.api.publish.ivy.IvyPublication) List(java.util.List) Spec(org.gradle.api.specs.Spec) TaskContainer(org.gradle.api.tasks.TaskContainer) AndSpec(org.gradle.api.specs.AndSpec) IvyRepositoryDescriptor(org.gradle.api.internal.artifacts.repositories.descriptor.IvyRepositoryDescriptor) NotationParser(org.gradle.internal.typeconversion.NotationParser) PublishToIvyRepository(org.gradle.api.publish.ivy.tasks.PublishToIvyRepository) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DefaultIvyPublicationIdentity(org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity) Logger(org.gradle.api.logging.Logger) Module(org.gradle.api.internal.artifacts.Module) SourceSet(org.gradle.api.tasks.SourceSet) Inject(javax.inject.Inject) DefaultVersionMappingStrategy(org.gradle.api.publish.ivy.internal.versionmapping.DefaultVersionMappingStrategy) DirectoryProperty(org.gradle.api.file.DirectoryProperty) SourceSetContainer(org.gradle.api.tasks.SourceSetContainer) DefaultIvyPublication(org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublication) StringUtils.capitalize(org.apache.commons.lang.StringUtils.capitalize) Usage(org.gradle.api.attributes.Usage) TaskInternal(org.gradle.api.internal.TaskInternal) JavaPlatformPlugin(org.gradle.api.plugins.JavaPlatformPlugin) Cast(org.gradle.internal.Cast) RepositoryDescriptor(org.gradle.api.internal.artifacts.repositories.descriptor.RepositoryDescriptor) Instantiator(org.gradle.internal.reflect.Instantiator) IvyPublicationInternal(org.gradle.api.publish.ivy.internal.publication.IvyPublicationInternal) FileResolver(org.gradle.api.internal.file.FileResolver) ObjectFactory(org.gradle.api.model.ObjectFactory) Logging(org.gradle.api.logging.Logging) DefaultIvyArtifactRepository(org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository) DependencyMetaDataProvider(org.gradle.api.internal.artifacts.configurations.DependencyMetaDataProvider) Plugin(org.gradle.api.Plugin) IvyArtifactRepository(org.gradle.api.artifacts.repositories.IvyArtifactRepository) AndSpec(org.gradle.api.specs.AndSpec) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TaskInternal(org.gradle.api.internal.TaskInternal)

Aggregations

List (java.util.List)1 Set (java.util.Set)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Inject (javax.inject.Inject)1 StringUtils.capitalize (org.apache.commons.lang.StringUtils.capitalize)1 NamedDomainObjectFactory (org.gradle.api.NamedDomainObjectFactory)1 NamedDomainObjectList (org.gradle.api.NamedDomainObjectList)1 NamedDomainObjectSet (org.gradle.api.NamedDomainObjectSet)1 Plugin (org.gradle.api.Plugin)1 Project (org.gradle.api.Project)1 Task (org.gradle.api.Task)1 IvyArtifactRepository (org.gradle.api.artifacts.repositories.IvyArtifactRepository)1 Usage (org.gradle.api.attributes.Usage)1 DirectoryProperty (org.gradle.api.file.DirectoryProperty)1 TaskInternal (org.gradle.api.internal.TaskInternal)1 Module (org.gradle.api.internal.artifacts.Module)1 DependencyMetaDataProvider (org.gradle.api.internal.artifacts.configurations.DependencyMetaDataProvider)1 DefaultIvyArtifactRepository (org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository)1 IvyRepositoryDescriptor (org.gradle.api.internal.artifacts.repositories.descriptor.IvyRepositoryDescriptor)1 RepositoryDescriptor (org.gradle.api.internal.artifacts.repositories.descriptor.RepositoryDescriptor)1