From fd73179166b15af246769c9b1ae205c65c584e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Papp=20=28TWiStErRob=29?= Date: Tue, 2 Jan 2018 15:18:21 +0000 Subject: [PATCH] Make PMD depend on compiled .class files (#2778) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Fix spurious PMD warnings when building with —-profile." This reverts commit cc4bb160c555e90c354f5c4c9c2722756709232f. * Make PMD depend on compiled .class files so type resolution can do its job. * Make FindBugs depend on compiled .class files via specific task and dynamic value --- library/build.gradle | 7 ++++--- .../main/java/com/bumptech/glide/load/engine/Engine.java | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 4fa288a7f6..fc9dfe2ccb 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -67,12 +67,12 @@ afterEvaluate { } tasks.create('findbugs', FindBugs) { - dependsOn tasks.assembleDebug + dependsOn tasks.compileDebugJavaWithJavac description 'Run findbugs' group 'verification' - classes = fileTree("${project.buildDir}/intermediates/classes/debug/") + classes = fileTree(tasks.compileDebugJavaWithJavac.destinationDir) source android.sourceSets.main.java.srcDirs classpath = files() doFirst { @@ -97,6 +97,7 @@ afterEvaluate { } tasks.create('pmd', Pmd) { + dependsOn tasks.compileDebugJavaWithJavac targetJdk = TargetJdk.VERSION_1_7 description 'Run pmd' @@ -108,7 +109,7 @@ afterEvaluate { ruleSetFiles = files('pmd-ruleset.xml') source android.sourceSets.main.java.srcDirs classpath = files() - classpath += files("${project.buildDir}/intermediates/classes/debug/") + classpath += files(tasks.compileDebugJavaWithJavac.destinationDir) doFirst { classpath += classPathForQuality() } diff --git a/library/src/main/java/com/bumptech/glide/load/engine/Engine.java b/library/src/main/java/com/bumptech/glide/load/engine/Engine.java index bdbd83fb65..dcb320c2d8 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/Engine.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/Engine.java @@ -235,14 +235,10 @@ public LoadStatus load( return new LoadStatus(cb, engineJob); } - // TODO(#2776): Remove this suppression. - @SuppressWarnings("PMD.UnusedPrivateMethod") private static void logWithTimeAndKey(String log, long startTime, Key key) { Log.v(TAG, log + " in " + LogTime.getElapsedMillis(startTime) + "ms, key: " + key); } - // TODO(#2776): Remove this suppression. - @SuppressWarnings("PMD.UnusedPrivateMethod") @Nullable private EngineResource loadFromActiveResources(Key key, boolean isMemoryCacheable) { if (!isMemoryCacheable) { @@ -256,8 +252,6 @@ private EngineResource loadFromActiveResources(Key key, boolean isMemoryCache return active; } - // TODO(#2776): Remove this suppression. - @SuppressWarnings("PMD.UnusedPrivateMethod") private EngineResource loadFromCache(Key key, boolean isMemoryCacheable) { if (!isMemoryCacheable) { return null;