Skip to content

Commit fa173ca

Browse files
committed
Fix writeBuildInfoJson task dependencies
1 parent a879e64 commit fa173ca

5 files changed

Lines changed: 27 additions & 14 deletions

File tree

EOCV-Sim/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,8 @@ tasks.register('writeBuildInfoJson') {
201201
tasks.named('processResources') {
202202
dependsOn writeBuildInfoJson
203203
}
204+
205+
tasks.named('sourcesJar') {
206+
dependsOn writeBuildInfoJson
207+
}
208+

EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ class EOCVSim : KoinComponent {
313313
orchestrator.changePhase(Orchestrator.Phase.RUN)
314314

315315
while (!eocvSimThread.isInterrupted && !destroying) {
316+
throw Exception("test")
317+
316318
//run all pending requested runnables
317319
onMainLoop.run()
318320

EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/Main.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package com.github.serivesmejia.eocvsim
77

88
import com.github.serivesmejia.eocvsim.pipeline.PipelineSource
9+
import com.github.serivesmejia.eocvsim.util.exception.handling.EOCVSimUncaughtExceptionHandler
910
import org.koin.core.context.GlobalContext
1011
import org.koin.dsl.module
1112
import picocli.CommandLine
@@ -31,7 +32,12 @@ object Main {
3132

3233
val result = CommandLine(
3334
EOCVSimCommandInterface()
34-
).setCaseInsensitiveEnumValuesAllowed(true).execute(*args)
35+
).setCaseInsensitiveEnumValuesAllowed(true)
36+
.setExecutionExceptionHandler { exception, line, result ->
37+
EOCVSimUncaughtExceptionHandler.uncaughtException(currentMainThread, exception)
38+
-1
39+
}
40+
.execute(*args)
3541

3642
exitProcess(result)
3743
}

EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/Visualizer.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import javax.swing.*
5959
class Visualizer : PhaseOrchestrableBase(), KoinComponent {
6060

6161
val onMainUpdate: EventHandler by inject(named("onMainLoop"))
62+
val onCrash: EventHandler by inject(named("onCrash"))
6263

6364
val lifecycleChannel: Channel<LifecycleSignal> by inject(named("lifecycle"))
6465

EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/util/exception/handling/EOCVSimUncaughtExceptionHandler.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*
2-
* Copyright (c) 2026 Sebastian Erives
3-
* Licensed under the MIT License.
4-
*/
5-
1+
/*
2+
* Copyright (c) 2026 Sebastian Erives
3+
* Licensed under the MIT License.
4+
*/
5+
66
package com.github.serivesmejia.eocvsim.util.exception.handling
77

88
import com.github.serivesmejia.eocvsim.currentMainThread
@@ -21,14 +21,13 @@ import java.lang.Thread.sleep
2121
import javax.swing.SwingUtilities
2222
import kotlin.system.exitProcess
2323

24-
class EOCVSimUncaughtExceptionHandler private constructor() : Thread.UncaughtExceptionHandler, KoinComponent{
24+
object EOCVSimUncaughtExceptionHandler : Thread.UncaughtExceptionHandler, KoinComponent {
2525

26-
companion object {
27-
const val MAX_UNCAUGHT_EXCEPTIONS_BEFORE_CRASH = 3
26+
const val MAX_UNCAUGHT_EXCEPTIONS_BEFORE_CRASH = 3
2827

29-
@JvmStatic fun register() {
30-
Thread.setDefaultUncaughtExceptionHandler(EOCVSimUncaughtExceptionHandler())
31-
}
28+
@JvmStatic
29+
fun register() {
30+
Thread.setDefaultUncaughtExceptionHandler(this)
3231
}
3332

3433
val logger by loggerForThis()
@@ -40,7 +39,7 @@ class EOCVSimUncaughtExceptionHandler private constructor() : Thread.UncaughtExc
4039

4140
override fun uncaughtException(t: Thread, e: Throwable) {
4241
//we don't want the whole app to crash on a simple interrupted exception right?
43-
if(e is InterruptedException) {
42+
if (e is InterruptedException) {
4443
logger.warn("Uncaught InterruptedException thrown in Thread ${t.name}, it will be interrupted", e)
4544
t.interrupt()
4645
return
@@ -52,7 +51,7 @@ class EOCVSimUncaughtExceptionHandler private constructor() : Thread.UncaughtExc
5251

5352
// Exit if uncaught exception happened in the main thread
5453
// since we would be basically in an invalid state if that happened
55-
if(t == currentMainThread || SwingUtilities.isEventDispatchThread() || e !is Exception || uncaughtExceptionsCount > MAX_UNCAUGHT_EXCEPTIONS_BEFORE_CRASH) {
54+
if (t == currentMainThread || SwingUtilities.isEventDispatchThread() || e !is Exception || uncaughtExceptionsCount > MAX_UNCAUGHT_EXCEPTIONS_BEFORE_CRASH) {
5655
val file = CrashReport(e).saveCrashReport()
5756

5857
logger.warn("If this error persists, open an issue on EOCV-Sim's GitHub attaching the crash report file.")

0 commit comments

Comments
 (0)