Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions concore_cli/commands/_process_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"concoredocker.hpp",
"concore.java",
"concoredocker.java",
"concore.jl",
"concoredocker.jl",
"concore.v",
"concoredocker.v",
"concore_read.m",
Expand Down
4 changes: 4 additions & 0 deletions concore_cli/commands/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def _inspect_rich(workflow_path, source_dir, console):
lang_counts["C++"] += 1
elif ext == ".v":
lang_counts["Verilog"] += 1
elif ext == ".jl":
lang_counts["Julia"] += 1
else:
lang_counts["Other"] += 1

Expand Down Expand Up @@ -132,6 +134,7 @@ def _inspect_rich(workflow_path, source_dir, console):
".cpp": "C++",
".hpp": "C++",
".v": "Verilog",
".jl": "Julia",
}
lang = lang_map.get(ext, "Other")

Expand Down Expand Up @@ -217,6 +220,7 @@ def _inspect_json(workflow_path, source_dir):
".cpp": "cpp",
".hpp": "cpp",
".v": "verilog",
".jl": "julia",
}
lang = lang_map.get(ext, "other")
lang_counts[lang] += 1
Expand Down
2 changes: 1 addition & 1 deletion concore_cli/commands/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def finalize():
errors.append(f"Node '{label}' has no filename")
elif not any(
filename.endswith(ext)
for ext in [".py", ".cpp", ".m", ".v", ".java"]
for ext in [".py", ".cpp", ".m", ".v", ".java", ".jl"]
):
warnings.append(
f"Node '{label}' has unusual file extension"
Expand Down
2 changes: 1 addition & 1 deletion concore_cli/commands/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _read_edge_files(edge_path):


def _detect_source(node_path):
for ext in ("*.py", "*.m", "*.cpp", "*.v", "*.sh", "*.java"):
for ext in ("*.py", "*.m", "*.cpp", "*.v", "*.sh", "*.java", "*.jl"):
matches = list(node_path.glob(ext))
for m in matches:
# skip concore library copies
Expand Down
39 changes: 39 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ def test_watch_skips_runtime_files_when_detecting_source(self):
cases = {
"pidM.m": ["import_concore.m", "concore_read.m"],
"Plant.java": ["ConcoreJavaRuntimeCore.java", "concoredocker.java"],
"ctrl.jl": ["concore.jl", "concoredocker.jl"],
}
for source, runtime_files in cases.items():
with self.subTest(source=source):
Expand All @@ -1038,6 +1039,44 @@ def test_watch_skips_runtime_files_when_detecting_source(self):
(node / name).write_text("")
self.assertEqual(_detect_source(node), source)

def test_validate_and_inspect_julia_node(self):
graphml = """<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:y="http://www.yworks.com/xml/graphml">
<key for="node" id="d0" yfiles.type="nodegraphics"/>
<key for="edge" id="d1" yfiles.type="edgegraphics"/>
<graph id="G" edgedefault="directed">
<node id="n0">
<data key="d0">
<y:ShapeNode>
<y:NodeLabel>0:ctrl.jl</y:NodeLabel>
</y:ShapeNode>
</data>
</node>
</graph>
</graphml>"""
with self.runner.isolated_filesystem(temp_dir=self.temp_dir):
Path("workflow.graphml").write_text(graphml)
src_dir = Path("src")
src_dir.mkdir()
(src_dir / "ctrl.jl").write_text("# julia controller")

# validate passes with no unusual file extension warning
val_res = self.runner.invoke(cli, ["validate", "workflow.graphml", "--format", "json"])
self.assertEqual(val_res.exit_code, 0)
val_payload = json.loads(val_res.output)
self.assertTrue(val_payload["valid"])
self.assertEqual(val_payload["summary"]["error_count"], 0)
warning_messages = [w["message"] for w in val_payload["warnings"]]
self.assertFalse(any("unusual file extension" in m for m in warning_messages))

# inspect reports Julia language
insp_res = self.runner.invoke(cli, ["inspect", "workflow.graphml", "--json"])
self.assertEqual(insp_res.exit_code, 0)
insp_payload = json.loads(insp_res.output)
self.assertEqual(insp_payload["nodes"]["by_language"].get("julia"), 1)
self.assertEqual(insp_payload["nodes"]["list"][0]["language"], "julia")


if __name__ == "__main__":
unittest.main()