Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
686 views
in Technique[技术] by (71.8m points)

plc - Compiling CoDeSys project using the command line

Is it possible to run the CoDeSys compiler to build my project without running the IDE, using only the command line interface?

May be there are other options, for example, some scripts, that can launch the IDE, start the build process, collect the output and exit?

I am interested in this in the context of automatic testing of my project on the CI server. I am using git on the local network, and I would like to run the build after new commits automatically, on the CI side. After the build I would like to get the output of the compiler and check if there are no any errors.

Any ideas? Is it possible in CoDeSys?

question from:https://stackoverflow.com/questions/65915450/compiling-codesys-project-using-the-command-line

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Script Engine does support this:

Execute
start /b /wait "C:Program Files (x86)CODESYS V3.5 SP16CODESYSCommonCODESYS.exe" --profile="CODESYS V3.5 SP16" --runscript="build.py" --noUI

See https://help.codesys.com/webapp/_cds_commandline;product=codesys;version=3.5.16.0#option-runscript-execute-script

build.py

import scriptengine

project = projects.open(r"CodesysProject.project", primary = True)
application = project.active_application
application.generate_code()
messages = system.get_messages("97f48d64-a2a3-4856-b640-75c046e37ea9")
// check messages

See https://help.codesys.com/webapp/ScriptApplication;product=ScriptEngine;version=3.5.16.0


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...