From 08e0e5bb737a8d095aaadd31d3097a1a8a0074a9 Mon Sep 17 00:00:00 2001 From: kasem-sm Date: Fri, 3 Feb 2023 22:41:09 +0530 Subject: [PATCH] updated ksp to 1.8.10 --- build.gradle | 4 ++-- buildSrc/src/main/kotlin/LibraryConfigs.kt | 4 ++-- easystore-processor/build.gradle.kts | 4 ++-- .../kasem/sm/easystore/processor/StoreVisitor.kt | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- sample/build.gradle | 14 +++++++------- .../java/kasem/sm/easystore/sample/MainActivity.kt | 12 ++++++++++++ 7 files changed, 29 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index f15b882..cdc66e7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { id 'com.android.application' version '7.2.2' apply false id 'com.android.library' version '7.2.2' apply false - id 'org.jetbrains.kotlin.android' version '1.7.10' apply false - id 'org.jetbrains.kotlin.jvm' version '1.7.10' apply false + id 'org.jetbrains.kotlin.android' version '1.8.10' apply false + id 'org.jetbrains.kotlin.jvm' version '1.8.10' apply false id 'io.github.gradle-nexus.publish-plugin' version "1.1.0" apply true id 'com.diffplug.spotless' version "6.9.0" apply false id 'org.jetbrains.dokka' version "1.7.10" apply false diff --git a/buildSrc/src/main/kotlin/LibraryConfigs.kt b/buildSrc/src/main/kotlin/LibraryConfigs.kt index 11e0163..bdd5c55 100644 --- a/buildSrc/src/main/kotlin/LibraryConfigs.kt +++ b/buildSrc/src/main/kotlin/LibraryConfigs.kt @@ -1,5 +1,5 @@ object LibraryConfigs { const val groupId = "com.kasem-sm.easystore" - const val version = "0.0.3-alpha" - const val snapshotVersion = "0.0.3-SNAPSHOT" + const val version = "0.0.4-alpha" + const val snapshotVersion = "0.0.4-SNAPSHOT" } diff --git a/easystore-processor/build.gradle.kts b/easystore-processor/build.gradle.kts index b2b030b..a78a9d4 100644 --- a/easystore-processor/build.gradle.kts +++ b/easystore-processor/build.gradle.kts @@ -1,6 +1,6 @@ plugins { kotlin("jvm") - id("com.google.devtools.ksp") version "1.7.10-1.0.6" + id("com.google.devtools.ksp") version "1.8.10-1.0.9" } sourceSets.main { @@ -15,7 +15,7 @@ dependencies { implementation(project(":easystore-core")) implementation("androidx.datastore:datastore-preferences-core:1.0.0") - implementation("com.google.devtools.ksp:symbol-processing-api:1.7.10-1.0.6") + implementation("com.google.devtools.ksp:symbol-processing-api:1.8.10-1.0.9") implementation("com.squareup:kotlinpoet:1.12.0") implementation("com.squareup:kotlinpoet-ksp:1.12.0") diff --git a/easystore-processor/src/main/java/kasem/sm/easystore/processor/StoreVisitor.kt b/easystore-processor/src/main/java/kasem/sm/easystore/processor/StoreVisitor.kt index 02b33f8..3ee2edb 100644 --- a/easystore-processor/src/main/java/kasem/sm/easystore/processor/StoreVisitor.kt +++ b/easystore-processor/src/main/java/kasem/sm/easystore/processor/StoreVisitor.kt @@ -156,7 +156,7 @@ class StoreVisitor( // Retrieve if (functionReturnType == null || functionReturnType.toClassName().simpleName != "Flow") { logger.error( - "Functions annotated with @Retrieve should return Flow. " + + "Functions annotated with @Retrieve should return Flow. " + "($functionName)" ) return @@ -168,7 +168,7 @@ class StoreVisitor( if (innerType.toClassName().simpleName != parameter.toClassName().simpleName ) { - logger.error("The return type for the function $functionName should be Flow<${parameter.toClassName().simpleName}> as the parameter type is ${parameter.toClassName().simpleName}.") + logger.error("The return type for the function $functionName should be Flow<${parameter.toClassName().simpleName}> as the parameter type is ${parameter.toClassName().simpleName} or update the function's parameter type to ${innerType.toClassName().simpleName}") return } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 77449b9..6763d63 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Aug 16 09:26:39 IST 2022 +#Mon Nov 21 21:40:17 IST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/sample/build.gradle b/sample/build.gradle index a2bae5e..a5567e3 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,16 +1,16 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' - id 'com.google.devtools.ksp' version "1.7.10-1.0.6" + id 'com.google.devtools.ksp' version "1.8.10-1.0.9" } android { - compileSdk 32 + compileSdk 33 defaultConfig { applicationId "kasem.sm.easystore.sample" minSdk 21 - targetSdk 32 + targetSdk 33 versionCode 1 versionName "1.0" @@ -36,14 +36,14 @@ android { } dependencies { - implementation 'androidx.core:core-ktx:1.8.0' - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.appcompat:appcompat:1.6.0' + implementation 'com.google.android.material:material:1.8.0' implementation "androidx.datastore:datastore-preferences:1.0.0" implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation "androidx.activity:activity-ktx:1.5.1" + implementation "androidx.activity:activity-ktx:1.6.1" implementation(project(":easystore-core")) ksp(project(":easystore-processor")) diff --git a/sample/src/main/java/kasem/sm/easystore/sample/MainActivity.kt b/sample/src/main/java/kasem/sm/easystore/sample/MainActivity.kt index bf17de4..6716b48 100644 --- a/sample/src/main/java/kasem/sm/easystore/sample/MainActivity.kt +++ b/sample/src/main/java/kasem/sm/easystore/sample/MainActivity.kt @@ -31,12 +31,24 @@ interface AppPreferences { // Automatic Enum mapping (Also supports Data Class) @Retrieve(preferenceKeyName = "app_theme") fun getAppTheme(default: Theme): Flow + + @Store(preferenceKeyName = "user") + suspend fun updateUser(user: User) + + @Retrieve(preferenceKeyName = "user") + fun getCurrentUser(default: User): Flow } enum class Theme { DARK, LIGHT, SYSTEM } +data class User( + val id: Int, + val username: String, + val loginTime: Long +) + // Single Instance of DataStore private val Context.dataStore: DataStore by preferencesDataStore(name = "my_prefs")