Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup build system with dependencies
- Loading branch information
Showing
4 changed files
with
418 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,178 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'io.fabric' | ||
|
||
def globalConf = rootProject.ext | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
compileSdkVersion globalConf.androidTargetSdkVersion | ||
buildToolsVersion globalConf.androidBuildToolsVersion | ||
|
||
defaultConfig { | ||
applicationId "pro.averin.anton.clean.android.cookbook" | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
minSdkVersion globalConf.androidMinSdkVersion | ||
targetSdkVersion globalConf.androidTargetSdkVersion | ||
versionCode VersionCodeReader.getVersionCode() | ||
versionName globalConf.versionName | ||
|
||
multiDexEnabled true | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
dexOptions { | ||
javaMaxHeapSize "4g" | ||
} | ||
productFlavors { | ||
stage { | ||
applicationId globalConf.androidApplicationIdStage | ||
} | ||
production { | ||
applicationId globalConf.androidApplicationIdProduction | ||
} | ||
} | ||
|
||
|
||
buildTypes { | ||
debug { | ||
applicationIdSuffix '.debug' | ||
testCoverageEnabled true | ||
debuggable true | ||
minifyEnabled false | ||
ext.enableCrashlytics = false | ||
} | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
debuggable.initWith(buildTypes.debug) | ||
debuggable { | ||
testCoverageEnabled = false | ||
} | ||
} | ||
|
||
sourceSets { | ||
debuggable { | ||
res.srcDirs = ['src/debug/res'] | ||
java.srcDirs = ['src/debug/java'] | ||
} | ||
} | ||
|
||
dataBinding { | ||
enabled = true | ||
} | ||
|
||
applicationVariants.all { variant -> | ||
|
||
def filename = "CleanAndroidCookbook-${variant.baseName}-${globalConf.versionName}.apk" | ||
|
||
variant.outputs.each { output -> | ||
output.outputFile = new File( | ||
output.outputFile.parent, | ||
filename) | ||
} | ||
} | ||
|
||
packagingOptions { | ||
exclude 'LICENSE.txt' | ||
exclude 'META-INF/DEPENDENCIES' | ||
exclude 'META-INF/ASL2.0' | ||
exclude 'META-INF/NOTICE' | ||
exclude 'META-INF/NOTICE.txt' | ||
exclude 'META-INF/LICENSE' | ||
exclude 'META-INF/LICENSE.txt' | ||
exclude 'META-INF/services/javax.annotation.processing.Processor' | ||
} | ||
|
||
testOptions { | ||
unitTests.returnDefaultValues = true | ||
} | ||
} | ||
|
||
kapt { | ||
generateStubs = true | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.4.0' | ||
Map<String, String> dependencies = globalConf.dependencies; | ||
|
||
compile dependencies.kotlin | ||
compile dependencies.kotlinReflect | ||
|
||
compile dependencies.multidex | ||
|
||
compile dependencies.appCompat | ||
compile dependencies.recyclerView | ||
compile dependencies.cardView | ||
compile dependencies.supportV4 | ||
compile dependencies.supportDesign | ||
|
||
compile dependencies.playServicesBase | ||
compile dependencies.playServicesAds | ||
compile dependencies.playServicesMaps | ||
compile dependencies.playServicesLocation | ||
compile dependencies.googleMapsUtils | ||
|
||
kapt dependencies.dataBinding | ||
|
||
compile dependencies.rxKotlin | ||
compile dependencies.rxJava | ||
compile dependencies.rxAndroid | ||
compile dependencies.rxPermissions | ||
|
||
compile dependencies.retrofit | ||
compile dependencies.retrofitConverterGson | ||
compile dependencies.retrofitAdapterRxJava | ||
compile dependencies.okhttp | ||
compile dependencies.okhttpLogging | ||
|
||
debugCompile dependencies.stetho | ||
debugCompile dependencies.stethoOkhttp | ||
debuggableCompile dependencies.stetho | ||
debuggableCompile dependencies.stethoOkhttp | ||
|
||
compile dependencies.iconics | ||
compile 'com.mikepenz:community-material-typeface:+@aar' | ||
|
||
compile dependencies.parcel | ||
kapt dependencies.parcelCompiler | ||
|
||
kapt dependencies.daggerCompiler | ||
compile dependencies.dagger | ||
provided dependencies.javaXAnnotations | ||
|
||
compile(dependencies.crashlytics) { | ||
transitive = true; | ||
} | ||
compile dependencies.logger | ||
|
||
testCompile dependencies.jUnit | ||
testCompile dependencies.powerMock | ||
testCompile dependencies.powerMockito | ||
|
||
androidTestCompile(dependencies.testRunner) { | ||
exclude module: 'support-annotations' | ||
} | ||
androidTestCompile(dependencies.espressoCore) { | ||
exclude module: 'support-annotations' | ||
} | ||
androidTestCompile(dependencies.espressoContrib) { | ||
exclude module: 'recyclerview-v7' | ||
exclude module: 'support-v4' | ||
exclude module: 'support-v13' | ||
exclude module: 'support-annotations' | ||
} | ||
androidTestCompile(dependencies.espressoIntents) { | ||
exclude module: 'support-annotations' | ||
} | ||
androidTestCompile(dependencies.multidexInstrumentation) { | ||
exclude group: 'com.android.support', module: 'multidex' | ||
} | ||
} | ||
|
||
class VersionCodeReader { | ||
static def getVersionCode() { | ||
def defaultVersion = 1 | ||
def code = System.env.BUILD_NUMBER != null ? Integer.parseInt(System.env.BUILD_NUMBER) : defaultVersion | ||
println code == defaultVersion ? "BUILD_NUMBER not found. Falling back to default version code: $defaultVersion" : "VersionCode is set to $code" | ||
return code | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
ext { | ||
supportLibraryVersion = '23.4.0' | ||
daggerVersion = '2.1' | ||
rxVersion = '1.1.0' | ||
retrofitVersion = '2.0.0' | ||
espressoVersion = '2.2.1' | ||
okHttpVersion = '3.2.0' | ||
ankoVersion = '0.8.2' | ||
powerMockVersion = '1.6.4' | ||
parcelerVersion = '1.0.4' | ||
photoViewVersion = '1.2.4' | ||
dbflowVersion = '3.0.0-beta5' | ||
multidexVersion = '1.0.1' | ||
playServicesVersion = '8.4.0' | ||
mapBoxVersion = '4.0.0' | ||
photoViewVersion = '1.2.4' | ||
parcelerVersion = '1.0.4' | ||
orhanobutLoggerVersion = '1.12' | ||
bottomBarVersion = '1.3.3' | ||
stethoVersion = '1.3.1' | ||
iconicsVersion = '2.5.11' | ||
rxPermissionsVersion = '0.5.2' | ||
|
||
dependencies = [ | ||
appCompat : "com.android.support:appcompat-v7:$supportLibraryVersion", | ||
recyclerView : "com.android.support:recyclerview-v7:$supportLibraryVersion", | ||
cardView : "com.android.support:cardview-v7:$supportLibraryVersion", | ||
supportV4 : "com.android.support:support-v4:$supportLibraryVersion", | ||
supportDesign : "com.android.support:design:$supportLibraryVersion", | ||
dataBinding : "com.android.databinding:compiler:2.0.0", | ||
multidex : "com.android.support:multidex:$multidexVersion", | ||
|
||
playServicesBase : "com.google.android.gms:play-services-base:$playServicesVersion", | ||
playServicesAds : "com.google.android.gms:play-services-ads:$playServicesVersion", | ||
playServicesMaps : "com.google.android.gms:play-services-maps:$playServicesVersion", | ||
playServicesLocation : "com.google.android.gms:play-services-location:$playServicesVersion", | ||
googleMapsUtils : "com.google.maps.android:android-maps-utils:0.4+", | ||
|
||
parcel : "org.parceler:parceler-api:$parcelerVersion", | ||
parcelCompiler : "org.parceler:parceler:$parcelerVersion", | ||
|
||
|
||
daggerCompiler : "com.google.dagger:dagger-compiler:$daggerVersion", | ||
dagger : "com.google.dagger:dagger:$daggerVersion", | ||
javaXAnnotations : "org.glassfish:javax.annotation:10.0-b28", | ||
|
||
rxKotlin : "io.reactivex:rxkotlin:0.40.1", | ||
rxJava : "io.reactivex:rxjava:$rxVersion", | ||
rxAndroid : "io.reactivex:rxandroid:$rxVersion", | ||
rxPermissions : "com.tbruyelle.rxpermissions:rxpermissions:$rxPermissionsVersion@aar", | ||
|
||
kotlin : "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version", | ||
kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version", | ||
|
||
retrofit : "com.squareup.retrofit2:retrofit:$retrofitVersion", | ||
retrofitConverterGson : "com.squareup.retrofit2:converter-gson:$retrofitVersion", | ||
retrofitAdapterRxJava : "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion", | ||
okhttp : "com.squareup.okhttp3:okhttp:$okHttpVersion", | ||
okhttpLogging : "com.squareup.okhttp3:logging-interceptor:$okHttpVersion", | ||
stetho : "com.facebook.stetho:stetho:$stethoVersion", | ||
stethoOkhttp : "com.facebook.stetho:stetho-okhttp3:$stethoVersion", | ||
|
||
glide : "com.github.bumptech.glide:glide:3.6.1", | ||
iconics : "com.mikepenz:iconics-core:$iconicsVersion@aar", | ||
|
||
crashlytics : "com.crashlytics.sdk.android:crashlytics:2.5.5@aar", | ||
logger : "com.github.orhanobut:logger:$orhanobutLoggerVersion", | ||
|
||
jUnit : "junit:junit:4.12", | ||
powerMock : "org.powermock:powermock-module-junit4:$powerMockVersion", | ||
powerMockito : "org.powermock:powermock-api-mockito:$powerMockVersion", | ||
|
||
testRunner : "com.android.support.test:runner:0.4.1", | ||
espressoCore : "com.android.support.test.espresso:espresso-core:$espressoVersion", | ||
espressoContrib : "com.android.support.test.espresso:espresso-contrib:$espressoVersion", | ||
espressoIntents : "com.android.support.test.espresso:espresso-intents:$espressoVersion", | ||
multidexInstrumentation: "com.android.support:multidex-instrumentation:$multidexVersion" | ||
] | ||
} |
Oops, something went wrong.