Implement lazy properties#176
Conversation
|
Hey, @runningcode please take a look, thanks! |
runningcode
left a comment
There was a problem hiding this comment.
Looking good. just some small logic changes I noticed. I haven't finished my review though.
| } | ||
| check(base.debugApk.isPresent) { "debugApk must be specified" } | ||
| check(base.instrumentationApk.isPresent xor !base.roboScript.isNullOrBlank()) { | ||
| check(base.instrumentationApk.isPresent xor base.roboScript.isPresent) { |
There was a problem hiding this comment.
the previous logic checked if the roboScript was not null and not blank. Should we check that here as well?
There was a problem hiding this comment.
TBH I based my implementation on instrumentationApk check, but yeah, for now we should check for path being blank as well.
FYI, this will change with #165
| appendln(" test: ${base.instrumentationApk.get()}") | ||
| } | ||
| appendln(deviceString) | ||
| if (config.devices.isPresentAndNotEmpty) appendln(createDeviceString(config.devices.get())) |
There was a problem hiding this comment.
Is the device a required property in flank? What would happen if it were omitted?
I believe the previous logic would alway add it, this logic only add it if it is present. Why the change?
There was a problem hiding this comment.
Actually not, we can omit devices and NexusLowRes will be taken as default. TBH the only required properties (from flank's perspective) are app apk and test apk. I have in my mind to change it in fladle but in separate PR
There was a problem hiding this comment.
But I can change implementation to reflect the previous one, and change it with another PR
There was a problem hiding this comment.
Makes sense. What version of the API/Android SDK does Flank use? I want to ensure that there are no unexpected changes introduced with this change.
There was a problem hiding this comment.
Makes sense. What version of the API/Android SDK does Flank use? I want to ensure that there are no unexpected changes introduced with this change.
28
runningcode
left a comment
There was a problem hiding this comment.
Two more questions.
There are a lot of large customers of fladle, and I just want to make sure not to introduce any unexpected changes.
| appendln(" test: ${base.instrumentationApk.get()}") | ||
| } | ||
| appendln(deviceString) | ||
| if (config.devices.isPresentAndNotEmpty) appendln(createDeviceString(config.devices.get())) |
There was a problem hiding this comment.
Makes sense. What version of the API/Android SDK does Flank use? I want to ensure that there are no unexpected changes introduced with this change.
runningcode
left a comment
There was a problem hiding this comment.
Alright, we're getting pretty close. Sorry its a big PR and its taking me a while to get through. :)
Here's another round of comments.
| extension.debugApk.set([email protected]) | ||
| } | ||
| if (extension.roboScript == null && !extension.instrumentationApk.isPresent) { | ||
| if (!extension.roboScript.isPresent && !extension.instrumentationApk.isPresent) { |
There was a problem hiding this comment.
in order to maintain the same logic as before, i think this should be:
| if (!extension.roboScript.isPresent && !extension.instrumentationApk.isPresent) { | |
| if (extension.roboScript.orNull == null && !extension.instrumentationApk.isPresent) { |
| override var devices: List<Map<String, String>> = listOf(mapOf("model" to "NexusLowRes", "version" to "28")) | ||
| override val useOrchestrator: Property<Boolean> = objects.property<Boolean>().convention(false) | ||
| override val autoGoogleLogin: Property<Boolean> = objects.property<Boolean>().convention(false) | ||
| override val devices: ListProperty<Map<String, String>> = objects.listProperty<Map<String, String>>().convention(listOf(mapOf("model" to "NexusLowRes", "version" to "28"))) |
There was a problem hiding this comment.
thanks for keeping this here. perhaps we can remove it in a separate PR.
| resultsBucket = resultsBucket, | ||
| keepFilePath = keepFilePath, | ||
| resultsDir = resultsDir, | ||
| useOrchestrator = objects.property<Boolean>().convention(useOrchestrator), |
There was a problem hiding this comment.
thanks for changing all of these! 👍
| } | ||
| check(base.debugApk.isPresent) { "debugApk must be specified" } | ||
| check(base.instrumentationApk.isPresent xor !base.roboScript.isNullOrBlank()) { | ||
| check(base.instrumentationApk.isPresent xor !base.roboScript.orNull.isNullOrBlank()) { |
| appendln(" test: ${base.instrumentationApk.get()}") | ||
| } | ||
| appendln(deviceString) | ||
| if (config.devices.isPresentAndNotEmpty) appendln(createDeviceString(config.devices.get())) |
There was a problem hiding this comment.
i think this isPresentAndNotEmpty can be removed now.
| appendln(" output-style: ${config.outputStyle.get()}") | ||
| appendProperty(config.testShards, name = "max-test-shards") | ||
| appendProperty(config.shardTime, name = "shard-time") | ||
| appendProperty(config.repeatTests, name = "num-test-runs") |
| private fun <T> StringBuilder.appendListProperty( | ||
| prop: ListProperty<T>, |
There was a problem hiding this comment.
In this case, I believe the list property must always be of type string. Can we restrict the API in that way in order to prevent it from being abused or having unintended effects?
| private fun <T> StringBuilder.appendListProperty( | |
| prop: ListProperty<T>, | |
| private fun StringBuilder.appendListProperty( | |
| prop: ListProperty<String>, |
|
|
||
| config.roboScript?.let { | ||
| appendln(" robo-script: $it") | ||
| private fun <T, K> StringBuilder.appendMapProperty( |
There was a problem hiding this comment.
In this case, I believe the map property must always be of type string. Can we restrict the API in that way in order to prevent it from being abused or having unintended effects?
| private fun <T, K> StringBuilder.appendMapProperty( | |
| private fun StringBuilder.appendMapProperty( |
|
Thanks @pawelpasterz for doing this! i know it was a lot of work! |
This will fix #92
What was done?
What was not done?
ConfigurationCacheTest#runFlank(it is also falling on the master branch)YamlWriterTestI decided to left above as they are since the scope of this PR is rather big