Skip to content

Commit

Permalink
Fix versionCode and build both flavours
Browse files Browse the repository at this point in the history
  • Loading branch information
garethbowen committed Nov 18, 2020
1 parent 8ff29b6 commit 5377975
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
script: make test

- stage: alpha
script: fastlane deploy flavor:unbranded
script:
- fastlane deploy flavor:unbrandedWebview
- fastlane deploy flavor:unbrandedXwalk

- stage: deploy
# flavors sorted alphabetically with three per job
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def getVersionCode = {
if (versionCode > 2100000000 / 10)
throw new RuntimeException('versionCode bigger than max allowed by Google Play.')
}

return versionCode
return versionCode * 10
}

def getVersionName = {
Expand All @@ -69,7 +68,6 @@ android {
}

defaultConfig {
versionCode getVersionCode()
versionName getVersionName()
archivesBaseName = "${project.name}-${versionName}"
targetSdkVersion 29
Expand Down Expand Up @@ -162,12 +160,16 @@ android {
webview {
dimension 'version'
minSdkVersion 29 // Android 10
// the APK with a higher minSdkVersion value must have a higher versionCode value
// https://developer.android.com/google/play/publishing/multiple-apks
versionCode getVersionCode() + 1;
versionNameSuffix '-webview'
}

xwalk {
dimension 'version'
minSdkVersion 19 // Android 4.4
versionCode getVersionCode();
versionNameSuffix '-xwalk'
}

Expand Down
3 changes: 2 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ platform :android do
lane :deploy do |options|
gradleTaskName = "assemble#{options[:flavor]}Release"
version = ENV['TRAVIS_TAG'].empty? ? 'SNAPSHOT' : ENV['TRAVIS_TAG']
package_name = options[:flavor] == 'unbranded' ? "org.medicmobile.webapp.mobile" : "org.medicmobile.webapp.mobile.#{options[:flavor]}"
brand = options[:flavor].replace("Webview", "").replace("Xwalk", "")
package_name = brand == 'unbranded' ? "org.medicmobile.webapp.mobile" : "org.medicmobile.webapp.mobile.#{brand}"

gradle(task: gradleTaskName)

Expand Down

0 comments on commit 5377975

Please sign in to comment.