Skip to content

Commit 5aefbb8

Browse files
committed
Deal with the death of mockableAndroidJar
1 parent 2860acb commit 5aefbb8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/main/groovy/com/monits/gradle/sca/AndroidHelper.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ final class AndroidHelper {
133133
home
134134
}
135135

136+
/**
137+
* Retrieves the current Android SDK install location
138+
* @return The current Android SDK install location
139+
*/
140+
static String getSdkDir() {
141+
System.getenv('ANDROID_HOME')
142+
}
143+
136144
/**
137145
* Retrieves the current plugin version, if available.
138146
* @param project The project on which to analyze the used plugin version.

src/main/groovy/com/monits/gradle/sca/ClasspathAware.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ trait ClasspathAware {
101101
FileCollection mockableAndroidJar = project.files()
102102
if (mockableAndroidJarTask) {
103103
mockableAndroidJar += mockableAndroidJarTask.outputs.files
104+
} else {
105+
// as of 3.2.0+ the mockableAndroidJar task is no more… attempt to access directly
106+
mockableAndroidJar += project.files(
107+
AndroidHelper.sdkDir + "/platforms/${project['android']['compileSdkVersion']}/android.jar",)
108+
//System.getenv('JAVA_HOME') + '/jre/lib/rt.jar')
104109
}
105110

106111
task.setProperty('classpath',

0 commit comments

Comments
 (0)