Closed b95505017 closed 4 years ago
Do you have anything specific in mind? Here's a clearer version of that test:
android {
onVariantProperties {
for (output in outputs) {
val processedVersionCode = output.versionCode.map { playVersionCode ->
// Version names will look like `semantic.release.name.123`
"semantic.release.name.$playVersionCode"
}
output.versionName.set(processedVersionCode)
}
}
}
Closing in favor of #853
@SUPERCILEX I found that it hard to replace some part of current versionName config (based on other config such as versionNameSuffix
). Use output.versionName.zip(output.versionCode)
seems not working.
Previously I could use versionNameOverride.replace(...)
. How do I achieve this?
Does using output.versionName.get().replace(...)
not work?
No, I tried get()
or map { }
both get StackOverflowError
Ah, you're doing it inside the versionCode.map
... You have to get the value before-hand or it will evaluate to versionName.set
which is where you're trying to use it, so then it goes back in there, calls get and yada yada yay recursion. :) Basically just move it outside the map and it should work hopefully:
for (output in outputs) {
val initialVersionName = output.versionName.get()
val processedVersionCode = output.versionCode.map { playVersionCode ->
initialVersionName...
}
output.versionName.set(processedVersionCode)
}
Note that that's also wrong long-term, but I haven't figured out the solution yet: #858
https://github.com/Triple-T/gradle-play-publisher#post-processing-outputs-sanitized-by-auto-resolution
I want to do the same effect in 3.0.0-SNAPSHOT but
outputProcessor
is gone in 3.0.0-SNAPSHOT, I only saw onVariantProperties but need more cleared guide.