use of org.gradle.api.internal.artifacts.Module 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));
}
use of org.gradle.api.internal.artifacts.Module in project gradle by gradle.
the class Upload method upload.
@TaskAction
protected void upload() {
getLogger().info("Publishing configuration: {}", configuration);
DeprecationLogger.deprecateTaskType(Upload.class, getPath()).willBeRemovedInGradle8().withUpgradeGuideSection(7, "upload_task_deprecation").nagUser();
Module module = ((ConfigurationInternal) configuration).getModule();
ArtifactPublisher artifactPublisher = getPublicationServices().createArtifactPublisher();
File descriptorDestination = isUploadDescriptor() ? getDescriptorDestination() : null;
List<PublicationAwareRepository> publishRepositories = collect(getRepositories(), Transformers.cast(PublicationAwareRepository.class));
try {
artifactPublisher.publish(publishRepositories, module, configuration, descriptorDestination);
} catch (Exception e) {
throw new PublishException(String.format("Could not publish configuration '%s'", configuration.getName()), e);
}
}
use of org.gradle.api.internal.artifacts.Module in project gradle by gradle.
the class ShortCircuitEmptyConfigurationResolver method emptyGraph.
private void emptyGraph(ConfigurationInternal configuration, ResolverResults results, boolean verifyLocking) {
if (verifyLocking && configuration.getResolutionStrategy().isDependencyLockingEnabled()) {
DependencyLockingProvider dependencyLockingProvider = configuration.getResolutionStrategy().getDependencyLockingProvider();
DependencyLockingState lockingState = dependencyLockingProvider.loadLockState(configuration.getName());
if (lockingState.mustValidateLockState() && !lockingState.getLockedDependencies().isEmpty()) {
// Invalid lock state, need to do a real resolution to gather locking failures
delegate.resolveGraph(configuration, results);
return;
}
dependencyLockingProvider.persistResolvedDependencies(configuration.getName(), Collections.emptySet(), Collections.emptySet());
}
Module module = configuration.getModule();
ModuleVersionIdentifier id = moduleIdentifierFactory.moduleWithVersion(module);
ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier, configuration.getAttributes());
ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor(thisBuild);
results.graphResolved(emptyResult, emptyProjectResult, EmptyResults.INSTANCE);
}
use of org.gradle.api.internal.artifacts.Module in project gradle by gradle.
the class DefaultProjectLocalComponentProvider method getLocalComponentMetadata.
private LocalComponentMetadata getLocalComponentMetadata(ProjectState projectState, ProjectInternal project) {
Module module = project.getDependencyMetaDataProvider().getModule();
ModuleVersionIdentifier moduleVersionIdentifier = moduleIdentifierFactory.moduleWithVersion(module.getGroup(), module.getName(), module.getVersion());
ProjectComponentIdentifier componentIdentifier = projectState.getComponentIdentifier();
DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), (AttributesSchemaInternal) project.getDependencies().getAttributesSchema());
for (ConfigurationInternal configuration : project.getConfigurations().withType(ConfigurationInternal.class)) {
metadataBuilder.addConfiguration(metaData, configuration);
}
return metaData;
}
Aggregations