From a51e076ba1cfe06031dc81f3ff5d57ea6d404d40 Mon Sep 17 00:00:00 2001 From: Dominik Dias Date: Tue, 27 Aug 2024 23:11:05 +0200 Subject: [PATCH] make project compile again and update dependencies --- build.gradle.kts | 1 + .../database/ExampleInstrumentedTest.kt | 24 ------------------- .../database/data/DurationEntry.kt | 2 ++ .../factory/DurationRepositoryProvider.kt | 2 ++ .../interfaces/IDurationRepository.kt | 2 ++ .../database/viewmodel/DatabaseViewModel.kt | 3 +++ .../dominikdias/database/ExampleUnitTest.kt | 17 ------------- gradle/libs.versions.toml | 22 ++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- mobile/build.gradle.kts | 3 +-- mobile/src/main/AndroidManifest.xml | 1 - mobile/src/main/res/values/themes.xml | 5 ---- wear/build.gradle.kts | 2 +- 13 files changed, 23 insertions(+), 63 deletions(-) delete mode 100644 database/src/androidTest/kotlin/de/dominikdias/database/ExampleInstrumentedTest.kt delete mode 100644 database/src/test/kotlin/de/dominikdias/database/ExampleUnitTest.kt delete mode 100644 mobile/src/main/res/values/themes.xml diff --git a/build.gradle.kts b/build.gradle.kts index 9e4ae6c..abbb00c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,4 +3,5 @@ plugins { alias(libs.plugins.androidApplication) apply false alias(libs.plugins.jetbrainsKotlinAndroid) apply false alias(libs.plugins.androidLibrary) apply false + alias(libs.plugins.compose.compiler) apply false } \ No newline at end of file diff --git a/database/src/androidTest/kotlin/de/dominikdias/database/ExampleInstrumentedTest.kt b/database/src/androidTest/kotlin/de/dominikdias/database/ExampleInstrumentedTest.kt deleted file mode 100644 index 51a0d44..0000000 --- a/database/src/androidTest/kotlin/de/dominikdias/database/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package de.dominikdias.database - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("de.dominikdias.database.test", appContext.packageName) - } -} \ No newline at end of file diff --git a/database/src/main/kotlin/de/dominikdias/database/data/DurationEntry.kt b/database/src/main/kotlin/de/dominikdias/database/data/DurationEntry.kt index a7f73a9..3786c4d 100644 --- a/database/src/main/kotlin/de/dominikdias/database/data/DurationEntry.kt +++ b/database/src/main/kotlin/de/dominikdias/database/data/DurationEntry.kt @@ -1,9 +1,11 @@ package de.dominikdias.database.data +import androidx.annotation.Keep import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey +@Keep data class Duration(val duration: Long) diff --git a/database/src/main/kotlin/de/dominikdias/database/factory/DurationRepositoryProvider.kt b/database/src/main/kotlin/de/dominikdias/database/factory/DurationRepositoryProvider.kt index 4bfda63..6578c83 100644 --- a/database/src/main/kotlin/de/dominikdias/database/factory/DurationRepositoryProvider.kt +++ b/database/src/main/kotlin/de/dominikdias/database/factory/DurationRepositoryProvider.kt @@ -1,10 +1,12 @@ package de.dominikdias.database.factory import android.content.Context +import androidx.annotation.Keep import de.dominikdias.database.DurationDatabase import de.dominikdias.database.interfaces.IDurationRepository import de.dominikdias.database.repository.DurationRepositoryImpl +@Keep object DurationRepositoryProvider { fun provideDatabaseRepository(context: Context): IDurationRepository { return DurationRepositoryImpl(DurationDatabase.getDatabase(context = context).durationDao()) diff --git a/database/src/main/kotlin/de/dominikdias/database/interfaces/IDurationRepository.kt b/database/src/main/kotlin/de/dominikdias/database/interfaces/IDurationRepository.kt index bc872c8..f02214e 100644 --- a/database/src/main/kotlin/de/dominikdias/database/interfaces/IDurationRepository.kt +++ b/database/src/main/kotlin/de/dominikdias/database/interfaces/IDurationRepository.kt @@ -1,8 +1,10 @@ package de.dominikdias.database.interfaces +import androidx.annotation.Keep import de.dominikdias.database.data.Duration import kotlinx.coroutines.flow.Flow +@Keep interface IDurationRepository { suspend fun insertDuration(duration: Duration) suspend fun getAllDurations(): Flow> diff --git a/database/src/main/kotlin/de/dominikdias/database/viewmodel/DatabaseViewModel.kt b/database/src/main/kotlin/de/dominikdias/database/viewmodel/DatabaseViewModel.kt index f846454..1ab8f1d 100644 --- a/database/src/main/kotlin/de/dominikdias/database/viewmodel/DatabaseViewModel.kt +++ b/database/src/main/kotlin/de/dominikdias/database/viewmodel/DatabaseViewModel.kt @@ -1,5 +1,6 @@ package de.dominikdias.database.viewmodel +import androidx.annotation.Keep import androidx.compose.runtime.Stable import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider @@ -13,6 +14,7 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch +@Keep class DatabaseViewModel(private val durationRepository: IDurationRepository): ViewModel() { private var _durationList = MutableStateFlow>(emptyList()) @@ -34,6 +36,7 @@ class DatabaseViewModel(private val durationRepository: IDurationRepository): Vi } } + @Keep companion object { fun factory(durationRepository: IDurationRepository): ViewModelProvider.Factory = viewModelFactory { initializer { diff --git a/database/src/test/kotlin/de/dominikdias/database/ExampleUnitTest.kt b/database/src/test/kotlin/de/dominikdias/database/ExampleUnitTest.kt deleted file mode 100644 index 7262897..0000000 --- a/database/src/test/kotlin/de/dominikdias/database/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package de.dominikdias.database - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ee9f79c..efe69c7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,28 +1,27 @@ [versions] activityCompose = "1.9.1" -agp = "8.5.1" +agp = "8.5.2" androidx-room = "2.6.1" -composeBom = "2024.06.00" -composeCompiler = "1.5.14" +composeBom = "2024.08.00" composeFoundation = "1.3.1" composeMaterial = "1.3.1" constraintlayout = "2.1.4" coreKtx = "1.13.1" coreSplashscreen = "1.0.1" -espressoCore = "3.5.1" -google-ksp = "2.0.0-1.0.24" +espressoCore = "3.6.1" +google-ksp = "2.0.20-1.0.24" horologistComposeTools = "0.6.9" horologistTiles = "0.6.11" junit = "4.13.2" -junitVersion = "1.1.5" -kotlin = "2.0.0" +junitVersion = "1.2.1" +kotlin = "2.0.20" kotlinxCollectionsImmutable = "0.3.7" lifecycleViewmodelCompose = "2.8.4" material3 = "1.2.1" navigation-compose = "2.7.7" -playServicesWearable = "18.1.0" -tiles = "1.3.0" -tilesMaterial = "1.3.0" +playServicesWearable = "18.2.0" +tiles = "1.4.0" +tilesMaterial = "1.4.0" watchfaceComplicationsDataSourceKtx = "1.2.1" wear-tooling-preview = "1.0.0" java-jdk = "17" @@ -33,7 +32,6 @@ androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", versi androidx-compose-foundation = { group = "androidx.wear.compose", name = "compose-foundation", version.ref = "composeFoundation" } androidx-compose-material = { group = "androidx.wear.compose", name = "compose-material", version.ref = "composeMaterial" } androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } -androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "composeCompiler" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "coreSplashscreen" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } @@ -64,4 +62,4 @@ androidApplication = { id = "com.android.application", version.ref = "agp" } androidLibrary = { id = "com.android.library", version.ref = "agp" } com-google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "google-ksp" } jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } - +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09523c0..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/mobile/build.gradle.kts b/mobile/build.gradle.kts index 61267c1..be357aa 100644 --- a/mobile/build.gradle.kts +++ b/mobile/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.androidApplication) alias(libs.plugins.jetbrainsKotlinAndroid) + alias(libs.plugins.compose.compiler) } android { @@ -19,8 +20,6 @@ android { buildFeatures.compose = true - composeOptions.kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - kotlin.jvmToolchain(libs.versions.java.jdk.get().toInt()) buildTypes { diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index eb3ee05..d718422 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -13,7 +13,6 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.GymRestTimer" tools:targetApi="31"> - - -