pull version name and code from special properties file

This commit is contained in:
Phillip Thelen 2022-06-30 11:19:41 +02:00
parent b96ed25002
commit 03cabd3248
10 changed files with 102 additions and 8 deletions

View file

@ -81,6 +81,8 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-properties (1.1.2)
java-properties
fastlane-plugin-semantic_release (1.14.1)
fastlane-plugin-versioning_android (0.1.0)
gh_inspector (1.1.3)
@ -116,6 +118,7 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
java-properties (0.3.0)
jmespath (1.4.0)
json (2.3.0)
jwt (2.1.0)
@ -176,6 +179,7 @@ PLATFORMS
DEPENDENCIES
fastlane
fastlane-plugin-properties
fastlane-plugin-semantic_release
fastlane-plugin-versioning_android

View file

@ -48,7 +48,7 @@ dependencies {
implementation "androidx.preference:preference-ktx:$preferences_version"
//Desugaring
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
implementation('com.jaredrummler:android-device-names:2.1.0')
@ -115,7 +115,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
implementation 'com.willowtreeapps:signinwithapplebutton:0.3'
@ -150,6 +150,9 @@ android {
buildConfigField "String", "TESTING_LEVEL", "\"production\""
resConfigs 'en', 'bg', 'de', 'en-rGB', 'es', 'fr', 'hr-rHR', 'in', 'it', 'iw', 'ja', 'ko', 'lt', 'nl', 'pl', 'pt-rBR', 'pt-rPT', 'ru', 'tr', 'zh', 'zh-rTW'
println app_version_code
println app_version_name
versionCode app_version_code
versionName app_version_name

View file

@ -65,6 +65,8 @@
#keep Habitica code
-keep class com.habitrpg.android.habitica.** { *; }
-keep class com.habitrpg.common.habitica.** { *; }
-keep class com.habitrpg.shared.habitica.** { *; }
#realm
-keep class io.realm.annotations.RealmModule

View file

@ -15,6 +15,7 @@ import android.text.InputType
import android.text.SpannableString
import android.text.method.LinkMovementMethod
import android.text.style.UnderlineSpan
import android.util.Log
import android.view.MenuItem
import android.view.View
import android.view.Window
@ -36,11 +37,11 @@ import com.habitrpg.android.habitica.extensions.updateStatusBarColor
import com.habitrpg.android.habitica.helpers.AmplitudeManager
import com.habitrpg.android.habitica.helpers.AppConfigManager
import com.habitrpg.android.habitica.helpers.RxErrorHandler
import com.habitrpg.common.habitica.models.auth.UserAuthResponse
import com.habitrpg.android.habitica.models.user.User
import com.habitrpg.android.habitica.ui.helpers.dismissKeyboard
import com.habitrpg.android.habitica.ui.viewmodels.AuthenticationViewModel
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
import com.habitrpg.common.habitica.models.auth.UserAuthResponse
import javax.inject.Inject
class LoginActivity : BaseActivity() {
@ -88,11 +89,13 @@ class LoginActivity : BaseActivity() {
showValidationError(R.string.login_validation_error_fieldsmissing)
return@OnClickListener
}
Log.d("LoginActivity", ": $username, $password")
apiClient.connectUser(username, password).subscribe(
{ handleAuthResponse(it) },
{
hideProgress()
RxErrorHandler.reportError(it)
Log.d("LoginActivity", ": ${it.message}", it)
}
)
}

View file

@ -33,8 +33,8 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
classpath "io.realm:realm-gradle-plugin:10.10.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0"
@ -53,6 +53,23 @@ allprojects {
}
}
Properties props = new Properties()
def propFile = new File('version.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('NAME') && props.containsKey('CODE') ) {
ext.app_version_name = props['NAME']
ext.app_version_code = props['CODE'] as Integer
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
detekt {
source = files("Habitica/src/main/java")
config = files("detekt.yml")

View file

@ -18,4 +18,5 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-keep class com.habitrpg.common.habitica.** { *; }

View file

@ -4,3 +4,4 @@
gem 'fastlane-plugin-versioning_android'
gem 'fastlane-plugin-semantic_release'
gem 'fastlane-plugin-properties'

2
version.properties Normal file
View file

@ -0,0 +1,2 @@
NAME=4.0
CODE=4040

View file

@ -15,7 +15,7 @@ android {
targetSdk target_sdk
versionCode app_version_code + 1
versionName app_version_name
buildConfigField "String", "TESTING_LEVEL", "\"production\""
}
buildTypes {
@ -33,6 +33,44 @@ android {
resValue "string", "app_name", "Habitica"
}
}
signingConfigs {
release
}
flavorDimensions "buildType"
productFlavors {
dev {
dimension "buildType"
}
staff {
dimension "buildType"
buildConfigField "String", "TESTING_LEVEL", "\"staff\""
resValue "string", "app_name", "Habitica Staff"
versionCode app_version_code + 7
}
alpha {
dimension "buildType"
buildConfigField "String", "TESTING_LEVEL", "\"alpha\""
resValue "string", "app_name", "Habitica Alpha"
versionCode app_version_code + 5
}
beta {
buildConfigField "String", "TESTING_LEVEL", "\"beta\""
dimension "buildType"
versionCode app_version_code + 3
}
prod {
buildConfigField "String", "TESTING_LEVEL", "\"production\""
dimension "buildType"
versionCode app_version_code + 1
}
}
buildFeatures {
viewBinding true
}
@ -102,4 +140,24 @@ if (HRPG_PROPS_FILE.canRead()) {
}
} else {
throw new MissingResourceException('habitica.properties not found')
}
Properties props = new Properties()
def propFile = new File('signingrelease.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}

View file

@ -18,4 +18,7 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-keep class com.habitrpg.wearos.habitica.** { *; }
-keep class com.habitrpg.common.habitica.** { *; }
-keep class com.habitrpg.shared.habitica.** { *; }