mirror of
https://github.com/mrcsxsiq/Kotlin-Pokedex.git
synced 2025-05-17 13:25:52 +08:00
Implement Gradle Kotlin DSL
This commit is contained in:
3
.idea/codeStyles/Project.xml
generated
3
.idea/codeStyles/Project.xml
generated
@ -1,8 +1,5 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<AndroidXmlCodeStyleSettings>
|
|
||||||
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
|
|
||||||
</AndroidXmlCodeStyleSettings>
|
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
|
6
.idea/google-java-format.xml
generated
Normal file
6
.idea/google-java-format.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GoogleJavaFormatSettings">
|
||||||
|
<option name="enabled" value="false" />
|
||||||
|
</component>
|
||||||
|
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -64,6 +64,7 @@ Also available in Play Store
|
|||||||
- [x] [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel)
|
- [x] [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel)
|
||||||
- [x] [Room](https://developer.android.com/topic/libraries/architecture/room)
|
- [x] [Room](https://developer.android.com/topic/libraries/architecture/room)
|
||||||
- [ ] [Coroutines](https://developer.android.com/topic/libraries/architecture/coroutines)
|
- [ ] [Coroutines](https://developer.android.com/topic/libraries/architecture/coroutines)
|
||||||
|
- [x] [Gradle Kotlin DSL](https://docs.gradle.org/current/userguide/kotlin_dsl.html)
|
||||||
- [x] [Databinding](https://developer.android.com/topic/libraries/data-binding)
|
- [x] [Databinding](https://developer.android.com/topic/libraries/data-binding)
|
||||||
- [x] [Retrofit](https://square.github.io/retrofit/)
|
- [x] [Retrofit](https://square.github.io/retrofit/)
|
||||||
- [x] [Koin](https://insert-koin.io/)
|
- [x] [Koin](https://insert-koin.io/)
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
|
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
|
|
||||||
apply plugin: 'kotlin-kapt'
|
|
||||||
|
|
||||||
apply plugin: "androidx.navigation.safeargs"
|
|
||||||
|
|
||||||
apply from: "../ktlint.gradle"
|
|
||||||
|
|
||||||
android {
|
|
||||||
|
|
||||||
compileSdkVersion 29
|
|
||||||
buildToolsVersion "29.0.2"
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "dev.marcosfarias.pokedex"
|
|
||||||
minSdkVersion 23
|
|
||||||
targetSdkVersion 29
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = '1.8'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
|
|
||||||
// Architecture
|
|
||||||
implementation 'androidx.core:core-ktx:1.2.0'
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
||||||
implementation 'androidx.navigation:navigation-ui:2.2.1'
|
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
|
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.2.1'
|
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
|
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
|
||||||
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
|
|
||||||
|
|
||||||
// Material
|
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
|
||||||
|
|
||||||
// Third Party
|
|
||||||
implementation "com.leinardi.android:speed-dial:3.1.1"
|
|
||||||
|
|
||||||
// Retrofit
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
|
|
||||||
|
|
||||||
// Persistence
|
|
||||||
implementation "android.arch.persistence.room:runtime:1.1.1"
|
|
||||||
kapt "android.arch.persistence.room:compiler:1.1.1"
|
|
||||||
|
|
||||||
// Glide
|
|
||||||
kapt "android.arch.lifecycle:compiler:1.1.1"
|
|
||||||
kapt 'com.github.bumptech.glide:compiler:4.9.0'
|
|
||||||
implementation 'com.github.bumptech.glide:glide:4.9.0'
|
|
||||||
|
|
||||||
// Koin
|
|
||||||
implementation 'org.koin:koin-android:2.0.1'
|
|
||||||
implementation 'org.koin:koin-androidx-scope:2.0.1'
|
|
||||||
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'
|
|
||||||
|
|
||||||
// Test
|
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
|
||||||
}
|
|
75
app/build.gradle.kts
Normal file
75
app/build.gradle.kts
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
plugins {
|
||||||
|
id("com.android.application")
|
||||||
|
id("kotlin-android")
|
||||||
|
id("kotlin-android-extensions")
|
||||||
|
id("kotlin-kapt")
|
||||||
|
id("androidx.navigation.safeargs.kotlin")
|
||||||
|
}
|
||||||
|
apply(from = "../ktlint.gradle.kts")
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion(29)
|
||||||
|
buildToolsVersion("29.0.3")
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "dev.marcosfarias.pokedex"
|
||||||
|
minSdkVersion(23)
|
||||||
|
targetSdkVersion(29)
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0"
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
getByName("release") {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72")
|
||||||
|
|
||||||
|
// Architecture
|
||||||
|
implementation("androidx.core:core-ktx:1.2.0")
|
||||||
|
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||||
|
implementation("androidx.navigation:navigation-ui:2.2.2")
|
||||||
|
implementation("androidx.navigation:navigation-ui-ktx:2.2.2")
|
||||||
|
implementation("androidx.navigation:navigation-fragment:2.2.2")
|
||||||
|
implementation("androidx.navigation:navigation-fragment-ktx:2.2.2")
|
||||||
|
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
|
||||||
|
implementation("androidx.constraintlayout:constraintlayout:1.1.3")
|
||||||
|
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
|
||||||
|
|
||||||
|
// Material
|
||||||
|
implementation("com.google.android.material:material:1.1.0")
|
||||||
|
|
||||||
|
// Third Party
|
||||||
|
implementation("com.leinardi.android:speed-dial:3.1.1")
|
||||||
|
|
||||||
|
// Retrofit
|
||||||
|
implementation("com.squareup.retrofit2:retrofit:2.6.0")
|
||||||
|
implementation("com.squareup.retrofit2:converter-gson:2.6.0")
|
||||||
|
|
||||||
|
// Persistence
|
||||||
|
implementation("android.arch.persistence.room:runtime:1.1.1")
|
||||||
|
kapt("android.arch.persistence.room:compiler:1.1.1")
|
||||||
|
|
||||||
|
// Glide
|
||||||
|
kapt("android.arch.lifecycle:compiler:1.1.1")
|
||||||
|
kapt("com.github.bumptech.glide:compiler:4.10.0")
|
||||||
|
implementation("com.github.bumptech.glide:glide:4.10.0")
|
||||||
|
|
||||||
|
// Koin
|
||||||
|
implementation("org.koin:koin-android:2.0.1")
|
||||||
|
implementation("org.koin:koin-androidx-scope:2.0.1")
|
||||||
|
implementation("org.koin:koin-androidx-viewmodel:2.0.1")
|
||||||
|
|
||||||
|
// Test
|
||||||
|
testImplementation("junit:junit:4.12")
|
||||||
|
androidTestImplementation("androidx.test.ext:junit:1.1.1")
|
||||||
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
|
||||||
|
}
|
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@ -1,6 +1,6 @@
|
|||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# You can control the set of applied configuration files using the
|
||||||
# proguardFiles setting in build.gradle.
|
# proguardFiles setting in build.gradle.kts.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.61'
|
|
||||||
ext.nav_version = "2.1.0"
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
classpath("com.android.tools.build:gradle:3.6.3")
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
|
||||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
|
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.2.2")
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
@ -21,10 +19,11 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks {
|
||||||
delete rootProject.buildDir
|
val clean by registering(Delete::class) {
|
||||||
|
delete(buildDir)
|
||||||
|
}
|
||||||
}
|
}
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Wed Dec 25 17:10:43 AMT 2019
|
#Thu May 14 20:43:47 WIB 2020
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
// kotlin-gradle-plugin must be applied for configuration below to work
|
|
||||||
// (see https://kotlinlang.org/docs/reference/using-gradle.html)
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
ktlint
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
ktlint "com.pinterest:ktlint:0.36.0"
|
|
||||||
// additional 3rd party ruleset(s) can be specified here
|
|
||||||
// just add them to the classpath (e.g. ktlint 'groupId:artifactId:version') and
|
|
||||||
// ktlint will pick them up
|
|
||||||
}
|
|
||||||
|
|
||||||
task ktlint(type: JavaExec, group: "verification") {
|
|
||||||
description = "Check Kotlin code style."
|
|
||||||
classpath = configurations.ktlint
|
|
||||||
main = "com.pinterest.ktlint.Main"
|
|
||||||
args "src/**/*.kt"
|
|
||||||
// to generate report in checkstyle format prepend following args:
|
|
||||||
// "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
|
|
||||||
// see https://github.com/pinterest/ktlint#usage for more
|
|
||||||
}
|
|
||||||
|
|
||||||
check.dependsOn ktlint
|
|
||||||
|
|
||||||
task ktlintFormat(type: JavaExec, group: "formatting") {
|
|
||||||
description = "Fix Kotlin code style deviations."
|
|
||||||
classpath = configurations.ktlint
|
|
||||||
main = "com.pinterest.ktlint.Main"
|
|
||||||
args "-F", "src/**/*.kt"
|
|
||||||
}
|
|
28
ktlint.gradle.kts
Normal file
28
ktlint.gradle.kts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
val ktlint: Configuration by configurations.creating
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
ktlint("com.pinterest:ktlint:0.36.0")
|
||||||
|
// additional 3rd party ruleset(s) can be specified here
|
||||||
|
// just add them to the classpath (e.g. ktlint 'groupId:artifactId:version') and
|
||||||
|
// ktlint will pick them up
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<JavaExec>("ktlint") {
|
||||||
|
group = "verification"
|
||||||
|
description = "Check Kotlin code style."
|
||||||
|
classpath = ktlint
|
||||||
|
main = "com.pinterest.ktlint.Main"
|
||||||
|
args("src/**/*.kt")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("check") {
|
||||||
|
dependsOn(ktlint)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<JavaExec>("ktlintFormat") {
|
||||||
|
group = "formatting"
|
||||||
|
description = "Fix Kotlin code style deviations."
|
||||||
|
classpath = ktlint
|
||||||
|
main = "com.pinterest.ktlint.Main"
|
||||||
|
args("-F", "src/**/*.kt")
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
include ':app'
|
|
||||||
rootProject.name='Pokedex'
|
|
2
settings.gradle.kts
Normal file
2
settings.gradle.kts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
include(":app")
|
||||||
|
rootProject.name="Pokedex"
|
Reference in New Issue
Block a user