import java.nio.file.Files apply plugin: 'com.android.application' // Try reading secrets from file def secretsPropertiesFile = rootProject.file("secrets.properties") def secretProperties = new Properties() if (secretsPropertiesFile.exists()) { secretProperties.load(new FileInputStream(secretsPropertiesFile)) } // Otherwise read from environment variables, this happens in CI else { 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"}\"") 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')}") } // Download gitter-webapp assets from current release task fetchWebappAssets() { description("Download gitter-webapp assets from current release and move") doLast { def zipFile = file("${getTemporaryDir()}/webapp-artifacts.zip") def assetsDir = file("${projectDir}/src/main/assets") def artifactURI = "https://gitlab.com/gitlab-org/gitter/webapp/-/jobs/artifacts/master/download?job=mobile-asset-build" new URL(artifactURI).withInputStream { i -> zipFile.withOutputStream { it << i } } copy { from zipTree(zipFile) into file("${getTemporaryDir()}") } ant.move file: file("${getTemporaryDir()}/output/android/www"), todir: assetsDir delete(zipFile, getTemporaryDir()) } } android { compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig { applicationId "im.gitter.gitter" minSdkVersion 19 targetSdkVersion 28 versionCode Integer.valueOf(System.env.VERSION_CODE ?: 1) // Manually bump the semver version part of the string as necessary versionName "3.6.0-${System.env.VERSION_SHA}" 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") } signingConfigs { release { // You need to specify either an absolute path or include the // keystore file in the same directory as the build.gradle file. storeFile file("../android-signing-keystore.jks") storePassword "${secretProperties['signing_keystore_password']}" keyAlias "${secretProperties['signing_key_alias']}" keyPassword "${secretProperties['signing_key_password']}" } } buildTypes { release { minifyEnabled false testCoverageEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } } repositories { mavenCentral() } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:design:24.2.1' implementation 'com.android.volley:volley:1.0.0' implementation "com.google.android.gms:play-services-gcm:10.2.1" 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' }