diff --git a/app/.gitignore b/android-app/.gitignore similarity index 100% rename from app/.gitignore rename to android-app/.gitignore diff --git a/app/benchmark-rules.pro b/android-app/benchmark-rules.pro similarity index 100% rename from app/benchmark-rules.pro rename to android-app/benchmark-rules.pro diff --git a/app/build.gradle.kts b/android-app/build.gradle.kts similarity index 100% rename from app/build.gradle.kts rename to android-app/build.gradle.kts diff --git a/app/coroutines.pro b/android-app/coroutines.pro similarity index 100% rename from app/coroutines.pro rename to android-app/coroutines.pro diff --git a/app/okhttp3.pro b/android-app/okhttp3.pro similarity index 100% rename from app/okhttp3.pro rename to android-app/okhttp3.pro diff --git a/app/proguard-rules.pro b/android-app/proguard-rules.pro similarity index 100% rename from app/proguard-rules.pro rename to android-app/proguard-rules.pro diff --git a/app/retrofit2.pro b/android-app/retrofit2.pro similarity index 100% rename from app/retrofit2.pro rename to android-app/retrofit2.pro diff --git a/app/src/debug/google-services.json b/android-app/src/debug/google-services.json similarity index 100% rename from app/src/debug/google-services.json rename to android-app/src/debug/google-services.json diff --git a/app/src/gmsBenchmark/google-services.json b/android-app/src/gmsBenchmark/google-services.json similarity index 100% rename from app/src/gmsBenchmark/google-services.json rename to android-app/src/gmsBenchmark/google-services.json diff --git a/app/src/gmsDebug/google-services.json b/android-app/src/gmsDebug/google-services.json similarity index 100% rename from app/src/gmsDebug/google-services.json rename to android-app/src/gmsDebug/google-services.json diff --git a/app/src/gmsRelease/google-services.json b/android-app/src/gmsRelease/google-services.json similarity index 100% rename from app/src/gmsRelease/google-services.json rename to android-app/src/gmsRelease/google-services.json diff --git a/app/src/main/AndroidManifest.xml b/android-app/src/main/AndroidManifest.xml similarity index 100% rename from app/src/main/AndroidManifest.xml rename to android-app/src/main/AndroidManifest.xml diff --git a/app/src/main/kotlin/org/michaelbel/movies/App.kt b/android-app/src/main/kotlin/org/michaelbel/movies/App.kt similarity index 100% rename from app/src/main/kotlin/org/michaelbel/movies/App.kt rename to android-app/src/main/kotlin/org/michaelbel/movies/App.kt diff --git a/app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt b/android-app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt similarity index 100% rename from app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt rename to android-app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt diff --git a/app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt b/android-app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt similarity index 100% rename from app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt rename to android-app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt diff --git a/app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt b/android-app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt similarity index 100% rename from app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt rename to android-app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt diff --git a/app/src/main/res/values/strings.xml b/android-app/src/main/res/values/strings.xml similarity index 100% rename from app/src/main/res/values/strings.xml rename to android-app/src/main/res/values/strings.xml diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/android-app/src/main/res/xml/data_extraction_rules.xml similarity index 100% rename from app/src/main/res/xml/data_extraction_rules.xml rename to android-app/src/main/res/xml/data_extraction_rules.xml diff --git a/app/src/main/res/xml/locale_config.xml b/android-app/src/main/res/xml/locale_config.xml similarity index 100% rename from app/src/main/res/xml/locale_config.xml rename to android-app/src/main/res/xml/locale_config.xml diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 53e0a193e..148ea5707 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -33,7 +33,7 @@ android { targetCompatibility = JavaVersion.VERSION_17 } - targetProjectPath = ":app" + targetProjectPath = ":android-app" experimentalProperties["android.experimental.self-instrumenting"] = true } diff --git a/instant/build.gradle.kts b/instant/build.gradle.kts index a561c46bf..da10a3ced 100644 --- a/instant/build.gradle.kts +++ b/instant/build.gradle.kts @@ -39,7 +39,7 @@ android { } dependencies { - implementation(project(":app")) + implementation(project(":android-app")) implementation(project(":core:common")) implementation(project(":core:ui")) implementation(libs.androidx.activity.compose) diff --git a/settings.gradle.kts b/settings.gradle.kts index be868037f..014f209a8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,7 @@ pluginManagement { } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + /*repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)*/ repositories { mavenCentral() google() @@ -17,9 +17,10 @@ dependencyResolutionManagement { rootProject.name = "movies" include( - ":app", + ":android-app", ":instant", ":benchmark", + ":shared", ":core:analytics", ":core:common", diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts new file mode 100644 index 000000000..2e679889f --- /dev/null +++ b/shared/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + kotlin("multiplatform") + alias(libs.plugins.library) +} + +@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) +kotlin { + targetHierarchy.default() + + androidTarget { + compilations.all { + kotlinOptions { + jvmTarget = "1.8" + } + } + } + + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64() + ).forEach { + it.binaries.framework { + baseName = "shared" + } + } + + sourceSets { + val commonMain by getting { + dependencies { + //put your multiplatform dependencies here + } + } + val commonTest by getting { + dependencies { + //implementation(libs.kotlin.test) + } + } + } +} + +android { + namespace = "org.michaelbel.movies.shared" + + defaultConfig { + minSdk = libs.versions.min.sdk.get().toInt() + compileSdk = libs.versions.compile.sdk.get().toInt() + } +} \ No newline at end of file diff --git a/shared/src/androidMain/kotlin/org/michaelbel/movies/shared/Platform.android.kt b/shared/src/androidMain/kotlin/org/michaelbel/movies/shared/Platform.android.kt new file mode 100644 index 000000000..c48b9e150 --- /dev/null +++ b/shared/src/androidMain/kotlin/org/michaelbel/movies/shared/Platform.android.kt @@ -0,0 +1,9 @@ +package org.michaelbel.movies.shared + +import android.os.Build + +class AndroidPlatform: Platform { + override val name: String = "Android ${Build.VERSION.SDK_INT}" +} + +actual fun getPlatform(): Platform = AndroidPlatform() \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Greeting.kt b/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Greeting.kt new file mode 100644 index 000000000..c0b5468e0 --- /dev/null +++ b/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Greeting.kt @@ -0,0 +1,9 @@ +package org.michaelbel.movies.shared + +class Greeting { + private val platform: Platform = getPlatform() + + fun greet(): String { + return "Hello, ${platform.name}!" + } +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Platform.kt b/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Platform.kt new file mode 100644 index 000000000..0b40f10c5 --- /dev/null +++ b/shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Platform.kt @@ -0,0 +1,7 @@ +package org.michaelbel.movies.shared + +interface Platform { + val name: String +} + +expect fun getPlatform(): Platform \ No newline at end of file diff --git a/shared/src/iosMain/kotlin/org/michaelbel/movies/shared/Platform.ios.kt b/shared/src/iosMain/kotlin/org/michaelbel/movies/shared/Platform.ios.kt new file mode 100644 index 000000000..4955719c1 --- /dev/null +++ b/shared/src/iosMain/kotlin/org/michaelbel/movies/shared/Platform.ios.kt @@ -0,0 +1,9 @@ +package org.michaelbel.movies.shared + +import platform.UIKit.UIDevice + +class IOSPlatform: Platform { + override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion +} + +actual fun getPlatform(): Platform = IOSPlatform() \ No newline at end of file