Skip to content

KiCo json - #144

Draft
n1kPLV wants to merge 14 commits into
masterfrom
dam/json
Draft

KiCo json#144
n1kPLV wants to merge 14 commits into
masterfrom
dam/json

Conversation

@n1kPLV

@n1kPLV n1kPLV commented Jun 16, 2026

Copy link
Copy Markdown

Not ready for merge, only for CI

@n1kPLV
n1kPLV marked this pull request as draft June 22, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several confirmed runtime/behavior issues in the new JSON processors (null handling, EMF value serialization, and unsafe cardinality parsing) need to be fixed before the feature can be relied upon.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds new KiCool systems/processors to export simulation traces and SCCharts models as JSON (via Gson), and wires them into the respective system/processor providers; also slightly improves CLI error output context.

Changes:

  • Introduces a trace-to-JSON processor (TraceToJSON) plus supporting JSON DTOs and a KiCo system.
  • Introduces an SCCharts-to-JSON processor (SCTXToJSON) plus supporting JSON DTOs, KiCo systems, and adds Gson to the SCCharts bundle manifest.
  • Improves KiCo CLI error output by including the source model path in the “Error(s) in compilation …” line.
File summaries
File Description
plugins/de.cau.cs.kieler.simulation/system/de.cau.cs.kieler.ktrace.toJson.kico Adds a KiCo system entry for trace JSON generation.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/trace/ktrace/json/TraceToJSON.xtend New processor that transforms trace models into JSON via Gson.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/trace/ktrace/json/Trace.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/trace/ktrace/json/Tick.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/trace/ktrace/json/Assignment.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/providers/SimulationSystemProvider.xtend Registers the new trace-to-JSON KiCo system.
plugins/de.cau.cs.kieler.simulation/src/de/cau/cs/kieler/simulation/providers/SimulationProcessorProvider.xtend Registers the new trace-to-JSON processor.
plugins/de.cau.cs.kieler.sccharts/system/de.cau.cs.kieler.sccharts.SCTXToJSON.kico Adds a KiCo system entry for SCCharts JSON generation.
plugins/de.cau.cs.kieler.sccharts/system/de.cau.cs.kieler.sccharts.extended.toJSON.kico Adds a KiCo system that preprocesses then exports SCCharts JSON.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/providers/SCChartsSystemProvider.xtend Registers the new SCCharts JSON KiCo systems.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/providers/SCChartsProcessorProvider.xtend Registers the new SCCharts JSON processor.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/SCTXToJSON.xtend New processor that transforms SCCharts models into JSON via Gson.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/Action.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/Reference.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/Region.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/State.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/Transition.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/src/de/cau/cs/kieler/sccharts/processors/json/Variable.java New generated DTO for JSON output.
plugins/de.cau.cs.kieler.sccharts/META-INF/MANIFEST.MF Adds Gson dependency declarations for SCCharts bundle.
plugins/de.cau.cs.kieler.kicool/src/de/cau/cs/kieler/kicool/cli/KielerCompilerCLI.xtend Improves error header output with model context.
Review details
  • Files reviewed: 20/20 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +125 to +131
transformed.variableID = effect.reference?.valuedObject?.name + effect.reference?.indices?.map [
"[" + it.serialize + "]"
].join()
if (transformed.variableID === null) {
environment.errors.add(
"Assignment %s has no target variable.".format(effect.serialize, effect.class.name))
}
transformed.variableID = effect.reference?.valuedObject?.name
if (transformed.variableID === null) {
environment.errors.add(
"Assignment %s has no target variable.".format(effect.serialize, effect.class.name))
Comment on lines +176 to +179
JsonArrayValue:
assignee.elements
JsonObjectValue:
assignee.membersMap
val transformedRoots = this.sourceModel.traces.map[transformTrace];
val fileName = "trace"

println("Processing Resource " + this.sourceModel.eResource)
if (state.reference !== null) {
// TODO: if the target is in the same file as the referencing statement, this causes the target to be renamed
// in the renaming step. Not an issue, but weird.
scopeNames.add(state.reference.target.name.hostcodeSafeName)
transformed.initialValue = v.initialValue?.serialize?.toString
transformed.isInput = isInput
transformed.isOutput = isOutput
transformed.cardinalities = v.cardinalities?.map[serialize]?.map[Integer.parseInt(it.toString, 10)] ?: List.of()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants