Skip to content

Commit

Permalink
feat: #98 add link to report issues with debugger to GH
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Nov 5, 2024
1 parent 57a737b commit a3f7018
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/runConfigurations/Plugin___run_ide.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/runConfigurations/Plugin___sign__for_release_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/runConfigurations/Plugin___verify.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ fun Config.version(isRelease: Boolean) = buildString {
append(versionName)
if (!isRelease) append("-SNAPSHOT")
}

fun Project.namespaceByPath() = "${Config.namespace}.${path.replace(":", ".").removePrefix(".")}"
33 changes: 33 additions & 0 deletions debugger/server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
id(libs.plugins.kotlinMultiplatform.id)
alias(libs.plugins.compose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.serialization)
}

val parentNamespace = namespaceByPath()

// must be earlier than other config or build tasks
val generateBuildConfig by tasks.registering(Sync::class) {
from(
resources.text.fromString(
"""
package $parentNamespace
object BuildFlags {
const val VersionCode = ${Config.versionCode}
const val VersionName = "${Config.versionName}"
const val SupportEmail = "${Config.supportEmail}"
const val ProjectUrl = "${Config.url}"
}
""".trimIndent()
)
) {
rename { "BuildFlags.kt" }
into(parentNamespace.replace(".", "/"))
}
// the target directory
into(layout.buildDirectory.dir("generated/kotlin/src/commonMain"))
}

compose.resources {
publicResClass = true
}
Expand All @@ -14,15 +42,20 @@ tasks {
sourceCompatibility = Config.jvmTarget.target
targetCompatibility = Config.jvmTarget.target
}

}
kotlin {
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget = Config.jvmTarget
}
}

sourceSets {
commonMain {
kotlin.srcDir(generateBuildConfig.map { it.destinationDir })
}
commonMain.dependencies {
implementation(projects.core)
implementation(projects.compose)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package pro.respawn.flowmvi.debugger.server.arch.configuration

data object BuildFlags {
val debuggable = System.getenv("DEBUG")?.toBooleanStrictOrNull() ?: false
}
import pro.respawn.flowmvi.debugger.server.BuildFlags

val BuildFlags.debuggable by lazy { System.getenv("DEBUG")?.toBooleanStrictOrNull() ?: false }
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import pro.respawn.flowmvi.api.ActionShareBehavior
import pro.respawn.flowmvi.api.MVIAction
import pro.respawn.flowmvi.api.MVIIntent
import pro.respawn.flowmvi.api.MVIState
import pro.respawn.flowmvi.debugger.server.BuildFlags
import pro.respawn.flowmvi.dsl.StoreBuilder
import pro.respawn.flowmvi.plugins.enableLogging
import pro.respawn.flowmvi.savedstate.api.NullRecover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.withLink
import androidx.compose.ui.unit.sp
import pro.respawn.flowmvi.debugger.server.BuildFlags
import pro.respawn.kmmutils.compose.annotate

@Composable
fun RErrorView(
Expand All @@ -20,8 +26,15 @@ fun RErrorView(
) {
Text("An error has occurred", fontSize = 32.sp)
SelectionContainer {
Text("Message: ${e.message}")
Text("stack trace: ${e.stackTraceToString()}")
// TODO: Report to github link
Column {
Text("Message: ${e.message}")
Text("stack trace: ${e.stackTraceToString()}", fontFamily = FontFamily.Monospace)
Text(
textDecoration = TextDecoration.Underline,
text = "Please report this to Github".annotate {
withLink(LinkAnnotation.Url(BuildFlags.ProjectUrl)) { append(it) }
}
)
}
}
}

0 comments on commit a3f7018

Please sign in to comment.