CristianGM
04/22/2022, 9:42 PMval testApkDir: Provider<Directory> = variant.androidTest!!.artifacts.get(SingleArtifact.APK)
val builtArtifactsLoader: BuiltArtifactsLoader = ... // That's from Android Gradle Plugin
myTask.configure {
// testApk is RegularFileProperty, and I want to keep the dependency to the task generating it
testApk.value(
testApkDir.map {
it.file(builtArtifactsLoader.load(it)!!.elements.single().outputFile)
}
)
}
and everything is fine until I try to enable the configuration-cache, it tries to get the file too early and load
returns no elements
As a workaround I'm using testApkDir
as input directly, but I wonder if that's safe, I mean, may anything in this directory change? timestamp? absolute path?
if it wasn't android specific I would expect to use directly the output of the package
task (being a Provider<File>
)CristianGM
04/22/2022, 9:46 PM{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "testApp",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-debug.apk"
}
],
"elementType": "File"
}
so I guess it's just fine, the Directory only contains that json and the apktony
04/22/2022, 10:08 PMCristianGM
04/22/2022, 10:11 PMCristianGM
04/22/2022, 10:23 PMtony
04/22/2022, 11:21 PMBuiltArtifactsLoader
directly. I've also verified it works with configuration cache via automated testing, and it still correctly sets up implicit task dependencies
https://gist.github.com/autonomousapps/09b4737e5bb860d9388976354bf54673CristianGM
04/23/2022, 12:06 AMCristianGM
04/23/2022, 12:07 AMtony
04/23/2022, 1:50 AMtony
04/23/2022, 1:51 AMCristianGM
04/23/2022, 6:39 AMXavier Ducrohet
04/26/2022, 11:43 PMCristianGM
04/27/2022, 6:02 AM