Slackbot
04/22/2022, 1:29 PMCristianGM
04/22/2022, 1:36 PMBuiltArtifactsLoader to load the file because it knows which file in the Directory I want, and it's how AGP API is designed to be used.
The testApkDir doesn't exist until other tasks are executed ( in this case packageDebugAndroidTest)Paul Merlin
04/22/2022, 2:11 PMCristianGM
04/22/2022, 2:13 PMCristianGM
04/22/2022, 2:14 PMCannot convert path to File. path='() -> kotlin.String?'
java.lang.NullPointerException (no error message)
Cannot convert path to File. path='() -> kotlin.String?'
java.lang.NullPointerException (no error message)
Paul Merlin
04/22/2022, 2:19 PMPaul Merlin
04/22/2022, 2:20 PMCristianGM
04/22/2022, 2:22 PMfile { builtArtifactsLoader.load(apk)?.elements?.single()?.outputFile }
to: file(builtArtifactsLoader.load(apk)!!.elements.single().outputFile)
and now it's only: java.lang.NullPointerException (no error message)
So it seems like something it's called too early, I would say it changes when CC is enabledCristianGM
04/22/2022, 2:23 PMtestApk is a @InputFile @Classpath so I can understand it's neededCristianGM
04/22/2022, 2:27 PMCristianGM
04/22/2022, 2:39 PMappApk.set { copySmallApp.destinationDir.listFiles()!!.single() }
and the error:
Configuration cache state could not be cached: field '__appApk__' from type 'FlankYmlWriterTask': error writing value of type 'org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultRegularFileVar'
> copySmallApp.destinationDir.listFiles() must not be nullCristianGM
04/22/2022, 2:39 PMCristianGM
04/22/2022, 3:08 PMdependsOn(copySmallApp))Paul Merlin
04/22/2022, 5:24 PMCristianGM
04/22/2022, 5:30 PMCristianGM
04/22/2022, 5:33 PMPaul Merlin
04/22/2022, 5:52 PMPaul Merlin
04/22/2022, 5:53 PMPaul Merlin
04/22/2022, 5:53 PMPaul Merlin
04/22/2022, 5:54 PMCristianGM
04/22/2022, 5:59 PMPaul Merlin
04/22/2022, 6:15 PMCristianGM
04/22/2022, 6:17 PMCristianGM
04/22/2022, 6:18 PMPaul Merlin
04/22/2022, 6:19 PMCristianGM
04/22/2022, 6:20 PMPaul Merlin
04/22/2022, 6:21 PMPaul Merlin
04/22/2022, 6:21 PMtestApk.value(testApkDir.map {
it.file(builtArtifactsLoader.load(it)!!.elements.single().outputFile)
})Paul Merlin
04/22/2022, 6:23 PMload(it).elements.single call that is too eager?
What's the type of elements?CristianGM
04/22/2022, 6:25 PMCristianGM
04/22/2022, 6:25 PMPaul Merlin
04/22/2022, 6:26 PMCristianGM
04/22/2022, 6:29 PMCristianGM
04/22/2022, 6:29 PMCristianGM
04/22/2022, 6:33 PMPaul Merlin
04/22/2022, 6:45 PMPaul Merlin
04/22/2022, 6:46 PMCristianGM
04/22/2022, 6:46 PMPaul Merlin
04/22/2022, 6:47 PMCristianGM
04/22/2022, 6:50 PMPaul Merlin
04/22/2022, 6:51 PMPaul Merlin
04/22/2022, 6:51 PMPaul Merlin
04/22/2022, 6:52 PMCristianGM
04/22/2022, 6:53 PMPaul Merlin
04/22/2022, 6:55 PMPaul Merlin
04/22/2022, 6:56 PMPaul Merlin
04/22/2022, 6:56 PMproviders.provider {}CristianGM
04/22/2022, 6:56 PMCristianGM
04/22/2022, 6:56 PMPaul Merlin
04/22/2022, 6:57 PMCristianGM
04/22/2022, 9:32 PMFileSystemOperations and declaring an output (@OutputFile Provider<RegularFile>)
I don't love it because copy is always a directory (with type File.. I guess if it was a Property<Directory> I wouldn't need to create my task
For the apk file..I'm using the `Provider<Directory>`and also it seems the BuildCache works fine (I wonder if it's relocatable, but I still have to try it)CristianGM
04/22/2022, 9:48 PM