-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite build script to Kotlin Script
- Loading branch information
Showing
18 changed files
with
267 additions
and
213 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 |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
/.idea/* | ||
.DS_Store | ||
/build | ||
/buildSrc | ||
/captures | ||
.externalNativeBuild |
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,47 @@ | ||
import org.jetbrains.kotlin.config.KotlinCompilerVersion | ||
|
||
plugins { | ||
id("com.android.application") | ||
id("kotlin-android") | ||
id("kotlin-android-extensions") | ||
id("kotlin-kapt") | ||
} | ||
|
||
android { | ||
compileSdkVersion(ProjectSettings.compileSdk) | ||
|
||
defaultConfig { | ||
applicationId = ProjectSettings.applicationId | ||
minSdkVersion(ProjectSettings.minSdk) | ||
targetSdkVersion(ProjectSettings.targetSdk) | ||
} | ||
|
||
dataBinding { | ||
isEnabled = true | ||
} | ||
|
||
compileOptions { | ||
setSourceCompatibility(JavaVersion.VERSION_1_8) | ||
setTargetCompatibility(JavaVersion.VERSION_1_8) | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":mvvm")) | ||
implementation(project(":dagger")) | ||
|
||
implementation(kotlin(Deps.Kotlin.stdlib, KotlinCompilerVersion.VERSION)) | ||
implementation(kotlin(Deps.Kotlin.reflect, KotlinCompilerVersion.VERSION)) | ||
|
||
implementation(Deps.AndroidX.appcompat) | ||
implementation(Deps.AndroidX.annnotation) | ||
implementation(Deps.AndroidX.vectordrawable) | ||
|
||
implementation(Deps.AndroidX.lifecycleExtensions) | ||
kapt(Deps.AndroidX.lifecycleCompiler) | ||
kapt(Deps.AndroidX.databindingCompiler) | ||
|
||
implementation(Deps.DI.daggerSupport) | ||
kapt(Deps.DI.daggerProcessor) | ||
kapt(Deps.DI.daggerCompiler) | ||
} |
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath(Deps.gradlePlugin) | ||
classpath(Deps.Plugins.androidMaven) | ||
classpath(kotlin(Deps.Kotlin.gradlePlugin, Versions.kotlin)) | ||
} | ||
} | ||
|
||
plugins { | ||
idea | ||
id(Deps.Plugins.detekt) version Versions.detekt | ||
id(Deps.Plugins.ktlint) version Versions.ktlint | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
subprojects { | ||
apply(plugin = Deps.Plugins.ktlint) | ||
|
||
ktlint { | ||
version.set(Versions.ktlintExtension) | ||
ignoreFailures.set(true) | ||
android.set(true) | ||
outputToConsole.set(true) | ||
reporters.set(setOf(ReporterType.PLAIN, ReporterType.CHECKSTYLE)) | ||
} | ||
} | ||
|
||
detekt { | ||
version = Versions.detekt | ||
input = files("app/src/main/java", "mvvm/src/main/java", "dagger/src/main/java") | ||
filters = ".*/resources/.*,.*/build/.*" | ||
config = files("detekt.yml") | ||
} |
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,42 @@ | ||
object Deps { | ||
const val gradlePlugin = "com.android.tools.build:gradle:${Versions.gradle}" | ||
const val javaX = "javax.inject:javax.inject:${Versions.javaX}" | ||
|
||
object Plugins { | ||
const val detekt = "io.gitlab.arturbosch.detekt" | ||
const val ktlint = "org.jlleitschuh.gradle.ktlint" | ||
const val androidMaven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.androidMaven}" | ||
} | ||
|
||
object Kotlin { | ||
const val gradlePlugin = "gradle-plugin" | ||
const val stdlib = "stdlib-jdk7" | ||
const val reflect = "reflect" | ||
} | ||
|
||
object DI { | ||
const val daggerSupport = "com.google.dagger:dagger-android-support:${Versions.dagger}" | ||
const val daggerProcessor = "com.google.dagger:dagger-android-processor:${Versions.dagger}" | ||
const val daggerCompiler = "com.google.dagger:dagger-compiler:${Versions.dagger}" | ||
} | ||
|
||
object AndroidX { | ||
const val appcompat = "androidx.appcompat:appcompat:${Versions.androidx}" | ||
const val annnotation = "androidx.annotation:annotation:${Versions.androidx}" | ||
const val palette = "androidx.palette:palette:${Versions.androidx}" | ||
const val ktx = "androidx.core:core-ktx:${Versions.androidx}" | ||
const val vectordrawable = "androidx.vectordrawable:vectordrawable:${Versions.androidx}" | ||
|
||
const val lifecycleExtensions = "androidx.lifecycle:lifecycle-extensions:${Versions.arch_components}" | ||
const val lifecycleCompiler = "androidx.lifecycle:lifecycle-compiler:${Versions.arch_components}" | ||
const val databindingCompiler = "androidx.databinding:databinding-compiler:${Versions.databinding}" | ||
|
||
const val archTesting = "androidx.arch.core:core-testing:${Versions.arch_components}" | ||
} | ||
|
||
object Test { | ||
const val jUnit = "junit:junit:${Versions.jUnit}" | ||
const val assertJ = "org.assertj:assertj-core:${Versions.assertJ}" | ||
const val mockitoKotlin = "com.nhaarman:mockito-kotlin-kt1.1:${Versions.mockitoKotlin}" | ||
} | ||
} |
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 @@ | ||
object ProjectSettings { | ||
const val applicationId = "com.thefuntasty.mvvmsample" | ||
const val compileSdk = 28 | ||
const val targetSdk = 28 | ||
const val minSdk = 19 | ||
} |
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,25 @@ | ||
object Versions { | ||
// gradle | ||
const val gradle = "3.2.1" | ||
|
||
// plugins | ||
const val detekt = "1.0.0-RC10" | ||
const val ktlint = "6.2.1" | ||
const val ktlintExtension = "0.29.0" | ||
const val androidMaven = "1.4.1" | ||
|
||
// kotlin | ||
const val kotlin = "1.3.10" | ||
|
||
// core | ||
const val androidx = "1.0.0" | ||
const val arch_components = "2.0.0" | ||
const val dagger = "2.16" | ||
const val databinding = "3.2.1" | ||
|
||
// test | ||
const val javaX = "1" | ||
const val jUnit = "4.12" | ||
const val assertJ = "3.8.0" | ||
const val mockitoKotlin = "1.5.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,41 @@ | ||
import org.jetbrains.kotlin.config.KotlinCompilerVersion | ||
|
||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
id("com.github.dcendents.android-maven") | ||
} | ||
|
||
android { | ||
compileSdkVersion(ProjectSettings.compileSdk) | ||
|
||
defaultConfig { | ||
minSdkVersion(ProjectSettings.minSdk) | ||
targetSdkVersion(ProjectSettings.targetSdk) | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":mvvm")) | ||
|
||
implementation(kotlin(Deps.Kotlin.stdlib, KotlinCompilerVersion.VERSION)) | ||
implementation(kotlin(Deps.Kotlin.reflect, KotlinCompilerVersion.VERSION)) | ||
|
||
implementation(Deps.AndroidX.appcompat) | ||
implementation(Deps.AndroidX.annnotation) | ||
implementation(Deps.AndroidX.lifecycleExtensions) | ||
kapt(Deps.AndroidX.lifecycleCompiler) | ||
|
||
implementation(Deps.DI.daggerSupport) | ||
} | ||
|
||
tasks { | ||
val sourcesJar by creating(type = Jar::class) { | ||
from(android.sourceSets.getByName("main").java.srcDirs) | ||
classifier = "sources" | ||
} | ||
|
||
artifacts { | ||
add("archives", sourcesJar) | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.