Search in sources :

Example 6 with DisplayName

use of org.gradle.internal.DisplayName in project gradle by gradle.

the class DefaultDependencyResolutionManagement method repoMutationDisallowedOnProject.

private void repoMutationDisallowedOnProject(ArtifactRepository artifactRepository) {
    UserCodeApplicationContext.Application current = context.current();
    DisplayName displayName = current == null ? null : current.getDisplayName();
    if (displayName == null) {
        displayName = UNKNOWN_CODE;
    }
    String message = "Build was configured to prefer settings repositories over project repositories but repository '" + artifactRepository.getName() + "' was added by " + displayName;
    switch(getConfiguredRepositoriesMode()) {
        case FAIL_ON_PROJECT_REPOS:
            throw new InvalidUserCodeException(message);
        case PREFER_SETTINGS:
            LOGGER.warn(message);
            break;
    }
}
Also used : InvalidUserCodeException(org.gradle.api.InvalidUserCodeException) UserCodeApplicationContext(org.gradle.configuration.internal.UserCodeApplicationContext) DisplayName(org.gradle.internal.DisplayName)

Example 7 with DisplayName

use of org.gradle.internal.DisplayName in project gradle by gradle.

the class AbstractMinimalProvider method cannotQueryValueOf.

private String cannotQueryValueOf(Value<? extends T> value) {
    TreeFormatter formatter = new TreeFormatter();
    formatter.node("Cannot query the value of ").append(getDisplayName().getDisplayName()).append(" because it has no value available.");
    if (!value.getPathToOrigin().isEmpty()) {
        formatter.node("The value of ").append(getTypedDisplayName().getDisplayName()).append(" is derived from");
        formatter.startChildren();
        for (DisplayName displayName : value.getPathToOrigin()) {
            formatter.node(displayName.getDisplayName());
        }
        formatter.endChildren();
    }
    return formatter.toString();
}
Also used : TreeFormatter(org.gradle.internal.logging.text.TreeFormatter) DisplayName(org.gradle.internal.DisplayName)

Example 8 with DisplayName

use of org.gradle.internal.DisplayName in project gradle by gradle.

the class NodeState method getResolvedVariant.

public ResolvedVariantResult getResolvedVariant() {
    if (cachedVariantResult != null) {
        return cachedVariantResult;
    }
    DisplayName name = Describables.of(metaData.getName());
    List<? extends Capability> capabilities = metaData.getCapabilities().getCapabilities();
    AttributeContainer attributes = desugar(metaData.getAttributes());
    List<Capability> resolvedVariantCapabilities = capabilities.isEmpty() ? Collections.singletonList(component.getImplicitCapability()) : ImmutableList.copyOf(capabilities);
    cachedVariantResult = new DefaultResolvedVariantResult(component.getComponentId(), name, attributes, resolvedVariantCapabilities, findExternalVariant());
    return cachedVariantResult;
}
Also used : Capability(org.gradle.api.capabilities.Capability) ShadowedCapability(org.gradle.internal.component.external.model.ShadowedCapability) DefaultResolvedVariantResult(org.gradle.api.internal.artifacts.result.DefaultResolvedVariantResult) DisplayName(org.gradle.internal.DisplayName) AttributeContainer(org.gradle.api.attributes.AttributeContainer)

Example 9 with DisplayName

use of org.gradle.internal.DisplayName in project gradle by gradle.

the class VariantNameBuilder method getVariantName.

@Nullable
public DisplayName getVariantName(@Nullable List<String> parts) {
    if (parts == null) {
        return null;
    }
    DisplayName displayName = names.get(parts);
    if (displayName == null) {
        displayName = variantName(parts);
        names.put(parts, displayName);
    }
    return displayName;
}
Also used : DisplayName(org.gradle.internal.DisplayName) Nullable(javax.annotation.Nullable)

Example 10 with DisplayName

use of org.gradle.internal.DisplayName in project gradle by gradle.

the class DefaultDependencyResolutionManagement method ruleMutationDisallowedOnProject.

private void ruleMutationDisallowedOnProject(DisplayName ruleName) {
    UserCodeApplicationContext.Application current = context.current();
    DisplayName displayName = current == null ? null : current.getDisplayName();
    if (displayName == null) {
        displayName = UNKNOWN_CODE;
    }
    String message = "Build was configured to prefer settings component metadata rules over project rules but rule '" + ruleName + "' was added by " + displayName;
    switch(getConfiguredRulesMode()) {
        case FAIL_ON_PROJECT_RULES:
            throw new InvalidUserCodeException(message);
        case PREFER_SETTINGS:
            LOGGER.warn(message);
            break;
    }
}
Also used : InvalidUserCodeException(org.gradle.api.InvalidUserCodeException) UserCodeApplicationContext(org.gradle.configuration.internal.UserCodeApplicationContext) DisplayName(org.gradle.internal.DisplayName)

Aggregations

DisplayName (org.gradle.internal.DisplayName)10 InvalidUserCodeException (org.gradle.api.InvalidUserCodeException)2 Capability (org.gradle.api.capabilities.Capability)2 UserCodeApplicationContext (org.gradle.configuration.internal.UserCodeApplicationContext)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 File (java.io.File)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Nullable (javax.annotation.Nullable)1 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)1 ResolvedVariantResult (org.gradle.api.artifacts.result.ResolvedVariantResult)1 AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 OutgoingVariant (org.gradle.api.internal.artifacts.configurations.OutgoingVariant)1 VariantNameBuilder (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.VariantNameBuilder)1