-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup network module #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package di | ||
|
||
import org.koin.dsl.module | ||
|
||
val appModule = module {} | ||
val appModule = listOf( | ||
networkModule | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
alias(libs.plugins.kotlinMultiplatform) | ||
alias(libs.plugins.androidLibrary) | ||
alias(libs.plugins.detekt) | ||
alias(libs.plugins.ksp) | ||
alias(libs.plugins.ktorfit) | ||
} | ||
Comment on lines
+4
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification The
Analysis chainEnsure that all plugins, especially Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the application of plugins in the network module.
# Test: Search for plugin configurations in the network module. Expect: Correct plugin settings.
rg --type kotlin "plugins" core/network/build.gradle.kts
Length of output: 240 Script: #!/bin/bash
# Description: Verify the necessity of ksp and ktorfit plugins in the network module.
# Test: Search for usage of ksp in the network module. Expect: References to ksp.
rg --type kotlin "ksp" core/network/
# Test: Search for usage of ktorfit in the network module. Expect: References to ktorfit.
rg --type kotlin "ktorfit" core/network/
Length of output: 354 |
||
|
||
kotlin { | ||
androidTarget { | ||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_11) | ||
} | ||
} | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { iosTarget -> | ||
iosTarget.binaries.framework { | ||
isStatic = true | ||
} | ||
} | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
implementation(libs.koin.core) | ||
implementation(libs.koin.compose) | ||
|
||
implementation(libs.ktor.core) | ||
implementation(libs.ktor.logging) | ||
implementation(libs.ktor.serialization) | ||
implementation(libs.ktor.negotiation) | ||
api(libs.ktorfit) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
detektPlugins(libs.detekt.formatting) | ||
} | ||
|
||
android { | ||
namespace = "io.heroesofcode.network" | ||
compileSdk = libs.versions.android.compileSdk.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.android.minSdk.get().toInt() | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package di | ||
|
||
import de.jensklingenberg.ktorfit.Ktorfit | ||
import io.ktor.client.HttpClient | ||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | ||
import io.ktor.client.plugins.logging.LogLevel | ||
import io.ktor.client.plugins.logging.Logging | ||
import io.ktor.serialization.kotlinx.json.json | ||
import kotlinx.serialization.ExperimentalSerializationApi | ||
import kotlinx.serialization.json.Json | ||
import org.koin.dsl.module | ||
|
||
const val BASE_URL = "https://example.com" | ||
|
||
@OptIn(ExperimentalSerializationApi::class) | ||
val networkModule = module { | ||
single { | ||
HttpClient { | ||
install(Logging) { | ||
level = LogLevel.ALL | ||
} | ||
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification The search results confirm that there are no environment-based configurations for logging levels in the codebase. The logging level is set to
Analysis chainConsider adjusting the logging level or making it configurable based on the environment. Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify if there are environment-based configurations for logging levels.
# Test: Search for environment checks around logging configurations. Expect: Conditional logic based on environment.
rg --type kotlin "LogLevel" core/network/src/commonMain/kotlin/di/networkModule.kt
Length of output: 166 Script: #!/bin/bash
# Description: Verify if there are environment-based configurations for logging levels across the entire codebase.
# Test: Search for environment checks around logging configurations. Expect: Conditional logic based on environment.
rg --type kotlin "LogLevel"
Length of output: 221 |
||
|
||
install(ContentNegotiation) { | ||
json( | ||
Json { | ||
explicitNulls = false | ||
ignoreUnknownKeys = true | ||
isLenient = true | ||
prettyPrint = true | ||
encodeDefaults = true | ||
classDiscriminator = "#class" | ||
} | ||
) | ||
} | ||
Comment on lines
+23
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review the necessity of Json settings such as |
||
} | ||
} | ||
|
||
single { | ||
val httpClient: HttpClient = get() | ||
|
||
Ktorfit.Builder() | ||
.httpClient(httpClient) | ||
.baseUrl(BASE_URL) | ||
.build() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The search results indicate that the
ksp
plugin is included in multiplebuild.gradle.kts
files, but there is no evidence of its usage in the Kotlin source files. This suggests that theksp
plugin might not be necessary for the Compose app.build.gradle.kts
:alias(libs.plugins.ksp) apply false
core/network/build.gradle.kts
:alias(libs.plugins.ksp)
composeApp/build.gradle.kts
:alias(libs.plugins.ksp)
Given this information, it appears that the
ksp
plugin is not actively used in the codebase.Analysis chain
Verify the necessity of the
ksp
plugin in the Compose app. Ensure it is used effectively.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 78
Script:
Length of output: 386
Script:
Length of output: 193