Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added gitignore-file for Beckhoff TwinCAT3. #3092

Merged
merged 6 commits into from May 7, 2021

Conversation

sagatowski
Copy link
Contributor

@sagatowski sagatowski commented Jun 22, 2019

Provide a link to the application or project’s homepage:
https://www.beckhoff.com/english.asp?twincat/twincat-3.htm
TwinCAT3 is a realtime kernel and development environment for PLCs (programmable logic controller). The IDE is based on Visual Studio, which TwinCAT is integrated into. It's one of the more popular development environments for industrial automation.

Provide links to documentation:
The official one:
https://download.beckhoff.com/download/document/automation/twincat3/TC3_SourceControl_EN.pdf
This only covers part of the files (specifying that TMC and TPY-files are not necessary to version control). Unfortunately, even Beckhoff (the manufacturer of TwinCAT) have failed to properly document which files should be version controlled and not.

Regarding the other files included in the gitignore-file of the pull request:

  • *.tclrs - These are license response files, basically license files that are residing on the target PLC device
  • *.compiled-library and *.library - which are libraries of which the project depends on. These are put here when they are referenced in the project, but the actual libraries needed for development are installed in "C:\TwinCAT\3.1\Components\Plc\Managed Libraries", which need to be installed there prior of compilation. The ones residing in the project must not be version controlled.
  • *.compileinfo - Self explaining, file created everytime a compilation is made. Beckhoff documentation says: "The compile information was created during the last download of the PLC project and stored in a file".
  • _Boot/ - Folder generated when project is compiled with all the binaries. This is what is transferred to the actual target device (PLC) for execution.
  • _CompileInfo/ - Self explaining. Folder created during compilation. Holding the *.compileinfo-files.
  • _Libraries/ - Folder holding the *.compiled-library and *.library in the local development folder.

There are various github repos for TwinCAT that use this list for gitignore, one being TcUnit, a unit testing framework for TwinCAT3:
https://github.com/tcunit/TcUnit/blob/master/.gitignore

Note that because TwinCAT is using visual studio as development environment (it integrates itself into VS during installation), all visual studio files that are normally ignored shall be ignored as well (therefore the comment # Recommended: VisualStudio.gitignore).

Update 2019-12-05: I've published a blog post that goes through these files and the reason for having a gitignore-file for TwinCAT3 in a much greater detail now which is accessible here:
https://alltwincat.com/2019/12/02/gitignore-for-twincat/

Explain why you’re making a change:
Unfortunately version control by modern VCS is yet quite uncommon in industrial automation, and therefore proper practices and documentation around it have not yet been fully defined. It's quite common within the world of automation to do version control by simply taking a complete project folder and copying it to a new folder, adding the new date and calling that version control. Now that more and more automation engineers are starting to do version control more properly, and also starting to use GIT, it makes sense to create this file.

If this is a new template:
Link to application or projects homepage:
This would be TcUnit, which is a popular unit testing framework for TwinCAT3:
https://tcunit.org/
https://github.com/tcunit

…is a gitignore file only applicable for TwinCAT3 and not also TwinCAT2 (which stores everything in a big binary blob).
@sagatowski sagatowski changed the title Added gitignore-file for Beckhoff TwinCAT. Added gitignore-file for Beckhoff TwinCAT3. Jul 13, 2019
@sagatowski
Copy link
Contributor Author

sagatowski commented Aug 21, 2019

@shiftkey - it's been two months since the creation of this PR and I just wanted to double-check if there is something expected from me that I need to do for this to progress? I tried to document the reason for this addition as well as I could, but maybe there is still some information missing that you expect?

- tmcRefac
- project.~u
- tsproj.bak
- xti.bak (TwinCAT export files backup)
@sagatowski
Copy link
Contributor Author

sagatowski commented Nov 17, 2019

@shiftkey , just doing a ping on this one as it's now been 5 months since the creation of this ticket... :-P

chripf
chripf approved these changes Dec 12, 2019
Copy link

@chripf chripf left a comment

looks good and is very helpful for twincat development

Copy link

@kryskool kryskool left a comment

I use it for my TC project

…tcunit/TcUnit#85) and having a discussion with Beckhoff support, it was concluded that the files "LineIDs.dbg" and "LineIDs.dbg.bak" should not be version controlled, and thus these two are added to the gitignore-file for TwinCAT3.
@massimo-pizzardi
Copy link

massimo-pizzardi commented Mar 11, 2020

I think that is a good idea to add this line:
.tsproj.bk
these are backup file of *.tsproj

@sagatowski
Copy link
Contributor Author

sagatowski commented Mar 11, 2020

I think that is a good idea to add this line:
.tsproj.bk
these are backup file of *.tsproj

I've already included *.tsproj.bak... which I assume you meant?

@massimo-pizzardi
Copy link

massimo-pizzardi commented Mar 17, 2020

.tsproj.bk1
.tsproj.bk2
.tsproj.bk3
these files are backup of file .tsproj.bak

@rudischilder
Copy link

rudischilder commented Apr 8, 2020

TwinCAT HMI

Assuming this .gitignore should be applicable to all TwinCAT modules, you can add the following:

## Ignore TwinCAT HMI temporary files, build results, and
## files generated by popular TwinCAT HMI add-ons.
.engineering_servers
liveview_*
*.cache
*.db-shm
*.db-wal
*.pid
tchmipublish.journal.json

These come from a file called .tfignore, which is generated upon adding a new TwinCAT HMI project to a solution, somewhere in your working tree.

Initially I thought that anything under \Server\Extensions should also be ignored, but that is up for debate. For some reason, the underlying .json files are often seen as changed, while in fact they are not. This leads me to believe they were generated. However they do contain information necessary for publishing your HMI project to a HMI server. For now I myself do not ignore them. Instead I undo any changes made to them, unless I can explain those changes.

Backup files

I noted that visual studio/shell did not always recognize backup files, so i simply added *.bak as well.

It should be noted that PLC projects come with the .tcpproj extension, and thus also the .tcpproj.bak should be added to the gitignore file.

Final note

I do not like that the .tmc file must be generated on build, yet saved to the repo. I hope Beckhoff could split any necessary configuration/generation in future versions.

@HolgerJeromin
Copy link

HolgerJeromin commented Apr 8, 2020

@rudischilder
In the TwinCAT HMI 1.12 beta there are the following further entries added to its .gitignore:

.hmiframework/
.hmipkgs/*-*-*-*/

@sagatowski
Copy link
Contributor Author

sagatowski commented Apr 10, 2020

@rudischilder & @HolgerJeromin, when creating a TwinCAT-HMI project, a .gitignore-file is created automatically, thus should not be included here.

…me new files were automatically generated after compilation:

_ModuleInstall/TcFilter/TwinCAT CE7 (ARMV7)/TcFilterW32.dll
_ModuleInstall/TcFilter/TwinCAT CE7 (x86)/TcFilterW32.dll
_ModuleInstall/TcFilter/TwinCAT RT (x64)/TcFilter.sys
_ModuleInstall/TcFilter/TwinCAT RT (x86)/TcFilter.sys

After contacting Beckhoff support, it was concluded that the folder "_ModuleInstall" could be omitted from version control, thus this addition.
joeblau pushed a commit to toptal/gitignore that referenced this issue Jul 18, 2020
* Patch TwinCAT 3.1 (ignore temp file)

* Patch TwinCAT 3.1 (ignore backup files)

* Patch TwinCAT 3.1 (ignore original files after TcProjectCompare)

* Include suggestions from GitHub: github/gitignore#3092

* Rename TwinCAT to TwinCAT3 as it will be the same name used on GitHub: github/gitignore#3092
@isherman
Copy link

isherman commented Dec 21, 2020

@sagatowski thank you for this.
Should the _Deployment directory be ignored as well? The _Repository directory?

@sagatowski
Copy link
Contributor Author

sagatowski commented Dec 25, 2020

@sagatowski thank you for this.
Should the _Deployment directory be ignored as well? The _Repository directory?

@isherman I haven't managed to reproduce the _Deployment directory. Under what conditions is this created?

Copy link

@kryskool kryskool left a comment

Ok for me
Use similar file on my own repository

@StEvUgnIn
Copy link

StEvUgnIn commented Mar 31, 2021

Hi,
Any update? This work seems alright to me.

@sagatowski
Copy link
Contributor Author

sagatowski commented Mar 31, 2021

Hi,
Any update? This work seems alright to me.

GitHub are not in a hurry with approving this PR it seems.

@shiftkey It's been almost two years since this PR was created. How much (approx.) will it take before it is approved? If there is some information missing, please let me know.

Copy link

@StEvUgnIn StEvUgnIn left a comment

I would drop these two lines

TwinCAT.gitignore Outdated Show resolved Hide resolved
TwinCAT.gitignore Outdated Show resolved Hide resolved
Copy link

@StEvUgnIn StEvUgnIn left a comment

I will do someting nicer.

TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Outdated Show resolved Hide resolved
@isherman
Copy link

isherman commented Mar 31, 2021

@isherman I haven't managed to reproduce the _Deployment directory. Under what conditions is this created?

I haven't tried to isolate the exact condition that creates it, but my project includes a TwinCAT C++ module and TwinSAFE configuration.

Copy link

@StEvUgnIn StEvUgnIn left a comment

Please make the proper changes

TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT.gitignore Outdated Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
Copy link

@StEvUgnIn StEvUgnIn left a comment

passing concise comment

TwinCAT3.gitignore Show resolved Hide resolved
TwinCAT3.gitignore Show resolved Hide resolved
@mazid12345
Copy link

mazid12345 commented Mar 31, 2021

[] unc0ver is not for sale
[
] If you purchased unc0ver, please report the seller
[] Get unc0ver for free at https://unc0ver.dev
[
] Configured to share anonymous OS crash logs
[] Machine Name: iPhone9,4
[
] Model Name: D111AP

  • [*] Kernel Version: Darwin Kernel Version 20.1.0: Fri Oct 30 00:34:15 PDT 2020; root:xnu-7195.42.3~1/RELEASE

Copy link

@StEvUgnIn StEvUgnIn left a comment

What do you think?

@sagatowski
Copy link
Contributor Author

sagatowski commented Apr 1, 2021

[] unc0ver is not for sale [] If you purchased unc0ver, please report the seller
[] Get unc0ver for free at https://unc0ver.dev [] Configured to share anonymous OS crash logs
[] Machine Name: iPhone9,4 [] Model Name: D111AP

  • [*] Kernel Version: Darwin Kernel Version 20.1.0: Fri Oct 30 00:34:15 PDT 2020; root:xnu-7195.42.3~1/RELEASE

Great, now we've got SPAM-bots attacking this PR too. I hope this PR can be accepted & closed.

@oscarbailey-tc
Copy link

oscarbailey-tc commented Apr 1, 2021

Just to add, I'd like this PR merged too - used the .gitignore yesterday for a TC3 project, thanks @sagatowski

@bdougie
Copy link
Collaborator

bdougie commented May 7, 2021

Hey folks, sorry for the long wait. LGTM

@bdougie bdougie merged commit 036ccc1 into github:master May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment