buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } ext { configuration = [ buildDate: new Date() ] // This will make me able to build multiple times a day. May break thinks. I may forget it. todaysBuilds = "1" } def gitVersion() { def process = "git describe --abbrev=0 --tags".execute() return process.text.substring(1).replaceAll("\\.", "").trim() } def versionCodeFromGit() { def dayInYear = ext.configuration.buildDate.format("D").padLeft(3, '0') def versionCode = gitVersion() + (ext.configuration.buildDate.format("yyMM") + dayInYear + ext.todaysBuilds).toInteger() println "version code " + versionCode return versionCode.toInteger() } def versionNameFromGit() { def dayInYear = ext.configuration.buildDate.format("D").padLeft(3, '0') def versionName = gitVersion() + ext.configuration.buildDate.format('yyMM') + dayInYear + ext.todaysBuilds println "version name " + versionName return versionName } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 27 buildToolsVersion '27.0.3' defaultConfig { applicationId "apps.amine.bou.readerforselfoss" minSdkVersion 16 targetSdkVersion 27 versionCode versionCodeFromGit() versionName versionNameFromGit() // Enabling multidex support. multiDexEnabled true lintOptions { abortOnError true disable 'InvalidPackage' } vectorDrawables.useSupportLibrary = true // tests testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" buildConfigField "String", "MERCURY_KEY", mercuryApiKey buildConfigField "String", "FEEDBACK_EMAIL", feedbackEmail buildConfigField "String", "SOURCE_URL", sourceUrl buildConfigField "String", "TRACKER_URL", trackerUrl buildConfigField "String", "TRANSLATION_URL", translationUrl buildConfigField "String", "GITHUB_TOKEN", githubToken } buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { buildConfigField "String", "LOGIN_URL", appLoginUrl buildConfigField "String", "LOGIN_USERNAME", appLoginUsername buildConfigField "String", "LOGIN_PASSWORD", appLoginPassword } } flavorDimensions "build" productFlavors { githubConfig { versionNameSuffix '-github' dimension "build" buildConfigField "boolean", "GITHUB_VERSION", "true" } storeConfig { // As jenkins publishes to alpha first, this is the default suffix now. versionNameSuffix '-store' dimension "build" buildConfigField "boolean", "GITHUB_VERSION", "false" } } } dependencies { // Testing androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' androidTestImplementation 'com.android.support.test:runner:1.0.1' // Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1' // Espresso-intents for validation and stubbing of Intents androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.1' implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // Android Support implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:support-vector-drawable:27.1.1' implementation 'com.android.support:customtabs:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' // Firebase + crashlytics implementation 'com.google.firebase:firebase-core:15.0.2' implementation 'com.google.firebase:firebase-config:15.0.2' implementation 'com.google.firebase:firebase-invites:15.0.1' implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') { transitive = true } //multidex implementation 'com.android.support:multidex:1.0.3' // Intro implementation 'agency.tango.android:material-intro-screen:0.0.5' // About implementation('com.mikepenz:aboutlibraries:6.0.0@aar') { transitive = true } // Retrofit + http logging + okhttp implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' implementation 'com.burgstaller:okhttp-digest:1.12' // Material-ish things implementation 'com.ashokvarma.android:bottom-navigation-bar:2.0.3' implementation 'com.github.jd-alexander:LikeButton:0.2.1' implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' // glide implementation 'com.github.bumptech.glide:glide:4.1.1' implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1' // Asking politely users to rate the app implementation 'com.github.stkent:amplify:2.1.0' // Drawer implementation 'co.zsmb:materialdrawer-kt:1.2.1' implementation 'com.anupcowkur:reservoir:3.1.0' // Themes implementation 'com.52inc:scoops:1.0.0' implementation'com.jrummyapps:colorpicker:2.1.7' // Github issues reporter implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1' implementation 'com.github.rubensousa:floatingtoolbar:1.5.1' // Pager implementation 'me.relex:circleindicator:1.2.2@aar' implementation 'androidx.core:core-ktx:0.3' } apply plugin: 'com.google.gms.google-services' afterEvaluate { initFabricPropertiesIfNeeded() initAppLoginPropertiesIfNeeded() initAppForSecretPropertiesIfNeeded() } def initFabricPropertiesIfNeeded() { def propertiesFile = file('fabric.properties') if (!propertiesFile.exists()) { def commentMessage = "This is autogenerated fabric property from system environment to prevent key to be committed to source control." ant.propertyfile(file: "fabric.properties", comment: commentMessage) { entry(key: "apiSecret", value: crashlyticsdemoApisecret) entry(key: "apiKey", value: crashlyticsdemoApikey) } } } def initAppLoginPropertiesIfNeeded() { def propertiesFile = file(System.getProperty("user.home") + '/.gradle/gradle.properties') if (!propertiesFile.exists()) { def commentMessage = "This is autogenerated local property from system environment to prevent key to be committed to source control." ant.propertyfile(file: System.getProperty("user.home") + "/.gradle/gradle.properties", comment: commentMessage) { entry(key: "appLoginUrl", value: System.getProperty("appLoginUrl")) entry(key: "appLoginUsername", value: System.getProperty("appLoginUsername")) entry(key: "appLoginPassword", value: System.getProperty("appLoginPassword")) } } } def initAppForSecretPropertiesIfNeeded() { def propertiesFile = file(System.getProperty("user.home") + '/.gradle/gradle.properties') if (!propertiesFile.exists()) { def commentMessage = "This is autogenerated local property from system environment to prevent key to be committed to source control." ant.propertyfile(file: System.getProperty("user.home") + "/.gradle/gradle.properties", comment: commentMessage) { entry(key: "mercuryApiKey", value: System.getProperty("mercuryApiKey")) entry(key: "feedbackEmail", value: System.getProperty("feedbackEmail")) entry(key: "sourceUrl", value: System.getProperty("sourceUrl")) entry(key: "trackerUrl", value: System.getProperty("trackerUrl")) entry(key: "translationUrl", value: System.getProperty("translationUrl")) entry(key: "githubToken", value: System.getProperty("githubToken")) } } }