I'm looking to use Git with a CoDeSys 2.3 PLC project. By default, the project is stored in one large binary file. Git can detect that changes have been made to this file, but it can't see into file to know what has changed.
I'm looking for a solution that stores the code in a text file or XML file that Git can read and therefore is able to show changes. It would be beneficial if the solution required a minimum amount of manual intervention to work.
In my research I have found that the source code can be exported into plain text using the Export function in the menu (Project -> Export...). There is also an import function for pulling the source code back into the PLC project.
I think these two tools have the functionality that I'm looking for, but I would like to find a way to make the process a little more automated. Ideally this would be a script that is called automatically as part of the build process, after saving the project or perhaps when calling git-status.
I have found a partial answer to my own question here: https://forge.codesys.com/forge/talk/CODESYS-V2/thread/d1685e2948/
CoDeSys 2.3 has support for running a list of commands from a command file. This file is passed to the program as an argument in when called in command line.
A powershell script that exports the PLC code to a specified location:
I'm not sure if the export files fully describe the project. There may be important data that remains in the .pro file. So, the .pro file will also remain in the git repo. Given that, I decided not to automate the import function as it will only occasionally be required.