1

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?

2
  • 1
    Have you tried using Script Engine? Commented Jan 27, 2021 at 13:19
  • Yes, I tried. Unfortunately, there is no library function to build the project. May be this is possible through UI automation. But I hope someone has a better solution, because, I think, this is a very common task. Commented Jan 27, 2021 at 14:18

1 Answer 1

4

The Script Engine does support this:

Execute
start /b /wait "C:\Program Files (x86)\CODESYS V3.5 SP16\CODESYS\Common\CODESYS.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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.