Description of the feature request
Reading through the documentation and the code for the steps-change-android-versioncode-and-versionname step, for setting up versionCode (I’m disregarding any logic for versionName in this request) you have to define a predefined value (or env variable) as a new value, or default to $BITRISE_BUILD_NUMBER
. Even when used in conjunction with the version_code_offset
property, it assumes that a valid new_version_code
is set.
Use case / for what or how I would use it
My use case is that I would like the step to help me just increment the existing versionCode
by the version_code_offset
value. The step already parses the existing versionCode
in the code, so it would be great to make new_version_code
optional or to not break current default behavior, just accept ''
(empty string) as input (so it doesn’t default to $BITRISE_BUILD_NUMBER
when it’s undeclared) and just simply increase the current versionCode
by the value set in new_version_code
(if set, otherwise skip)
It is possible to do this today in two steps:
- script@1:
inputs:
- content: >-
envman add --key CURRENT_VERSION_CODE --value "$(grep -P
'versionCode(?:\s|=)+(.*?)(?:\s|\/\/|$)' $PROJECT_LOCATION/$MODULE//build.gradle |
awk '{ print $2}')"
title: Temporary solution to get current versionCode
- change-android-versioncode-and-versionname@1:
inputs:
- new_version_code: $CURRENT_VERSION_CODE
- version_code_offset: 1
- build_gradle_path: $BITRISE_SOURCE_DIR/$MODULE/build.gradle
title: Update versionCode and versionName
But you get the idea – this is not ideal since we both parse the same regexp in two places instead of just doing it in one