diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts deleted file mode 100644 index 112476319..000000000 --- a/androidApp/build.gradle.kts +++ /dev/null @@ -1,151 +0,0 @@ -import java.time.format.DateTimeFormatter -import java.time.ZoneOffset -import java.time.Instant - -plugins { - id("com.android.application") - id("kotlin-android") - id("com.google.gms.google-services") - id("com.google.firebase.crashlytics") - alias(libs.plugins.compose.compiler) -} - -@Suppress("UnstableApiUsage") -android { - namespace = "br.alexandregpereira.hunter.app" - compileSdk = findProperty("compileSdk")?.toString()?.toInt() - - packaging { - jniLibs { - excludes += "META-INF/licenses/**" - } - resources { - excludes += "**/attach_hotspot_windows.dll" - excludes += "META-INF/licenses/**" - excludes += "META-INF/AL2.0" - excludes += "META-INF/LGPL2.1" - excludes += "META-INF/LICENSE**" - } - } - - val isDebug = project.gradle.startParameter.taskNames.any { it.contains("Debug") } - defaultConfig { - applicationId = "br.alexandregpereira.hunter.app" - minSdk = findProperty("minSdk")?.toString()?.toInt() - targetSdk = findProperty("targetSdk")?.toString()?.toInt() - applicationIdSuffix = when { - hasProperty("dev") -> { - ".dev" - } - else -> "" - } - - val localDateTime = Instant.now().atOffset(ZoneOffset.UTC).toLocalDateTime() - val baseTimestampInSeconds = 1467504000L // Base value for the timestamp of 2013-07-03 00:00:00 - val currentTimestampInSeconds = localDateTime.toEpochSecond(ZoneOffset.UTC) - val timestampDiff = currentTimestampInSeconds - baseTimestampInSeconds - if (timestampDiff <= 0) { - throw RuntimeException("Adjust your machine datetime! timestampDiff") - } - val versionCodePerSeconds = 60 * 20 // Seconds to increment the version code - versionCode = (timestampDiff / versionCodePerSeconds).toInt().also { versionCode -> - val dateFormat = localDateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd.")) - versionName = dateFormat + (versionCode - 186000) - } - - versionNameSuffix = when { - hasProperty("dev") -> { - "-dev" - } - isDebug -> { - "-debug" - } - else -> "" - } - if (hasProperty("dev")) { - setProperty("archivesBaseName", "app-dev") - } - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - signingConfigs { - create("release") { - storeFile = file("monster-keystore.jks") - storePassword = System.getenv("MONSTER_COMPENDIUM_KEYSTORE_PASSWORD") - keyAlias = "monster" - keyPassword = System.getenv("MONSTER_COMPENDIUM_KEYSTORE_PASSWORD") - } - } - - buildTypes { - getByName("release") { - signingConfig = signingConfigs.getByName("release") - isMinifyEnabled = true - isShrinkResources = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - } - } - - buildFeatures { - compose = true - buildConfig = true - } -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} - -composeCompiler { - enableStrongSkippingMode = true -} - -dependencies { - implementation(project(":core:analytics")) - implementation(project(":core:event")) - implementation(project(":core:localization")) - implementation(project(":domain:app:data")) - implementation(project(":domain:app:core")) - implementation(project(":feature:folder-detail:event")) - implementation(project(":feature:folder-list:event")) - implementation(project(":feature:folder-preview:event")) - implementation(project(":feature:monster-content-manager:event")) - implementation(project(":feature:monster-detail:event")) - implementation(project(":feature:folder-detail:android")) - implementation(project(":feature:folder-insert:android")) - implementation(project(":feature:folder-list:android")) - implementation(project(":feature:folder-preview:android")) - implementation(project(":feature:monster-compendium:android")) - implementation(project(":feature:monster-content-manager:android")) - implementation(project(":feature:monster-detail:android")) - implementation(project(":feature:monster-lore-detail:android")) - implementation(project(":feature:monster-registration:android")) - implementation(project(":feature:sync:android")) - implementation(project(":feature:search:android")) - implementation(project(":feature:settings:android")) - implementation(project(":feature:spell-compendium:android")) - implementation(project(":feature:spell-detail:android")) - implementation(project(":ui:core")) - - implementation(platform(libs.firebase.bom)) - implementation(libs.firebase.analytics) - implementation(libs.firebase.crashlytics) - - implementation(libs.bundles.viewmodel.bundle) - implementation(libs.bundles.compose) - - implementation(libs.core.ktx) - implementation(libs.appcompat) - implementation(libs.material) - - implementation(libs.koin.android) - implementation(libs.koin.compose) - testImplementation(libs.bundles.unittest) - testImplementation(libs.koin.test) - androidTestImplementation(libs.bundles.instrumentedtest) - androidTestImplementation(libs.compose.ui.test) - debugImplementation(libs.compose.ui.test.manifest) -} diff --git a/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/KoinTest.kt b/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/KoinTest.kt deleted file mode 100644 index 5add72cf6..000000000 --- a/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/KoinTest.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2023 Alexandre Gomes Pereira - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.alexandregpereira.hunter.app - -import android.content.Context -import android.content.SharedPreferences -import androidx.lifecycle.SavedStateHandle -import br.alexandregpereira.hunter.analytics.Analytics -import br.alexandregpereira.hunter.app.HunterApplication.Companion.initKoinModules -import com.google.firebase.FirebaseApp -import com.google.firebase.analytics.FirebaseAnalytics -import com.google.firebase.analytics.ktx.analytics -import com.google.firebase.crashlytics.FirebaseCrashlytics -import com.google.firebase.crashlytics.ktx.crashlytics -import com.google.firebase.ktx.Firebase -import com.google.firebase.ktx.app -import io.mockk.every -import io.mockk.mockk -import kotlinx.coroutines.ExperimentalCoroutinesApi -import org.junit.Rule -import org.junit.Test -import org.koin.dsl.koinApplication -import org.koin.test.check.checkModules - -@OptIn(ExperimentalCoroutinesApi::class) -class KoinTest { - - private val context = mockk() - private val sharedPreferences = mockk() - private val savedStateHandle = mockk() - private val analytics = mockk() - private val crashlytics = mockk() - - @get:Rule - val testCoroutineRule = TestCoroutineRule() - - @Test - fun verifyKoinApp() { - every { context.getSharedPreferences(any(), any()) } returns sharedPreferences - every { context.applicationContext } returns context - every { savedStateHandle.get(any()) } returns null - koinApplication { - initKoinModules() - checkModules { - withInstance(context) - withInstance(sharedPreferences) - withInstance(savedStateHandle) - withInstance(analytics) - withInstance(crashlytics) - } - } - } -} diff --git a/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/TestCoroutineRule.kt b/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/TestCoroutineRule.kt deleted file mode 100644 index 36e1c8668..000000000 --- a/androidApp/src/test/kotlin/br/alexandregpereira/hunter/app/TestCoroutineRule.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Alexandre Gomes Pereira - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.alexandregpereira.hunter.app - -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.resetMain -import kotlinx.coroutines.test.setMain -import org.junit.rules.TestRule -import org.junit.runner.Description -import org.junit.runners.model.Statement - -@ExperimentalCoroutinesApi -class TestCoroutineRule : TestRule { - - val testCoroutineDispatcher = StandardTestDispatcher() - - override fun apply(base: Statement, description: Description): Statement = object : Statement() { - @Throws(Throwable::class) - override fun evaluate() { - Dispatchers.setMain(testCoroutineDispatcher) - - base.evaluate() - - Dispatchers.resetMain() - } - } -} diff --git a/androidApp/.gitignore b/app/.gitignore similarity index 100% rename from androidApp/.gitignore rename to app/.gitignore diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 000000000..5390458a3 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,207 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree +import java.time.Instant +import java.time.ZoneOffset +import java.time.format.DateTimeFormatter + +/* + * Copyright 2023 Alexandre Gomes Pereira + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("com.android.application") + kotlin("multiplatform") + id("com.google.gms.google-services") + id("com.google.firebase.crashlytics") + alias(libs.plugins.compose) + alias(libs.plugins.compose.compiler) +} + +multiplatform { + androidMain { + implementation(project(":core:event")) + implementation(project(":feature:folder-detail:event")) + implementation(project(":feature:folder-list:event")) + implementation(project(":feature:monster-content-manager:event")) + implementation(project(":feature:monster-detail:event")) + implementation(project(":feature:folder-detail:android")) + implementation(project(":feature:folder-insert:android")) + implementation(project(":feature:folder-list:android")) + implementation(project(":feature:folder-preview:android")) + implementation(project(":feature:monster-compendium:android")) + implementation(project(":feature:monster-content-manager:android")) + implementation(project(":feature:monster-detail:android")) + implementation(project(":feature:monster-lore-detail:android")) + implementation(project(":feature:monster-registration:android")) + implementation(project(":feature:sync:android")) + implementation(project(":feature:search:android")) + implementation(project(":feature:settings:android")) + implementation(project(":feature:spell-compendium:android")) + implementation(project(":feature:spell-detail:android")) + implementation(project(":ui:core")) + + implementation(libs.core.ktx) + implementation(libs.appcompat) + implementation(libs.material) + + implementation(libs.koin.android) + implementation(libs.koin.compose) + + implementation(libs.bundles.viewmodel.bundle) + + implementation(compose.preview) + implementation(libs.compose.activity) + + implementation(project.dependencies.platform(libs.firebase.bom)) + implementation(libs.firebase.analytics) + implementation(libs.firebase.crashlytics) + } + + commonMain { + implementation(project(":core:analytics")) + implementation(project(":core:localization")) + implementation(project(":domain:app:data")) + implementation(project(":domain:app:core")) + implementation(project(":domain:sync:core")) + implementation(project(":feature:folder-insert:event")) // TODO Remove later + implementation(project(":feature:folder-preview:event")) // TODO Remove later + implementation(project(":feature:monster-lore-detail:event")) // TODO Remove later + implementation(project(":feature:monster-registration:event")) // TODO Remove later + implementation(project(":feature:spell-detail:event")) // TODO Remove later + implementation(project(":feature:monster-compendium:state-holder")) + implementation(project(":feature:monster-detail:state-holder")) + implementation(project(":feature:sync:state-holder")) + implementation(libs.kotlin.coroutines.core) + implementation(libs.koin.core) + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.ui) + implementation(compose.components.resources) + implementation(compose.components.uiToolingPreview) + } + + jvmMain() + iosMain(iosFramework = { linkerOpts("-l", "sqlite3") }) + + jvmTest { + implementation(libs.bundles.unittest) + implementation(libs.koin.test) + } +} + +kotlin { + androidTarget { + @OptIn(ExperimentalKotlinGradlePluginApi::class) + instrumentedTestVariant { + sourceSetTree.set(KotlinSourceSetTree.test) + + dependencies { + implementation(libs.bundles.instrumentedtest) + implementation(libs.compose.ui.test) + debugImplementation(libs.compose.ui.test.manifest) + } + } + } +} + +android { + namespace = "br.alexandregpereira.hunter.app" + compileSdk = findProperty("compileSdk")?.toString()?.toInt() + + packaging { + jniLibs { + excludes += "META-INF/licenses/**" + } + resources { + excludes += "**/attach_hotspot_windows.dll" + excludes += "META-INF/licenses/**" + excludes += "META-INF/AL2.0" + excludes += "META-INF/LGPL2.1" + excludes += "META-INF/LICENSE**" + } + } + + val isDebug = project.gradle.startParameter.taskNames.any { it.contains("Debug") } + defaultConfig { + applicationId = "br.alexandregpereira.hunter.app" + minSdk = findProperty("minSdk")?.toString()?.toInt() + targetSdk = findProperty("targetSdk")?.toString()?.toInt() + applicationIdSuffix = when { + hasProperty("dev") -> { + ".dev" + } + else -> "" + } + + val localDateTime = Instant.now().atOffset(ZoneOffset.UTC).toLocalDateTime() + val baseTimestampInSeconds = 1467504000L // Base value for the timestamp of 2013-07-03 00:00:00 + val currentTimestampInSeconds = localDateTime.toEpochSecond(ZoneOffset.UTC) + val timestampDiff = currentTimestampInSeconds - baseTimestampInSeconds + if (timestampDiff <= 0) { + throw RuntimeException("Adjust your machine datetime! timestampDiff") + } + val versionCodePerSeconds = 60 * 20 // Seconds to increment the version code + versionCode = (timestampDiff / versionCodePerSeconds).toInt().also { versionCode -> + val dateFormat = localDateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd.")) + versionName = dateFormat + (versionCode - 186000) + } + + versionNameSuffix = when { + hasProperty("dev") -> { + "-dev" + } + isDebug -> { + "-debug" + } + else -> "" + } + if (hasProperty("dev")) { + setProperty("archivesBaseName", "app-dev") + } + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + signingConfigs { + create("release") { + storeFile = file("monster-keystore.jks") + storePassword = System.getenv("MONSTER_COMPENDIUM_KEYSTORE_PASSWORD") + keyAlias = "monster" + keyPassword = System.getenv("MONSTER_COMPENDIUM_KEYSTORE_PASSWORD") + } + } + + buildTypes { + getByName("release") { + signingConfig = signingConfigs.getByName("release") + isMinifyEnabled = true + isShrinkResources = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + buildFeatures { + compose = true + buildConfig = true + } + dependencies { + debugImplementation(compose.uiTooling) + } +} + +composeCompiler { + enableStrongSkippingMode = true +} diff --git a/androidApp/google-services.json b/app/google-services.json similarity index 100% rename from androidApp/google-services.json rename to app/google-services.json diff --git a/androidApp/monster-keystore.jks b/app/monster-keystore.jks similarity index 100% rename from androidApp/monster-keystore.jks rename to app/monster-keystore.jks diff --git a/androidApp/proguard-rules.pro b/app/proguard-rules.pro similarity index 100% rename from androidApp/proguard-rules.pro rename to app/proguard-rules.pro diff --git a/androidApp/src/androidTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt b/app/src/androidInstrumentedTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt similarity index 91% rename from androidApp/src/androidTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt rename to app/src/androidInstrumentedTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt index 96970999c..ececf464d 100644 --- a/androidApp/src/androidTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt +++ b/app/src/androidInstrumentedTest/kotlin/br/alexandregpereira/hunter/app/folder/FolderListTest.kt @@ -6,11 +6,9 @@ import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.longClick import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText -import androidx.compose.ui.test.onRoot import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performTextInput import androidx.compose.ui.test.performTouchInput -import androidx.compose.ui.test.printToLog import androidx.test.espresso.Espresso import br.alexandregpereira.hunter.app.MainScreen import org.junit.Rule @@ -38,10 +36,14 @@ class FolderListTest { composeTestRule.onNodeWithText("Add to Folder").performClick() composeTestRule.onNodeWithText("Folder name").performTextInput("Folder Test") composeTestRule.onNodeWithText("Save").performClick() + Espresso.closeSoftKeyboard() Espresso.pressBack() + composeTestRule.waitUntil(timeoutMillis = 5000) { + composeTestRule.onNodeWithText("Folders").isDisplayed() + } composeTestRule.onNodeWithText("Folders").performClick() composeTestRule.onNodeWithText("Folder Test").performTouchInput { longClick() } composeTestRule.onNodeWithText("Delete").performClick() composeTestRule.onNodeWithText("Folder Test").assertIsNotDisplayed() } -} \ No newline at end of file +} diff --git a/androidApp/src/main/AndroidManifest.xml b/app/src/androidMain/AndroidManifest.xml similarity index 100% rename from androidApp/src/main/AndroidManifest.xml rename to app/src/androidMain/AndroidManifest.xml diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/HunterApplication.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/HunterApplication.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/HunterApplication.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/HunterApplication.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainActivity.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainActivity.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainActivity.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainActivity.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainScreen.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainScreen.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainScreen.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainScreen.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainStrings.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainStrings.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainStrings.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainStrings.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewEvent.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewEvent.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewEvent.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewEvent.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewModel.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewModel.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewModel.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewModel.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewState.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewState.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/MainViewState.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/MainViewState.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/AppBottomNavigation.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/AppBottomNavigation.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/AppBottomNavigation.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/AppBottomNavigation.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/BottomNavigationTransition.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/BottomNavigationTransition.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/BottomNavigationTransition.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/BottomNavigationTransition.kt diff --git a/androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/MainScreen.kt b/app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/MainScreen.kt similarity index 100% rename from androidApp/src/main/kotlin/br/alexandregpereira/hunter/app/ui/MainScreen.kt rename to app/src/androidMain/kotlin/br/alexandregpereira/hunter/app/ui/MainScreen.kt diff --git a/androidApp/src/main/res/anim/enter_animation.xml b/app/src/androidMain/res/anim/enter_animation.xml similarity index 100% rename from androidApp/src/main/res/anim/enter_animation.xml rename to app/src/androidMain/res/anim/enter_animation.xml diff --git a/androidApp/src/main/res/anim/exit_animation.xml b/app/src/androidMain/res/anim/exit_animation.xml similarity index 100% rename from androidApp/src/main/res/anim/exit_animation.xml rename to app/src/androidMain/res/anim/exit_animation.xml diff --git a/androidApp/src/main/res/drawable/ic_book.xml b/app/src/androidMain/res/drawable/ic_book.xml similarity index 100% rename from androidApp/src/main/res/drawable/ic_book.xml rename to app/src/androidMain/res/drawable/ic_book.xml diff --git a/androidApp/src/main/res/drawable/ic_folder.xml b/app/src/androidMain/res/drawable/ic_folder.xml similarity index 100% rename from androidApp/src/main/res/drawable/ic_folder.xml rename to app/src/androidMain/res/drawable/ic_folder.xml diff --git a/androidApp/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/androidMain/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from androidApp/src/main/res/drawable/ic_launcher_foreground.xml rename to app/src/androidMain/res/drawable/ic_launcher_foreground.xml diff --git a/androidApp/src/main/res/drawable/ic_menu.xml b/app/src/androidMain/res/drawable/ic_menu.xml similarity index 100% rename from androidApp/src/main/res/drawable/ic_menu.xml rename to app/src/androidMain/res/drawable/ic_menu.xml diff --git a/androidApp/src/main/res/drawable/ic_search.xml b/app/src/androidMain/res/drawable/ic_search.xml similarity index 100% rename from androidApp/src/main/res/drawable/ic_search.xml rename to app/src/androidMain/res/drawable/ic_search.xml diff --git a/androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to app/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/androidMain/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from androidApp/src/main/res/mipmap-hdpi/ic_launcher.png rename to app/src/androidMain/res/mipmap-hdpi/ic_launcher.png diff --git a/androidApp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from androidApp/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to app/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png diff --git a/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/androidMain/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from androidApp/src/main/res/mipmap-mdpi/ic_launcher.png rename to app/src/androidMain/res/mipmap-mdpi/ic_launcher.png diff --git a/androidApp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from androidApp/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to app/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png diff --git a/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/androidMain/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png rename to app/src/androidMain/res/mipmap-xhdpi/ic_launcher.png diff --git a/androidApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from androidApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to app/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png diff --git a/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to app/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/androidApp/src/main/res/values-night/themes.xml b/app/src/androidMain/res/values-night/themes.xml similarity index 100% rename from androidApp/src/main/res/values-night/themes.xml rename to app/src/androidMain/res/values-night/themes.xml diff --git a/androidApp/src/main/res/values-pt-rBR/strings.xml b/app/src/androidMain/res/values-pt-rBR/strings.xml similarity index 100% rename from androidApp/src/main/res/values-pt-rBR/strings.xml rename to app/src/androidMain/res/values-pt-rBR/strings.xml diff --git a/androidApp/src/main/res/values-v27/themes.xml b/app/src/androidMain/res/values-v27/themes.xml similarity index 100% rename from androidApp/src/main/res/values-v27/themes.xml rename to app/src/androidMain/res/values-v27/themes.xml diff --git a/androidApp/src/main/res/values/animation.xml b/app/src/androidMain/res/values/animation.xml similarity index 100% rename from androidApp/src/main/res/values/animation.xml rename to app/src/androidMain/res/values/animation.xml diff --git a/androidApp/src/main/res/values/colors.xml b/app/src/androidMain/res/values/colors.xml similarity index 100% rename from androidApp/src/main/res/values/colors.xml rename to app/src/androidMain/res/values/colors.xml diff --git a/androidApp/src/main/res/values/ic_launcher_background.xml b/app/src/androidMain/res/values/ic_launcher_background.xml similarity index 100% rename from androidApp/src/main/res/values/ic_launcher_background.xml rename to app/src/androidMain/res/values/ic_launcher_background.xml diff --git a/androidApp/src/main/res/values/strings.xml b/app/src/androidMain/res/values/strings.xml similarity index 100% rename from androidApp/src/main/res/values/strings.xml rename to app/src/androidMain/res/values/strings.xml diff --git a/androidApp/src/main/res/values/styles.xml b/app/src/androidMain/res/values/styles.xml similarity index 100% rename from androidApp/src/main/res/values/styles.xml rename to app/src/androidMain/res/values/styles.xml diff --git a/androidApp/src/main/res/values/themes.xml b/app/src/androidMain/res/values/themes.xml similarity index 100% rename from androidApp/src/main/res/values/themes.xml rename to app/src/androidMain/res/values/themes.xml diff --git a/shared/src/commonMain/kotlin/br/alexandregpereira/hunter/shared/di/AppModule.kt b/app/src/commonMain/kotlin/br/alexandregpereira/hunter/shared/di/AppModule.kt similarity index 100% rename from shared/src/commonMain/kotlin/br/alexandregpereira/hunter/shared/di/AppModule.kt rename to app/src/commonMain/kotlin/br/alexandregpereira/hunter/shared/di/AppModule.kt diff --git a/shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/IosAppModule.kt b/app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/IosAppModule.kt similarity index 100% rename from shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/IosAppModule.kt rename to app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/IosAppModule.kt diff --git a/shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterCompendiumFeature.kt b/app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterCompendiumFeature.kt similarity index 100% rename from shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterCompendiumFeature.kt rename to app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterCompendiumFeature.kt diff --git a/shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterDetailFeature.kt b/app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterDetailFeature.kt similarity index 100% rename from shared/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterDetailFeature.kt rename to app/src/iosMain/kotlin/br/alexandregpereira/hunter/shared/MonsterDetailFeature.kt diff --git a/shared/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/KoinTest.kt b/app/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/KoinTest.kt similarity index 100% rename from shared/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/KoinTest.kt rename to app/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/KoinTest.kt diff --git a/shared/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/TestCoroutineRule.kt b/app/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/TestCoroutineRule.kt similarity index 100% rename from shared/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/TestCoroutineRule.kt rename to app/src/jvmTest/kotlin/br/alexandregpereira/hunter/shared/di/TestCoroutineRule.kt diff --git a/build.gradle.kts b/build.gradle.kts index 06dac4f47..df5c4e9d7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,5 +18,6 @@ buildscript { plugins { alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.compose) apply false alias(libs.plugins.compose.compiler) apply false } diff --git a/buildSrc/src/main/kotlin/TargetConfig.kt b/buildSrc/src/main/kotlin/TargetConfig.kt index 5c3db74c5..7b852ef90 100644 --- a/buildSrc/src/main/kotlin/TargetConfig.kt +++ b/buildSrc/src/main/kotlin/TargetConfig.kt @@ -71,7 +71,7 @@ fun KotlinMultiplatformExtension.jvmMain(block: KotlinDependencyHandler.() -> Un fun KotlinMultiplatformExtension.jvmTest(block: KotlinDependencyHandler.() -> Unit = {}) { sourceSets.apply { - jvmMain.dependencies(block) + jvmTest.dependencies(block) } } diff --git a/gradle.properties b/gradle.properties index 376fed1f9..bbdeaa342 100644 --- a/gradle.properties +++ b/gradle.properties @@ -40,3 +40,4 @@ android.nonTransitiveRClass=true android.nonFinalResIds=true org.gradle.configuration-cache=true kotlin.native.ignoreDisabledTargets=true +compose.kotlin.native.manageCacheKind=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d61778d3d..48a5fcdac 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,7 @@ arch_core_testing = "2.2.0" coil_compose = "2.5.0" compose_activity = '1.9.0' compose = '1.6.8' +compose_plugin = '1.6.11' compose_material = '1.6.8' core_ktx = '1.13.1' espresso_core = "3.6.1" @@ -85,6 +86,7 @@ unittest = ["kotlin-coroutines-test", "core-testing", "mockk", "junit", "kotlin- viewmodel-bundle = ["viewmodel"] [plugins] +compose = { id = "org.jetbrains.compose", version.ref = "compose_plugin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } sqldelight = { id = "com.squareup.sqldelight", version.ref = "sqldelight" } -compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/iosApp/MonsterCompendium.xcodeproj/project.pbxproj b/iosApp/MonsterCompendium.xcodeproj/project.pbxproj index cf8ea8b95..ef3463f68 100644 --- a/iosApp/MonsterCompendium.xcodeproj/project.pbxproj +++ b/iosApp/MonsterCompendium.xcodeproj/project.pbxproj @@ -382,7 +382,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n"; + shellScript = "cd \"$SRCROOT/..\"\n./gradlew :app:embedAndSignAppleFrameworkForXcode\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/settings.gradle b/settings.gradle index d0749bb9d..2d2fffc26 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ dependencyResolutionManagement { } } rootProject.name = 'hunter' -include ':androidApp' +include ':app' include ':core:analytics' include ':core:event' @@ -72,7 +72,6 @@ include ':feature:sync:android' include ':feature:sync:event' include ':feature:sync:state-holder' -include ':shared' include ':ui:compendium' include ':ui:core' include ':ui:monster-compendium' diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts deleted file mode 100644 index d70de0538..000000000 --- a/shared/build.gradle.kts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2023 Alexandre Gomes Pereira - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - kotlin("multiplatform") -} - -multiplatform { - commonMain { - implementation(project(":core:analytics")) - implementation(project(":core:localization")) - implementation(project(":domain:app:data")) - implementation(project(":domain:app:core")) - implementation(project(":domain:sync:core")) - implementation(project(":feature:folder-insert:event")) // TODO Remove later - implementation(project(":feature:folder-preview:event")) // TODO Remove later - implementation(project(":feature:monster-lore-detail:event")) // TODO Remove later - implementation(project(":feature:monster-registration:event")) // TODO Remove later - implementation(project(":feature:spell-detail:event")) // TODO Remove later - implementation(project(":feature:monster-compendium:state-holder")) - implementation(project(":feature:monster-detail:state-holder")) - implementation(project(":feature:sync:state-holder")) - implementation(libs.kotlin.coroutines.core) - implementation(libs.koin.core) - } - - jvmMain() - iosMain(iosFramework = { linkerOpts("-l", "sqlite3") }) - - jvmTest { - implementation(libs.bundles.unittest) - implementation(libs.koin.test) - } -}