Skip to content

Instantly share code, notes, and snippets.

@Stickerbox
Created January 2, 2018 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stickerbox/8a44680cc3eefb359fbd44aaa8e3a567 to your computer and use it in GitHub Desktop.
Save Stickerbox/8a44680cc3eefb359fbd44aaa8e3a567 to your computer and use it in GitHub Desktop.
The project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// This is the project gradle file
buildscript {
ext.kotlin_version = '1.2.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
ext {
targetSdk = 26
compileSdk = 26
buildTools = '27.0.1'
minSdk = 21
}
def supportLibraryVer = '27.0.1'
def retrofitVer = '2.3.0'
def rxAndroidVer = '2.0.1'
def rxKotlinVer = '2.2.0'
def gsonVer = '2.8.2'
def constraintLayoutVer = '1.0.2'
def junitVer = '4.12'
def espressoVer = '2.2.2'
ext {
supportv4 = ["com.android.support:support-v4:$supportLibraryVer"]
appcompatv7 = ["com.android.support:appcompat-v7:$supportLibraryVer"]
retrofit = ["com.squareup.retrofit2:retrofit:$retrofitVer",
"com.squareup.retrofit2:adapter-rxjava2:$retrofitVer",
"com.squareup.retrofit2:converter-gson:$retrofitVer"]
rxAndroid = ["io.reactivex.rxjava2:rxandroid:$rxAndroidVer",
"io.reactivex.rxjava2:rxkotlin:$rxKotlinVer"]
gson = ["com.google.code.gson:gson:$gsonVer"]
constraintLayout = ["com.android.support.constraint:constraint-layout:$constraintLayoutVer"]
unittest = {}
unittest.ext {
junit = ["junit:junit:$junitVer"]
}
uitest = {}
uitest.ext {
espresso = ["com.android.support.test.espresso:espresso-core:$espressoVer",
"com.android.support.test.espresso:espresso-contrib:$espressoVer"]
}
}
ext.internalProject = { code ->
dependencies {
implementation project(":$code")
}
}
ext.exposedProject = { code ->
dependencies {
api project(":$code")
}
}
ext.internalLib = { codes ->
dependencies {
codes.each {
if (it.startsWith("#")) {
compileOnly it.substring(1)
} else if (it.startsWith("*")) {
kapt it.substring(1)
} else {
implementation it
}
}
}
}
ext.exposedLib = { codes ->
dependencies {
codes.each {
if (it.startsWith("#")) {
compileOnly it.substring(1)
} else if (it.startsWith("*")) {
kapt it.substring(1)
} else {
api it
}
}
}
}
ext.test = { codes ->
dependencies {
codes.each {
if (it.startsWith("*")) {
kaptTest it.substring(1)
} else {
testImplementation it
}
}
}
}
ext.androidTest = { codes ->
dependencies {
codes.each {
if (it.startsWith("*")) {
kaptAndroidTest it.substring(1)
} else {
androidTestImplementation it
}
}
}
}
}
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