Vaibhav Jaiswal
12/28/2023, 11:14 AM:shared
| -> :data
| -> :network
| -> :local
| -> :domain
I have the plugin applied in every module
I want to get the current module name
i.e. for network it should be network
I tried the Project.name
but it gives me "shared"
all the timeVaibhav Jaiswal
12/28/2023, 11:15 AMinternal fun Project.configureKotlinCocoapods(
extension: CocoapodsExtension
) = extension.apply {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
framework {
isStatic = true
baseName = <mailto:this@configureKotlinCocoapods.name|this@configureKotlinCocoapods.name>
println("Module Name = " + <mailto:this@configureKotlinCocoapods.name|this@configureKotlinCocoapods.name>)
}
}
Javier
12/28/2023, 11:48 AMVaibhav Jaiswal
12/28/2023, 12:08 PMJavier
12/28/2023, 12:09 PMVaibhav Jaiswal
12/28/2023, 12:10 PMVaibhav Jaiswal
12/28/2023, 12:11 PMJavier
12/28/2023, 12:11 PMVaibhav Jaiswal
12/28/2023, 12:11 PMJavier
12/28/2023, 12:11 PMVaibhav Jaiswal
12/28/2023, 12:13 PM:shared
is printed 6 times, but i have around 15 modulesVaibhav Jaiswal
12/28/2023, 12:13 PMclass KotlinMultiplatformPlugin: Plugin<Project> {
override fun apply(target: Project):Unit = with(target){
with(pluginManager){
apply(libs.findPlugin("kotlinMultiplatform").get().get().pluginId)
apply(libs.findPlugin("kotlinCocoapods").get().get().pluginId)
apply(libs.findPlugin("androidLibrary").get().get().pluginId)
apply(libs.findPlugin("kotlin.serialization").get().get().pluginId)
}
extensions.configure<KotlinMultiplatformExtension>(::configureKotlinMultiplatform)
extensions.configure<LibraryExtension>(::configureKotlinAndroid)
}
}
internal fun Project.configureKotlinMultiplatform(
extension: KotlinMultiplatformExtension
) = extension.apply {
jvmToolchain(17)
androidTarget()
iosArm64()
iosX64()
iosSimulatorArm64()
applyDefaultHierarchyTemplate()
sourceSets.apply {
commonMain {
dependencies {
implementation(libs.findLibrary("koin.core").get())
implementation(libs.findLibrary("coroutines.core").get())
implementation(libs.findLibrary("kotlinx-dateTime").get())
implementation(libs.findLibrary("napier").get())
implementation(libs.findLibrary("kotlinx-serialization").get())
}
}
androidMain {
dependencies {
implementation(libs.findLibrary("koin.android").get() )
}
}
}
(this as ExtensionAware).extensions.configure<CocoapodsExtension>(::configureKotlinCocoapods)
}
Javier
12/28/2023, 12:13 PMVaibhav Jaiswal
12/28/2023, 12:14 PMJavier
12/28/2023, 12:14 PMVaibhav Jaiswal
12/28/2023, 12:15 PMJavier
12/28/2023, 12:15 PMVaibhav Jaiswal
12/28/2023, 12:15 PMJavier
12/28/2023, 12:15 PMVaibhav Jaiswal
12/28/2023, 12:17 PMJavier
12/28/2023, 12:17 PMVaibhav Jaiswal
12/28/2023, 12:17 PMVaibhav Jaiswal
12/28/2023, 12:18 PMJavier
12/28/2023, 12:18 PMJavier
12/28/2023, 12:18 PMVaibhav Jaiswal
12/28/2023, 12:19 PMthis
to get the nameJavier
12/28/2023, 12:19 PMVaibhav Jaiswal
12/28/2023, 12:20 PMVaibhav Jaiswal
12/28/2023, 12:21 PMVaibhav Jaiswal
12/28/2023, 12:21 PMVaibhav Jaiswal
12/28/2023, 12:22 PM> Configure project :shared:core
Module Name = core
Module Name = core
Module Name = core
Module Name = core
Module Name = core
Module Name = core
> Configure project :shared:data
Module Name = data
Module Name = data
Module Name = data
Module Name = data
Module Name = data
Module Name = data
using the original codeVaibhav Jaiswal
12/28/2023, 12:23 PMJavier
12/28/2023, 12:29 PMVaibhav Jaiswal
12/28/2023, 12:29 PMVampire
12/28/2023, 12:44 PMframework
is called once for every pod framework. So if you have 6 of them, you get 6 times the output.Vaibhav Jaiswal
12/28/2023, 12:46 PMVaibhav Jaiswal
12/28/2023, 12:46 PMexport(project(":shared:core"))
in my shared module build.gradle