Update .gitignore and README.md for CODESYS MCP project. Added entries to .gitignore for VSIX files and VS Code settings. Expanded README to include architecture, components, deployment instructions, and details about the Cursor extension.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python
|
||||
"""Build/compile a CODESYS project via ScriptEngine."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
||||
from _common import emit, load_payload
|
||||
|
||||
|
||||
def main():
|
||||
payload = load_payload()
|
||||
project_path = payload.get("project_path")
|
||||
save_after_build = bool(payload.get("save_after_build", True))
|
||||
if not project_path:
|
||||
raise ValueError("project_path is required.")
|
||||
pp = os.path.abspath(os.path.expanduser(project_path))
|
||||
if not os.path.exists(pp):
|
||||
raise RuntimeError("Project path does not exist: {0}".format(pp))
|
||||
if "projects" not in globals():
|
||||
raise RuntimeError("Run through CODESYS ScriptEngine (--runscript).")
|
||||
|
||||
if projects.primary:
|
||||
projects.primary.close()
|
||||
proj = projects.open(pp, primary=True, allow_readonly=False)
|
||||
app = proj.active_application
|
||||
if app is None:
|
||||
raise RuntimeError("No active application found in project.")
|
||||
|
||||
app.build()
|
||||
if save_after_build:
|
||||
proj.save()
|
||||
proj.close()
|
||||
|
||||
emit(
|
||||
{
|
||||
"ok": True,
|
||||
"action": "build_project",
|
||||
"project_path": pp,
|
||||
"save_after_build": save_after_build,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user