Skip to content

Commit

Permalink
Rename method to better reflect its purpose
Browse files Browse the repository at this point in the history
See gradle/kotlin-dsl-samples#31
+review REVIEW-6356
  • Loading branch information
bamboo committed Oct 27, 2016
1 parent 6e6d3a9 commit 712260a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Expand Up @@ -80,11 +80,11 @@ public static String createCompactMD5(String scriptText) {
return createHash(scriptText, "MD5").asCompactString();
}

public static String createCompactMD5(HashCode hashCode) {
return createCompactMD5FromHash(hashCode.asBytes());
public static String compactStringFor(HashCode hashCode) {
return compactStringFor(hashCode.asBytes());
}

public static String createCompactMD5FromHash(byte[] digest) {
public static String compactStringFor(byte[] digest) {
return new HashValue(digest).asCompactString();
}

Expand Down
Expand Up @@ -26,7 +26,7 @@

import java.io.File;

import static org.gradle.internal.hash.HashUtil.createCompactMD5;
import static org.gradle.internal.hash.HashUtil.compactStringFor;

class DefaultCacheKeyBuilder implements CacheKeyBuilder {

Expand All @@ -48,9 +48,9 @@ public String build(CacheKeySpec spec) {
case 0:
return prefix;
case 1:
return prefix + "/" + createCompactMD5(hashOf(components[0]));
return prefix + "/" + compactStringFor(hashOf(components[0]));
default:
return prefix + "/" + createCompactMD5(combinedHashOf(components));
return prefix + "/" + compactStringFor(combinedHashOf(components));
}
}

Expand Down
Expand Up @@ -85,7 +85,7 @@ public <T extends Script, M> CompiledScript<T, M> compile(final ScriptSource sou
}

HashCode sourceHashCode = hasher.hash(source.getResource());
final String sourceHash = HashUtil.createCompactMD5(sourceHashCode);
final String sourceHash = HashUtil.compactStringFor(sourceHashCode);
final String dslId = operation.getId();
final String classpathHash = dslId + classLoaderHierarchyHasher.getLenientHash(classLoader);
final RemappingScriptSource remapped = new RemappingScriptSource(source);
Expand Down
Expand Up @@ -86,7 +86,7 @@ public class CacheProjectIntegrationTest extends AbstractIntegrationTest {

private void updateCaches() {
String version = GradleVersion.current().version
def hash = HashUtil.createCompactMD5FromHash(fileHasher.hash(buildFile).asBytes())
def hash = HashUtil.compactStringFor(fileHasher.hash(buildFile))
String dirName = userHomeDir.file("caches/$version/scripts/$hash/proj").list()[0]
String baseDir = "caches/$version/scripts/$hash/proj/$dirName"
propertiesFile = userHomeDir.file("$baseDir/cache.properties")
Expand Down

0 comments on commit 712260a

Please sign in to comment.