-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added empty shared multiplatform module with gradle catalogue
- Loading branch information
1 parent
e6d18ea
commit dd4d676
Showing
11 changed files
with
111 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
shared/build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
pluginManagement { | ||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
google { | ||
mavenContent { | ||
includeGroupByRegex(".*google.*") | ||
includeGroupByRegex(".*android.*") | ||
} | ||
} | ||
mavenLocal() | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
dependencyResolutionManagement { | ||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
repositories { | ||
google() | ||
mavenCentral() | ||
|
||
pluginManagement { | ||
repositories { | ||
google { | ||
mavenContent { | ||
includeGroupByRegex(".*google.*") | ||
includeGroupByRegex(".*android.*") | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "Spotify-KMP" | ||
include(":app") | ||
include(":shared") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed | ||
plugins { | ||
alias(libs.plugins.kotlin.multiplatform) | ||
alias(libs.plugins.com.android.library) | ||
} | ||
|
||
kotlin { | ||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = libs.versions.jvmTargetVersion.get() | ||
} | ||
} | ||
} | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "shared" | ||
isStatic = true | ||
} | ||
} | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
//put your multiplatform dependencies here | ||
} | ||
commonTest.dependencies { | ||
implementation(libs.kotlin.test) | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.spotify.app.shared" | ||
compileSdk = libs.versions.compileSdkVersion.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.minSdkVersion.get().toInt() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
shared/src/androidMain/kotlin/com/spotify/app/shared/Platform.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.spotify.app.shared | ||
|
||
class AndroidPlatform : Platform { | ||
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() |
9 changes: 9 additions & 0 deletions
9
shared/src/commonMain/kotlin/com/spotify/app/shared/Greeting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.spotify.app.shared | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
shared/src/commonMain/kotlin/com/spotify/app/shared/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.spotify.app.shared | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
9 changes: 9 additions & 0 deletions
9
shared/src/iosMain/kotlin/com/spotify/app/shared/Platform.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.spotify.app.shared | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() |