From 6d4fde83843bd24898e790242499391fb1e48729 Mon Sep 17 00:00:00 2001 From: Yusuf Saifudin Date: Mon, 8 Jan 2024 17:15:26 +0700 Subject: [PATCH 1/8] :tractor: migrate kotlin dsl --- .idea/.name | 1 + .idea/deploymentTargetDropDown.xml | 10 ++++ .idea/detekt.xml | 7 +++ .idea/gradle.xml | 5 +- .idea/migrations.xml | 10 ++++ .idea/misc.xml | 3 +- .idea/vcs.xml | 2 +- app/build.gradle | 69 ----------------------- app/build.gradle.kts | 71 ++++++++++++++++++++++++ build.gradle | 27 --------- build.gradle.kts | 4 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 1 - settings.gradle.kts | 16 ++++++ 14 files changed, 125 insertions(+), 103 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 .idea/detekt.xml create mode 100644 .idea/migrations.xml delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..4f05563 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Android Room Example \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/detekt.xml b/.idea/detekt.xml new file mode 100644 index 0000000..ee7289c --- /dev/null +++ b/.idea/detekt.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 7b46144..0897082 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,16 +4,15 @@ diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 64c8368..d17c411 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index c924f5b..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -android { - - namespace "com.yoesuv.androidroom" - compileSdkVersion 33 - - defaultConfig { - applicationId "com.yoesuv.androidroom" - minSdkVersion 21 - targetSdkVersion 33 - versionCode 6 - versionName "2.1.5" - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - setProperty("archivesBaseName", applicationId+"-v"+versionCode+"("+versionName+")") - vectorDrawables.useSupportLibrary = true - } - buildTypes { - debug { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - buildFeatures { - dataBinding = true - buildConfig = true - } - flavorDimensions "default" - productFlavors { - forTest { - resValue "string", "app_name", "Android Room TEST" - applicationIdSuffix ".test" - } - production { - resValue "string", "app_name", "Android Room" - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = "17" - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1' - - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifeCycleVersion" - implementation "androidx.room:room-runtime:$roomVersion" - kapt "androidx.room:room-compiler:$roomVersion" - implementation "androidx.room:room-ktx:$roomVersion" -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..92ebef0 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,71 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("kotlin-kapt") +} + +android { + namespace = "com.yoesuv.androidroom" + compileSdk = 34 + + defaultConfig { + applicationId = "com.yoesuv.androidroom" + minSdk = 24 + targetSdk = 34 + versionCode = 1 + versionName = "2.1.6" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + setProperty("archivesBaseName", "$applicationId-v$versionCode($versionName)") + vectorDrawables.useSupportLibrary = true + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + buildFeatures { + dataBinding = true + buildConfig = true + } + + flavorDimensions.add("default") + productFlavors { + create("forTest") { + resValue("string", "app_name", "Android Room TEST") + applicationIdSuffix = ".test" + dimension = "default" + } + create("production") { + resValue("string", "app_name", "Android Room") + dimension = "default" + } + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.12.0") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("com.google.android.material:material:1.9.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation("androidx.test.espresso:espresso-contrib:3.5.1") + + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") + implementation("androidx.room:room-runtime:2.5.1") + kapt("androidx.room:room-compiler:2.5.1") + implementation("androidx.room:room-ktx:2.5.1") +} \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 119646d..0000000 --- a/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext.kotlin_version = '1.8.21' - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..c3d0929 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + id("com.android.application") version "8.2.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.21" apply false +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 11fac3d..8e10d93 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..ca1cfe2 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "Android Room Example" +include(":app") From b0cb284f6d55ab18758e883e2b9a7cff7d5780f0 Mon Sep 17 00:00:00 2001 From: Yusuf Saifudin Date: Fri, 19 Jan 2024 05:47:44 +0700 Subject: [PATCH 2/8] :tractor: activate ksp --- .idea/misc.xml | 1 - app/build.gradle.kts | 12 ++++++++---- build.gradle.kts | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d17c411..5848b03 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -