@@ -28,12 +28,22 @@ final class ProtobufPluginTestHelper {
28
28
}
29
29
30
30
static BuildResult buildAndroidProject (
31
- File mainProjectDir , String gradleVersion , String fullPathTask , String ... arguments ) {
32
- return getAndroidGradleRunner(mainProjectDir, gradleVersion, fullPathTask, arguments). build()
31
+ File mainProjectDir ,
32
+ String gradleVersion ,
33
+ String agpVersion ,
34
+ String fullPathTask ,
35
+ String ... arguments
36
+ ) {
37
+ return getAndroidGradleRunner(mainProjectDir, gradleVersion, agpVersion, fullPathTask, arguments). build()
33
38
}
34
39
35
40
static GradleRunner getAndroidGradleRunner (
36
- File mainProjectDir , String gradleVersion , String fullPathTask , String ... arguments ) {
41
+ File mainProjectDir ,
42
+ String gradleVersion ,
43
+ String agpVersion ,
44
+ String fullPathTask ,
45
+ String ... arguments
46
+ ) {
37
47
File localBuildCache = new File (mainProjectDir, " .buildCache" )
38
48
if (localBuildCache. exists()) {
39
49
localBuildCache. deleteDir()
@@ -42,7 +52,7 @@ final class ProtobufPluginTestHelper {
42
52
// set android build cache to avoid using home directory on CI.
43
53
// More details about that if can be found here:
44
54
// https://developer.android.com/studio/releases/gradle-plugin.html#build-cache-removed
45
- if (gradleVersion . take(1 ) == " 7 " ) { // TODO: improve version comparison
55
+ if (agpVersion . take(1 ). toInteger() >= 4 ) { // TODO: improve version comparison
46
56
args. add(" -PbuildCache.local.directory=$localBuildCache " . toString())
47
57
args. add(" -PbuildCache.local.removeUnusedEntriesAfterDays=7" )
48
58
} else {
0 commit comments