build.gradle 3.07 KB
Newer Older
Andy Trevorah's avatar
Andy Trevorah committed
1 2
apply plugin: 'com.android.application'

Eric Eastwood's avatar
Eric Eastwood committed
3 4
// Try reading secrets from file
def secretsPropertiesFile = rootProject.file("secrets.properties")
5
def secretProperties = new Properties()
Eric Eastwood's avatar
Eric Eastwood committed
6 7 8 9 10
if (secretsPropertiesFile.exists()) {
    secretProperties.load(new FileInputStream(secretsPropertiesFile))
}
// Otherwise read from environment variables, this happens in CI
else {
11 12 13 14
    secretProperties.setProperty("oauth_client_id", "\"${System.getenv('oauth_client_id')}\"")
    secretProperties.setProperty("oauth_client_secret", "\"${System.getenv('oauth_client_secret')}\"")
    secretProperties.setProperty("oauth_redirect_uri", "\"${System.getenv('oauth_redirect_uri')}\"")
    secretProperties.setProperty("google_project_id", "\"${System.getenv('google_project_id') ?: "null"}\"")
15 16 17
    secretProperties.setProperty("signing_keystore_password", "${System.getenv('signing_keystore_password')}")
    secretProperties.setProperty("signing_key_password", "${System.getenv('signing_key_password')}")
    secretProperties.setProperty("signing_key_alias", "${System.getenv('signing_key_alias')}")
Eric Eastwood's avatar
Eric Eastwood committed
18
}
19

Andy Trevorah's avatar
Andy Trevorah committed
20
android {
Eric Eastwood's avatar
Eric Eastwood committed
21
    compileSdkVersion 26
22
    buildToolsVersion '28.0.3'
Andy Trevorah's avatar
Andy Trevorah committed
23 24 25

    defaultConfig {
        applicationId "im.gitter.gitter"
Andy Trevorah's avatar
Andy Trevorah committed
26
        minSdkVersion 19
Eric Eastwood's avatar
Eric Eastwood committed
27
        targetSdkVersion 26
28
        versionCode Integer.valueOf(System.env.VERSION_CODE ?: 0)
29
        // Manually bump the semver version part of the string as necessary
30
        versionName "3.4.0-${System.env.VERSION_SHA}"
31

32 33 34 35
        buildConfigField("String", "oauth_client_id", "${secretProperties['oauth_client_id']}")
        buildConfigField("String", "oauth_client_secret", "${secretProperties['oauth_client_secret']}")
        buildConfigField("String", "oauth_redirect_uri", "${secretProperties['oauth_redirect_uri']}")
        buildConfigField("String", "google_project_id", "${secretProperties['google_project_id']}" ?: "null")
Andy Trevorah's avatar
Andy Trevorah committed
36
    }
37 38 39 40
    signingConfigs {
        release {
            // You need to specify either an absolute path or include the
            // keystore file in the same directory as the build.gradle file.
41
            storeFile file("../android-signing-keystore.jks")
42 43 44 45 46
            storePassword "${secretProperties['signing_keystore_password']}"
            keyAlias "${secretProperties['signing_key_alias']}"
            keyPassword "${secretProperties['signing_key_password']}"
        }
    }
Andy Trevorah's avatar
Andy Trevorah committed
47 48
    buildTypes {
        release {
49
            minifyEnabled false
50
            testCoverageEnabled false
Andy Trevorah's avatar
Andy Trevorah committed
51
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
52
            signingConfig signingConfigs.release
Andy Trevorah's avatar
Andy Trevorah committed
53 54 55 56
        }
    }
}

Andy Trevorah's avatar
Andy Trevorah committed
57 58 59 60
repositories {
    mavenCentral()
}

Andy Trevorah's avatar
Andy Trevorah committed
61
dependencies {
62 63 64
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:design:24.2.1'
    implementation 'com.android.volley:volley:1.0.0'
65
    implementation "com.google.android.gms:play-services-gcm:10.2.1"
66 67 68 69
    implementation 'joda-time:joda-time:2.5'
    implementation 'com.github.rahatarmanahmed:circularprogressview:2.4.0'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    testImplementation 'junit:junit:4.12'
Andy Trevorah's avatar
Andy Trevorah committed
70
}