Search in sources :

Example 1 with ImplementationSnapshot

use of org.gradle.api.internal.changedetection.state.ImplementationSnapshot in project gradle by gradle.

the class DebuggingTaskOutputCachingBuildCacheKeyBuilder method appendTaskActionImplementations.

@Override
public void appendTaskActionImplementations(Collection<ImplementationSnapshot> taskActionImplementations) {
    for (ImplementationSnapshot actionImpl : taskActionImplementations) {
        log("actionType", actionImpl.getTypeName());
        log("actionClassLoaderHash", actionImpl.hasUnknownClassLoader() ? null : actionImpl.getClassLoaderHash());
    }
    delegate.appendTaskActionImplementations(taskActionImplementations);
}
Also used : ImplementationSnapshot(org.gradle.api.internal.changedetection.state.ImplementationSnapshot)

Example 2 with ImplementationSnapshot

use of org.gradle.api.internal.changedetection.state.ImplementationSnapshot in project gradle by gradle.

the class DefaultTaskOutputCachingBuildCacheKeyBuilder method appendTaskActionImplementations.

@Override
public void appendTaskActionImplementations(Collection<ImplementationSnapshot> taskActionImplementations) {
    ImmutableList.Builder<String> actionTypes = ImmutableList.builder();
    List<HashCode> actionClassLoaderHashes = Lists.newArrayListWithCapacity(taskActionImplementations.size());
    for (ImplementationSnapshot actionImpl : taskActionImplementations) {
        String actionType = actionImpl.getTypeName();
        actionTypes.add(actionType);
        hasher.putString(actionType);
        HashCode hashCode;
        if (actionImpl.hasUnknownClassLoader()) {
            hashCode = null;
            valid = false;
        } else {
            hashCode = actionImpl.getClassLoaderHash();
            hasher.putHash(hashCode);
        }
        actionClassLoaderHashes.add(hashCode);
    }
    this.actionTypes = actionTypes.build();
    this.actionClassLoaderHashes = Collections.unmodifiableList(actionClassLoaderHashes);
}
Also used : HashCode(org.gradle.internal.hash.HashCode) ImmutableList(com.google.common.collect.ImmutableList) ImplementationSnapshot(org.gradle.api.internal.changedetection.state.ImplementationSnapshot)

Example 3 with ImplementationSnapshot

use of org.gradle.api.internal.changedetection.state.ImplementationSnapshot in project gradle by gradle.

the class TaskTypeTaskStateChanges method addAllChanges.

@Override
protected void addAllChanges(List<TaskStateChange> changes) {
    ImplementationSnapshot prevImplementation = previousExecution.getTaskImplementation();
    ImplementationSnapshot taskImplementation = currentExecution.getTaskImplementation();
    if (!taskImplementation.getTypeName().equals(prevImplementation.getTypeName())) {
        changes.add(new DescriptiveChange("Task '%s' has changed type from '%s' to '%s'.", task.getIdentityPath(), prevImplementation.getTypeName(), taskImplementation.getTypeName()));
        return;
    }
    if (taskImplementation.hasUnknownClassLoader()) {
        changes.add(new DescriptiveChange("Task '%s' was loaded with an unknown classloader", task.getIdentityPath()));
        return;
    }
    if (prevImplementation.hasUnknownClassLoader()) {
        changes.add(new DescriptiveChange("Task '%s' was loaded with an unknown classloader during the previous execution", task.getIdentityPath()));
        return;
    }
    if (!taskImplementation.getClassLoaderHash().equals(prevImplementation.getClassLoaderHash())) {
        changes.add(new DescriptiveChange("Task '%s' class path has changed from %s to %s.", task.getIdentityPath(), prevImplementation.getClassLoaderHash(), taskImplementation.getClassLoaderHash()));
        return;
    }
    ImmutableList<ImplementationSnapshot> taskActionImplementations = currentExecution.getTaskActionImplementations();
    if (hasAnyUnknownClassLoader(taskActionImplementations)) {
        changes.add(new DescriptiveChange("Task '%s' has an additional action that was loaded with an unknown classloader", task.getIdentityPath()));
        return;
    }
    if (hasAnyUnknownClassLoader(previousExecution.getTaskActionImplementations())) {
        changes.add(new DescriptiveChange("Task '%s' had an additional action that was loaded with an unknown classloader during the previous execution", task.getIdentityPath()));
        return;
    }
    if (!taskActionImplementations.equals(previousExecution.getTaskActionImplementations())) {
        changes.add(new DescriptiveChange("Task '%s' has additional actions that have changed", task.getIdentityPath()));
    }
}
Also used : ImplementationSnapshot(org.gradle.api.internal.changedetection.state.ImplementationSnapshot)

Aggregations

ImplementationSnapshot (org.gradle.api.internal.changedetection.state.ImplementationSnapshot)3 ImmutableList (com.google.common.collect.ImmutableList)1 HashCode (org.gradle.internal.hash.HashCode)1