Skip to content

Instantly share code, notes, and snippets.

@GrishinSergey
Last active May 30, 2020 06:57
Show Gist options
  • Save GrishinSergey/4699e5950e96d4efb048e5e6960f2efd to your computer and use it in GitHub Desktop.
Save GrishinSergey/4699e5950e96d4efb048e5e6960f2efd to your computer and use it in GitHub Desktop.
Regular Gradle Config
ext.deps = [:]
ext.deps.androidx = [:]
ext.deps.google = [:]
ext.deps.kotlin = [:]
ext.deps.third = [:]
ext.deps.test = [:]
ext.deps.androidx.appcompat = "androidx.appcompat:appcompat:$appcompatVersion"
ext.deps.androidx.cardview = "androidx.cardview:cardview:$cardviewVersion"
ext.deps.androidx.recyclerview = "androidx.recyclerview:recyclerview:$recyclerViewVersion"
ext.deps.androidx.legacy = "androidx.legacy:legacy-support-v4:$legacySupportV4Version"
ext.deps.androidx.gridlayout = "androidx.gridlayout:gridlayout:$gridLayoutVersion"
ext.deps.androidx.constraintlayout = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
ext.deps.androidx.lifecycleRuntime = "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion"
ext.deps.androidx.lifecycleProcess = "androidx.lifecycle:lifecycle-process:$lifecycleVersion"
ext.deps.androidx.lifecycleJava8Compiler = "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
ext.deps.androidx.vectordrawable = "androidx.vectordrawable:vectordrawable:$vectorDrawableVersion"
ext.deps.androidx.coreKtx = "androidx.core:core-ktx:$coreKtxVersion"
ext.deps.androidx.securityCrypto = "androidx.security:security-crypto:$socketIo"
ext.deps.androidx.navigationFragmentKtx = "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
ext.deps.androidx.navigationUiKtx = "androidx.navigation:navigation-ui-ktx:$navigationVersion"
ext.deps.androidx.roomRuntime = "androidx.room:room-runtime:$roomVersion"
ext.deps.androidx.roomKtx = "androidx.room:room-ktx:$roomVersion"
ext.deps.androidx.roomCompiler = "androidx.room:room-compiler:$roomVersion"
ext.deps.google.gson = "com.google.code.gson:gson:$gsonVersion"
ext.deps.google.fcm = "com.google.firebase:firebase-messaging:$fcmVersion"
ext.deps.google.material = "com.google.android.material:material:$materialVersion"
ext.deps.google.dagger = "com.google.dagger:dagger:$dagger2Version"
ext.deps.google.daggerAndroid = "com.google.dagger:dagger-android:$dagger2Version"
ext.deps.google.daggerAndroidSupport = "com.google.dagger:dagger-android-support:$dagger2Version"
ext.deps.google.daggerCompiler = "com.google.dagger:dagger-compiler:$dagger2Version"
ext.deps.google.daggerAndroidProcessor = "com.google.dagger:dagger-android-processor:$dagger2Version"
ext.deps.kotlin.stdlib = "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
ext.deps.third.javaxAnnotation = "javax.annotation:jsr250-api:1.0"
ext.deps.third.javaxInject = "javax.inject:javax.inject:1"
ext.deps.third.glide = "com.github.bumptech.glide:glide:$glideVersion"
ext.deps.third.glideCompiler = "com.github.bumptech.glide:compiler:$glideVersion"
ext.deps.third.glideOkHttp = "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
ext.deps.third.rxJava2 = "io.reactivex.rxjava2:rxjava:$rxJava2Version"
ext.deps.third.rxAndroid = "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
ext.deps.third.rxKotlin = "io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
ext.deps.third.commonsImaging = "org.apache.commons:commons-imaging:1.0-alpha1"
ext.deps.third.okhttp = "com.squareup.okhttp3:okhttp:$okhttpVersion"
ext.deps.third.retrofit2 = "com.squareup.retrofit2:retrofit:$retrofit2Version"
ext.deps.third.retrofit2RxAdapter = "com.squareup.retrofit2:adapter-rxjava2:$retrofit2Version"
ext.deps.third.converterScalars = "com.squareup.retrofit2:converter-scalars:$retrofit2Version"
ext.deps.third.converterGson = "com.squareup.retrofit2:converter-gson:$retrofit2Version"
ext.deps.test.junit = "junit:junit:4.12"
ext.deps.test.mockk = "io.mockk:mockk:1.9.3.kotlin12"
ext.deps.test.robolectric = "org.robolectric:robolectric:4.4-SNAPSHOT"
ext.deps.test.androidxTestRunner = "androidx.test:runner:1.2.0"
ext.deps.test.androidxRoomTest = "androidx.room:room-testing:2.2.5"
ext.deps.test.androidxTestJunitExt = "androidx.test.ext:junit:1.1.1"
# this versions should be updated time to time
compileSdkVersion=29
minSdkVersion=24
targetSdkVersion=29
versionCode=1
navigationVersion=2.3.0-alpha05
googleServicesVersion=4.3.3
kotlinVersion=1.3.71
gradleVersion=3.6.1
appcompatVersion=1.1.0
coreKtxVersion=1.3.0-beta01
cardviewVersion=1.0.0
recyclerViewVersion=1.0.0
legacySupportV4Version=1.0.0
gridLayoutVersion=1.0.0
constraintLayoutVersion=1.1.3
vectorDrawableVersion=1.1.0
lifecycleVersion=2.3.0-alpha01
roomVersion=2.2.5
materialVersion=1.2.0-alpha05
socketIo=1.0.0-rc01
okhttpVersion=4.4.0
retrofit2Version=2.8.1
dagger2Version=2.27
rxJava2Version=2.2.10
rxAndroidVersion=2.1.1
rxKotlinVersion=2.4.0
glideVersion=4.11.0
fcmVersion=20.1.5
gsonVersion=2.8.6
applicationId=com.vendor.packagename
serverApiDebug="http://debug.server.com/"
serverApiRelease="http://release.server.com/"
socketUrlDebug="http://debug.server-socket.com/"
socketUrlRelease="http://release.server-socket.com/"
appDataBaseName="AppDataBaseName"
signingFilePath="path-to-key.jks"
signingStorePassword="password"
signingKeyPassword="password"
signingKeyAlias="key"
/* it is universal file, should be truncated and cleared of unnecessary settings and dependencies */
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: "com.google.gms.google-services"
android {
compileSdkVersion project.compileSdkVersion.toInteger()
defaultConfig {
applicationId project.applicationId
minSdkVersion project.minSdkVersion.toInteger()
targetSdkVersion project.targetSdkVersion.toInteger()
versionCode project.versionCode.toInteger()
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.schemaLocation": "$projectDir/schemas".toString(),
"room.incremental": "true",
]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
signingConfigs {
release {
storeFile file(project.signingFilePath)
storePassword project.signingStorePassword
keyAlias project.signingKeyAlias
keyPassword project.signingKeyPassword
}
}
buildTypes {
debug {
/* cuz some changes in external storage accsess in Android10, this field is unnecessary,
* if you depending on api29+, see: https://developer.android.com/training/data-storage#permissions
*/
buildConfigField "String", "APPLICATION_FOLDER_NAME", "\"${project.applicationId}\""
buildConfigField "String", "BASE_API_URL", project.serverApiDebug
buildConfigField "String", "BASE_SOCKET_URL", project.socketUrlDebug
}
release {
buildConfigField "String", "APPLICATION_FOLDER_NAME", "\"${project.applicationId}\""
buildConfigField "String", "BASE_API_URL", project.serverApiRelease
buildConfigField "String", "BASE_SOCKET_URL", project.socketUrlRelease
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
androidExtensions {
experimental = true
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation deps.kotlin.stdlib
implementation deps.google.fcm
implementation deps.google.material
implementation deps.google.gson
implementation deps.google.dagger
implementation deps.google.daggerAndroid
implementation deps.google.daggerAndroidSupport
kapt deps.google.daggerCompiler
kapt deps.google.daggerAndroidProcessor
kapt deps.androidx.lifecycleJava8Compiler
implementation deps.androidx.coreKtx
implementation deps.androidx.securityCrypto
implementation deps.androidx.lifecycleRuntime
implementation deps.androidx.constraintlayout
implementation deps.androidx.appcompat
implementation deps.androidx.legacy
implementation deps.androidx.recyclerview
implementation deps.androidx.lifecycleProcess
implementation deps.androidx.cardview
implementation deps.androidx.navigationFragmentKtx
implementation deps.androidx.navigationUiKtx
implementation deps.androidx.roomRuntime
implementation deps.androidx.roomKtx
kapt deps.androidx.roomCompiler
implementation deps.third.glide
implementation (deps.third.glideOkHttp) {
exclude group: "glide-parent"
}
kapt deps.third.glideCompiler
implementation deps.third.rxJava2
implementation deps.third.rxAndroid
implementation deps.third.rxKotlin
implementation deps.third.okhttp
implementation deps.third.retrofit2
implementation deps.third.retrofit2RxAdapter
implementation deps.third.converterScalars
implementation deps.third.converterGson
implementation deps.third.commonsImaging
testImplementation deps.test.junit
testImplementation deps.test.mockk
testImplementation deps.test.robolectric
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradleVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
classpath "com.google.gms:google-services:$googleServicesVersion"
}
apply from: "dependencies.gradle"
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment