forked from kittinunf/fuel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄 🛠 Migrate Gradle scripts to Kotlin DSL (kittinunf#423)
- Loading branch information
Showing
35 changed files
with
394 additions
and
591 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,146 @@ | ||
import com.android.build.gradle.BaseExtension | ||
import com.dicedmelon.gradle.jacoco.android.JacocoAndroidUnitTestReportExtension | ||
import com.jfrog.bintray.gradle.BintrayExtension | ||
import com.novoda.gradle.release.PublishExtension | ||
import org.jetbrains.kotlin.gradle.dsl.Coroutines | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
google() | ||
} | ||
|
||
dependencies { | ||
classpath(Plugins.android) | ||
classpath(Plugins.jacocoAndroid) | ||
classpath(Plugins.bintray) | ||
classpath(kotlin("gradle-plugin", version = Versions.kotlinVersion)) | ||
} | ||
} | ||
|
||
plugins { java } | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
google() | ||
} | ||
} | ||
|
||
val androidModules = listOf("fuel-android", "fuel-livedata") | ||
val androidSampleModules = listOf("sample", "sample-java") | ||
|
||
subprojects { | ||
val isAndroidModule = project.name in androidModules | ||
val isSample = project.name in androidSampleModules | ||
val isJvmModule = !isAndroidModule && !isSample | ||
|
||
if (isJvmModule) { | ||
apply { | ||
plugin("java") | ||
plugin("kotlin") | ||
plugin("jacoco") | ||
} | ||
|
||
dependencies { | ||
compile(Dependencies.kotlinStdlib) | ||
testCompile(Dependencies.junit) | ||
} | ||
|
||
configure<JavaPluginConvention> { | ||
sourceCompatibility = JavaVersion.VERSION_1_6 | ||
targetCompatibility = JavaVersion.VERSION_1_6 | ||
|
||
sourceSets { | ||
getByName("main").java.srcDirs("src/main/kotlin") | ||
getByName("test").java.srcDirs("src/main/kotlin") | ||
} | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs = listOf("-Xdisable-default-scripting-plugin") | ||
} | ||
} | ||
|
||
tasks.withType<JacocoReport> { | ||
reports { | ||
html.isEnabled = false | ||
xml.isEnabled = true | ||
csv.isEnabled = false | ||
} | ||
} | ||
} | ||
|
||
if (isAndroidModule) { | ||
apply { | ||
plugin("com.android.library") | ||
plugin("kotlin-android") | ||
plugin("kotlin-android-extensions") | ||
plugin("jacoco-android") | ||
} | ||
|
||
configure<BaseExtension> { | ||
compileSdkVersion(Versions.fuelCompileSdkVersion) | ||
|
||
defaultConfig { | ||
minSdkVersion(Versions.fuelMinSdkVersion) | ||
targetSdkVersion(Versions.fuelCompileSdkVersion) | ||
versionCode = 1 | ||
versionName = Versions.publishVersion | ||
} | ||
|
||
sourceSets { | ||
getByName("main").java.srcDirs("src/main/kotlin") | ||
getByName("test").java.srcDirs("src/test/kotlin") | ||
} | ||
|
||
compileOptions { | ||
setSourceCompatibility(JavaVersion.VERSION_1_6) | ||
setTargetCompatibility(JavaVersion.VERSION_1_6) | ||
} | ||
|
||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
consumerProguardFiles("proguard-rules.pro") | ||
} | ||
} | ||
|
||
lintOptions { | ||
isAbortOnError = false | ||
} | ||
|
||
testOptions { | ||
unitTests.isReturnDefaultValues = true | ||
} | ||
} | ||
|
||
configure<JacocoAndroidUnitTestReportExtension> { | ||
csv.enabled(false) | ||
html.enabled(true) | ||
xml.enabled(true) | ||
} | ||
} | ||
|
||
if (!isSample) { | ||
apply { | ||
plugin("com.novoda.bintray-release") | ||
} | ||
|
||
configure<PublishExtension> { | ||
artifactId = project.name | ||
autoPublish = true | ||
desc = "The easiest HTTP networking library in Kotlin/Android" | ||
groupId = "com.github.kittinunf.fuel" | ||
setLicences("MIT") | ||
publishVersion = Versions.publishVersion | ||
uploadName = "Fuel-Android" | ||
website = "https://github.com/kittinunf/Fuel" | ||
} | ||
} | ||
} |
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,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} |
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,22 @@ | ||
object Dependencies { | ||
val androidAnnotation = "com.android.support:support-annotations:${Versions.androidSupportVersion}" | ||
val androidAppCompat = "com.android.support:appcompat-v7:${Versions.androidSupportVersion}" | ||
val androidArchExtensions = "android.arch.lifecycle:extensions:${Versions.androidArchVersion}" | ||
val androidEspressoCore = "com.android.support.test.espresso:espresso-core:${Versions.espressoVersion}" | ||
val androidEspressoIntents = "com.android.support.test.espresso:espresso-intents:${Versions.espressoVersion}" | ||
val androidTestRules = "com.android.support.test:rules:${Versions.rulesVersion}" | ||
val androidTestRunner = "com.android.support.test:runner:${Versions.runnerVersion}" | ||
val forge = "com.github.kittinunf.forge:forge:${Versions.forgeVersion}" | ||
val gson = "com.google.code.gson:gson:${Versions.gsonVersion}" | ||
val jackson = "com.fasterxml.jackson.module:jackson-module-kotlin:${Versions.jacksonVersion}" | ||
val json = "org.json:json:${Versions.jsonVersion}" | ||
val junit = "junit:junit:${Versions.junitVersion}" | ||
val kotlinCoroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.kotlinCoroutinesVersion}" | ||
val kotlinCoroutinesJvm = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutinesVersion}" | ||
val kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlinVersion}" | ||
val moshi = "com.squareup.moshi:moshi-kotlin:${Versions.moshiVersion}" | ||
val result = "com.github.kittinunf.result:result:${Versions.resultVersion}" | ||
val robolectric = "org.robolectric:robolectric:${Versions.robolectricVersion}" | ||
val rxJavaAndroid = "io.reactivex.rxjava2:rxandroid:${Versions.rxandroidVersion}" | ||
val rxJavaJvm = "io.reactivex.rxjava2:rxjava:${Versions.rxjavaVersion}" | ||
} |
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,5 @@ | ||
object Plugins { | ||
val android = "com.android.tools.build:gradle:3.1.3" | ||
val jacocoAndroid = "com.dicedmelon.gradle:jacoco-android:0.1.3" | ||
val bintray = "com.novoda:bintray-release:0.8.0" | ||
} |
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,31 @@ | ||
object Versions { | ||
// Library version | ||
val publishVersion = "1.15.0" | ||
|
||
// Core dependencies | ||
val kotlinVersion = "1.2.51" | ||
val resultVersion = "1.5.0" | ||
val jsonVersion = "20170516" | ||
|
||
// Modules dependencies | ||
val androidArchVersion = "1.1.1" | ||
val forgeVersion = "0.3.0" | ||
val gsonVersion = "2.8.2" | ||
val jacksonVersion = "2.9.6" | ||
val kotlinCoroutinesVersion = "0.23.3" | ||
val moshiVersion = "1.5.0" | ||
val rxjavaVersion = "2.1.13" | ||
val rxandroidVersion = "2.1.0" | ||
|
||
// Android dependencies | ||
val androidSupportVersion = "27.1.1" | ||
val fuelCompileSdkVersion = 27 | ||
val fuelMinSdkVersion = 14 | ||
|
||
// Testing dependencies | ||
val espressoVersion = "3.0.0" | ||
val junitVersion = "4.12" | ||
val robolectricVersion = "3.8" | ||
val rulesVersion = "1.0.0" | ||
val runnerVersion = "1.0.0" | ||
} |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
dependencies { | ||
api(project(":fuel")) | ||
implementation(Dependencies.kotlinStdlib) | ||
testImplementation(Dependencies.robolectric) | ||
testImplementation(Dependencies.junit) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.