Setup various tools

This commit is contained in:
Benoit Marty
2019-03-13 17:00:30 +01:00
parent 26ae034ba9
commit a199eaa171
18 changed files with 743 additions and 3 deletions

View File

@ -15,7 +15,7 @@ def versionMajor = 0
def versionMinor = 1
def versionPatch = 0
def generateVersionCodeFromTimestamp() {
static def generateVersionCodeFromTimestamp() {
// It's unix timestamp divided by 10: It's incremented by one every 10 seconds.
return (System.currentTimeMillis() / 1_000 / 10).toInteger()
}
@ -24,6 +24,21 @@ def generateVersionCodeFromVersionName() {
return versionMajor * 10000 + versionMinor * 100 + versionPatch
}
static def gitRevision() {
def cmd = "git rev-parse --short HEAD"
return cmd.execute().text.trim()
}
static def gitRevisionDate() {
def cmd = "git show -s --format=%ci HEAD^{commit}"
return cmd.execute().text.trim()
}
static def gitBranchName() {
def cmd = "git name-rev --name-only HEAD"
return cmd.execute().text.trim()
}
project.android.buildTypes.all { buildType ->
buildType.javaCompileOptions.annotationProcessorOptions.arguments =
[
@ -31,6 +46,8 @@ project.android.buildTypes.all { buildType ->
]
}
def buildNumber = System.getenv("BUILD_NUMBER") as Integer ?: 0
android {
compileSdkVersion 28
defaultConfig {
@ -40,8 +57,15 @@ android {
multiDexEnabled true
versionCode generateVersionCodeFromTimestamp()
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
resValue "string", "git_revision", "\"${gitRevision()}\""
resValue "string", "git_revision_date", "\"${gitRevisionDate()}\""
resValue "string", "git_branch_name", "\"${gitBranchName()}\""
resValue "string", "build_number", "\"${buildNumber}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
resValue "bool", "debug_mode", "true"
@ -55,11 +79,61 @@ android {
}
}
flavorDimensions "store"
productFlavors {
appgplay {
dimension "store"
buildConfigField "boolean", "ALLOW_FCM_USE", "true"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"G\""
buildConfigField "String", "FLAVOR_DESCRIPTION", "\"GooglePlay\""
}
appfdroid {
dimension "store"
buildConfigField "boolean", "ALLOW_FCM_USE", "false"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"F\""
buildConfigField "String", "FLAVOR_DESCRIPTION", "\"FDroid\""
}
}
lintOptions {
warning 'MissingTranslation'
// Treat some warnings as errors
// Resources
error 'TypographyEllipsis'
warning 'ImpliedQuantity'
// UX
error 'ButtonOrder'
// Layout
error 'StringFormatCount'
error 'HardcodedText'
error 'SpUsage'
error 'ObsoleteLayoutParam'
error 'InefficientWeight'
error 'DisableBaselineAlignment'
error 'ScrollViewSize'
// RTL
error 'RtlEnabled'
error 'RtlHardcoded'
error 'RtlSymmetry'
// Code
error 'SetTextI18n'
error 'ViewConstructor'
error 'UseValueOf'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="riot_app_name" translatable="false">Riot.im</string>
<!-- server urls -->
<string name="vector_im_server_url" translatable="false">https://vector.im</string>
<string name="matrix_org_server_url" translatable="false">https://matrix.org</string>
<string name="default_hs_server_url" translatable="false">https://matrix.org</string>
<string name="default_identity_server_url" translatable="false">https://vector.im</string>
<string name="piwik_server_url" translatable="false">"https://piwik.riot.im"</string>
<!-- Widget urls -->
<string name="integrations_ui_url" translatable="false">"https://scalar-staging.riot.im/scalar-web/"</string>
<string name="integrations_rest_url" translatable="false">"https://scalar-staging.riot.im/scalar/api"</string>
<string-array name="integrations_widgets_urls" translatable="false">
<item>https://scalar-staging.riot.im/scalar/api</item>
<item>https://scalar.vector.im/api</item>
</string-array>
<!-- empty means to use the active HS url -->
<!-- set a valid URL like "https://matrix.org" to use a custom one -->
<string name="push_server_url" translatable="false" />
<string-array name="room_directory_servers" translatable="false">
<item>matrix.org</item>
</string-array>
</resources>