-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
251 additions
and
6 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
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
59 changes: 59 additions & 0 deletions
59
build-logic/convention/src/main/kotlin/CMPFeatureConventionPlugin.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,59 @@ | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.mifos.libs | ||
|
||
/** | ||
* Created by Pronay Sarker on 30/12/2024 (6:04 PM) | ||
*/ | ||
class CMPFeatureConventionPlugin : Plugin<Project> { | ||
|
||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("mifos.kmp.libray") | ||
apply("mifos.kmp.koin") | ||
apply("org.jetbrains.kotlin.plugin.compose") | ||
apply("org.jetbrains.compose") | ||
} | ||
|
||
dependencies { | ||
add("commonMainImplementation", project(":core:ui")) | ||
add("commonMainImplementation", project(":core:designsystem")) | ||
add("commonMainImplementation", project(":core:testing")) | ||
add("commonMainImplementation", project(":core:data")) | ||
|
||
add("commonMainImplementation", libs.findLibrary("koin.compose").get()) | ||
add("commonMainImplementation", libs.findLibrary("koin.compose.viewmodel").get()) | ||
|
||
add("commonMainImplementation", libs.findLibrary("jb.composeRuntime").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.composeViewmodel").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.lifecycleViewmodel").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.lifecycleViewmodelSavedState").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.savedstate").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.bundle").get()) | ||
add("commonMainImplementation", libs.findLibrary("jb.composeNavigation").get()) | ||
add("commonMainImplementation", libs.findLibrary("kotlinx.collections.immutable").get()) | ||
|
||
add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) | ||
add("androidMainImplementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) | ||
add("androidMainImplementation", libs.findLibrary("androidx.tracing.ktx").get()) | ||
|
||
add("androidMainImplementation", platform(libs.findLibrary("koin-bom").get())) | ||
add("androidMainImplementation", libs.findLibrary("koin-android").get()) | ||
add("androidMainImplementation", libs.findLibrary("koin.androidx.compose").get()) | ||
|
||
add("androidMainImplementation", libs.findLibrary("koin.android").get()) | ||
add("androidMainImplementation", libs.findLibrary("koin.androidx.navigation").get()) | ||
add("androidMainImplementation", libs.findLibrary("koin.androidx.compose").get()) | ||
add("androidMainImplementation", libs.findLibrary("koin.core.viewmodel").get()) | ||
|
||
add("androidTestImplementation", libs.findLibrary("koin.test.junit4").get()) | ||
|
||
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.navigation.testing").get()) | ||
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.compose.ui.test").get()) | ||
add("androidInstrumentedTestImplementation", libs.findLibrary("androidx.lifecycle.runtimeTesting").get()) | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
build-logic/convention/src/main/kotlin/KMPCoinConventionLibrary.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,28 @@ | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.mifos.libs | ||
|
||
/** | ||
* Created by Pronay Sarker on 31/12/2024 (7:29 AM) | ||
*/ | ||
class KMPCoinConventionLibrary : Plugin<Project> { | ||
|
||
override fun apply(target: Project) { | ||
with(target){ | ||
with(pluginManager){ | ||
apply("com.google.devtools.ksp") | ||
} | ||
|
||
dependencies { | ||
val bom = libs.findLibrary("koin-bom").get() | ||
add("commonMainImplementation", platform(bom)) | ||
add("commonMainImplementation", libs.findLibrary("koin.core").get()) | ||
add("commonMainImplementation", libs.findLibrary("koin.annotations").get()) | ||
add("kspCommonMainMetadata", libs.findLibrary("koin.ksp.compiler").get()) | ||
add("commonTestImplementation", libs.findLibrary("koin.test").get()) | ||
} | ||
} | ||
} | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
build-logic/convention/src/main/kotlin/KMPKoinConventionPlugin.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,28 @@ | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.mifos.libs | ||
|
||
/** | ||
* Created by Pronay Sarker on 30/12/2024 (7:30 PM) | ||
*/ | ||
class KMPKoinConventionPlugin : Plugin<Project> { | ||
|
||
override fun apply(target: Project) { | ||
with(target){ | ||
with(pluginManager){ | ||
apply("com.google.devtools.ksp") | ||
} | ||
|
||
dependencies { | ||
val bom = libs.findLibrary("koin-bom").get() | ||
add("commonMainImplementation", platform(bom)) | ||
add("commonMainImplementation", libs.findLibrary("koin.core").get()) | ||
add("commonMainImplementation", libs.findLibrary("koin.annotations").get()) | ||
add("kspCommonMainMetadata", libs.findLibrary("koin.ksp.compiler").get()) | ||
add("commonTestImplementation", libs.findLibrary("koin.test").get()) | ||
} | ||
} | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
build-logic/convention/src/main/kotlin/KMPLibraryConventionPlugin.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,48 @@ | ||
import com.android.build.gradle.LibraryExtension | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.mifos.configureFlavors | ||
import org.mifos.configureKotlinAndroid | ||
import org.mifos.configureKotlinMultiplatform | ||
import org.mifos.libs | ||
/** | ||
* Created by Pronay Sarker on 30/12/2024 (7:33 PM) | ||
*/ | ||
class KMPLibraryConventionPlugin : Plugin<Project> { | ||
|
||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.android.library") | ||
apply("org.jetbrains.kotlin.multiplatform") | ||
apply("mifos.kmp.koin") | ||
apply("mifos.detekt.plugin") | ||
apply("mifos.spotless.plugin") | ||
} | ||
|
||
configureKotlinMultiplatform() | ||
|
||
extensions.configure<LibraryExtension> { | ||
configureKotlinAndroid(this) | ||
defaultConfig.targetSdk = 34 | ||
configureFlavors(this) | ||
/** | ||
* The resource prefix is derived from the module name, | ||
* so resources inside ":core:module1" must be prefixed with "core_module1_" | ||
*/ | ||
resourcePrefix = path | ||
.split("""\W""".toRegex()) | ||
.drop(1).distinct() | ||
.joinToString(separator = "_") | ||
.lowercase() + "_" | ||
} | ||
|
||
dependencies { | ||
add("commonTestImplementation", libs.findLibrary("kotlin.test").get()) | ||
add("commonTestImplementation", libs.findLibrary("kotlinx.coroutines.test").get()) | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
build-logic/convention/src/main/kotlin/org/mifos/configureKotlinMultiplatform.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,33 @@ | ||
package org.mifos | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi | ||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
||
|
||
@OptIn(ExperimentalWasmDsl::class, ExperimentalKotlinGradlePluginApi::class) | ||
internal fun Project.configureKotlinMultiplatform() { | ||
extensions.configure<KotlinMultiplatformExtension> { | ||
applyDefaultHierarchyTemplate() | ||
|
||
jvm("desktop") | ||
androidTarget() | ||
iosSimulatorArm64() | ||
iosX64() | ||
iosArm64() | ||
js(IR) { | ||
this.nodejs() | ||
binaries.executable() | ||
} | ||
wasmJs() { | ||
browser() | ||
nodejs() | ||
} | ||
|
||
compilerOptions { | ||
freeCompilerArgs.add("-Xexpect-actual-classes") | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// This file contains classes (with possible wildcards) that the Compose Compiler will treat as stable. | ||
// It allows us to define classes that our not part of our codebase without wrapping them in a stable class. | ||
// For more information, check https://developer.android.com/jetpack/compose/performance/stability/fix#configuration-file | ||
|
||
java.time.ZoneOffset |
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