Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version numbering to dev builds #402

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Conversation

schuyler
Copy link
Member

@schuyler schuyler commented Jul 11, 2019

NOTE: This PR was doing too much and so I've split the CircleCI refactoring out into #406. This PR should be not be merged until after that one.

Issues:

Closes #401.

Scope:

  • Add APK version numbering for dev builds based on CircleCI build number.

Requested reviewers: @zestyping

User-visible changes

Both dev and release builds will have a version code and a human-readable version string.

Builds made from the command line will DTRT if the developer runs ./gradlew -DversionNumber=$(.circleci/get_package_version) assembleDebug.

@schuyler schuyler requested a review from zestyping July 11, 2019 00:34

# If we're building in CircleCI, the version is "x.y.z+b<n>" where <n> is the
# If we're building in CircleCI, the version is "x.y.<b>" where <b> is the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why omit z here?

Copy link
Member Author

@schuyler schuyler Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our app/build.gradle expects versionNumber to be in the form <major>.<minor>.<patch>. If we want the build number to appear in both the versionString and versionCode, it has to go somewhere, and I figured replacing the <patch> number of the latest release was the most innocuous way to do that.

The alternative would be to continue to append the build number to the original versionNumber but then (a.) build.gradle would need to be updated to permit that and (b.) the versionCode wouldn't change between dev builds. (Maybe that's actually what we want?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, just to be clear on terminology, the fields are named versionName and versionCode.

The only practical effect of the versionCode is to prevent unintended downgrades. The Play Store will only perform automatic updates that increase the versionCode. As far as I know, only the Play Store enforces this; the phone doesn't care whether the vesionCode increases or not. Because we don't plan to ever publish development APKs to the Play Store, in some sense it doesn't matter what we use for dev builds.

Any of these choices are fine:

  • Set versionCode to 0 for all dev builds
  • When versionName is x.y.z, set versionCode to 1000000x + 10000y + z for all dev builds
  • When versionName is x.y.z at patchlevel p, set versionCode to 1000000x + 10000y + 100z + p for all dev builds
  • When versionName is x.y.z, set versionCode to 1000000x + 10000y + p for all dev builds

The first is the simplest (it's what build.gradle currently does, and I think it will work fine—the net effect is that any production release will supersede (automatically install over) any development release.

@schuyler schuyler changed the title Refactor CircleCI configuration and add version numbering to dev builds Add version numbering to dev builds Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release APKs lack versionCode
2 participants