Skip to content

Commit

Permalink
Make PMD depend on compiled .class files (#2778)
Browse files Browse the repository at this point in the history
* Revert "Fix spurious PMD warnings when building with —-profile."

This reverts commit cc4bb16.

* 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
  • Loading branch information
TWiStErRob authored and sjudd committed Jan 2, 2018
1 parent cc4bb16 commit fd73179
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 4 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -97,6 +97,7 @@ afterEvaluate {
}

tasks.create('pmd', Pmd) {
dependsOn tasks.compileDebugJavaWithJavac
targetJdk = TargetJdk.VERSION_1_7

description 'Run pmd'
Expand All @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,10 @@ public <R> 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) {
Expand All @@ -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;
Expand Down

0 comments on commit fd73179

Please sign in to comment.