Recent

Author Topic: gitignore template issues, looking for suggestions  (Read 6447 times)

avra

  • Hero Member
  • *****
  • Posts: 2590
    • Additional info
gitignore template issues, looking for suggestions
« on: November 13, 2020, 10:11:52 am »
I have found official github gitignore template for Lazarus here:
https://github.com/github/gitignore/blob/master/Global/Lazarus.gitignore

I will also show it here:
Quote
# Lazarus compiler-generated binaries (safe to delete)
*.exe
*.dll
*.so
*.dylib
*.lrs
*.res
*.compiled
*.dbg
*.ppu
*.o
*.or
*.a

# Lazarus autogenerated files (duplicated info)
*.rst
*.rsj
*.lrt

# Lazarus local files (user-specific info)
*.lps

# Lazarus backups and unit output folders.
# These can be changed by user in Lazarus/project options.
backup/
*.bak
lib/

# Application bundle for Mac OS
*.app/

Excluding *.res files gave me some packages compilation issues as mentioned here:
https://forum.lazarus.freepascal.org/index.php/topic,39508.msg383490.html#msg383490

I plan to fork that repo and fix this issue. Besides removing *.res from gitignore, I am thinking to remove *.lrs files, and to add some more lazarus generated backup files to gitignore. Like this:
Quote
# Lazarus compiler-generated binaries (safe to delete)
*.exe
*.dll
*.so
*.dylib
# *.lrs
# *.res
*.compiled
*.dbg
*.ppu
*.o
*.or
*.a

# Lazarus autogenerated files (duplicated info)
*.rst
*.rsj
*.lrt

# Lazarus local files (user-specific info)
*.lps

# Lazarus backups and unit output folders.
# These can be changed by user in Lazarus/project options.
backup/
*.bak
*.bkp
lib/
*.~*

# Application bundle for Mac OS
*.app/

Therefore I am asking if there are some suggestions for further refinement of this gitignore Lazarus template.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12888
  • FPC developer.
Re: gitignore template issues, looking for suggestions
« Reply #1 on: November 13, 2020, 10:23:11 am »
.lrs and .res are generated files, though in some cases you might want to store them.

But in time, with the build in resource compiler the need for that might wane.




avra

  • Hero Member
  • *****
  • Posts: 2590
    • Additional info
Re: gitignore template issues, looking for suggestions
« Reply #2 on: November 13, 2020, 10:36:08 am »
.lrs and .res are generated files, though in some cases you might want to store them.
I would like to exclude them from gitignore since in a real life example (follow the link) packages can not be compiled without them. Actually link mentions *.res files, but I assume that it is the same for *.lrs. Am I right on this one?

But in time, with the build in resource compiler the need for that might wane.
The future is bright  :D
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12888
  • FPC developer.
Re: gitignore template issues, looking for suggestions
« Reply #3 on: November 13, 2020, 10:54:02 am »
.lrs and .res are generated files, though in some cases you might want to store them.
I would like to exclude them from gitignore since in a real life example (follow the link) packages can not be compiled without them.

But is that a necessary thing, or simply a badly crafted package? Does the package have a .rc file to make the relevant .res and is that added to the project?  That is afaik how it should be. If you eliminate the need for the .res files to be stored, but craft it when necessary out of the assets (e.g. images) and a .rc, than that is done.

I do this for some work projects that use opengl shaders, default XML files etc. All with a .rc under both Delphi and Lazarus.

Quote
Actually link mentions *.res files, but I assume that it is the same for *.lrs. Am I right on this one?

Afaik *.lrs is to keep legacy running only since FPC 2.6.0 (?) and the corresponding Lazarus. I wouldn't care much either way, and maintained projects better clean that up.   

But in time, with the build in resource compiler the need for that might wane.
The future is bright  :D
[/quote]

PascalDragon

  • Hero Member
  • *****
  • Posts: 6396
  • Compiler Developer
Re: gitignore template issues, looking for suggestions
« Reply #4 on: November 13, 2020, 02:50:39 pm »
Therefore I am asking if there are some suggestions for further refinement of this gitignore Lazarus template.

You can also exclude *.pcp and *.ppl. The former is the meta file for dynamic packages (aka the PPU variant for packages) and the later is a binary dynamic package (the equivalent to Delphi's .bpl) if the OS allows to change the file extension for libraries (macOS does not for example).

.lrs and .res are generated files, though in some cases you might want to store them.
I would like to exclude them from gitignore since in a real life example (follow the link) packages can not be compiled without them.

But is that a necessary thing, or simply a badly crafted package? Does the package have a .rc file to make the relevant .res and is that added to the project?  That is afaik how it should be. If you eliminate the need for the .res files to be stored, but craft it when necessary out of the assets (e.g. images) and a .rc, than that is done.

I do this for some work projects that use opengl shaders, default XML files etc. All with a .rc under both Delphi and Lazarus.

I think Lazarus creates a .res-file by default for the project (for the icon). That might of course change with the new RC parser in fcl-res.

Edit: fixed BBCode
« Last Edit: November 15, 2020, 12:00:53 pm by PascalDragon »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12888
  • FPC developer.
Re: gitignore template issues, looking for suggestions
« Reply #5 on: November 13, 2020, 03:35:34 pm »
And if that takes too long, maybe lazarus can split the .res  files in generated and "source" ones, by using a different extensions for one of them.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12386
  • Debugger - SynEdit - and more
    • wiki
Re: gitignore template issues, looking for suggestions
« Reply #6 on: November 13, 2020, 04:58:33 pm »
.lrs and .res are generated files, though in some cases you might want to store them.

Right now there are several pre-comited *.res files.

Generated .res files usually are inside lib (or sometimes unit) folders.

Something like this should exclude those folders:
Code: [Select]
/**/units/
/**/lib/

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12888
  • FPC developer.
Re: gitignore template issues, looking for suggestions
« Reply #7 on: November 13, 2020, 05:51:41 pm »
.lrs and .res are generated files, though in some cases you might want to store them.

Right now there are several pre-comited *.res files.

But can it be removed? What is the reason that they aren't generated on the fly from the master sources?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12386
  • Debugger - SynEdit - and more
    • wiki
Re: gitignore template issues, looking for suggestions
« Reply #8 on: November 13, 2020, 06:26:02 pm »
But can it be removed? What is the reason that they aren't generated on the fly from the master sources?
Probably: Historic reasons?

Also, can 304 build them on the fly? We still support 3.0.4.

avra

  • Hero Member
  • *****
  • Posts: 2590
    • Additional info
Re: gitignore template issues, looking for suggestions
« Reply #9 on: November 15, 2020, 11:06:48 am »
.lrs and .res are generated files, though in some cases you might want to store them.
I would like to exclude them from gitignore since in a real life example (follow the link) packages can not be compiled without them.

But is that a necessary thing, or simply a badly crafted package? Does the package have a .rc file to make the relevant .res and is that added to the project?
This is the package example: https://bitbucket.org/avra/ct4laz/downloads/pl_excontrols.zip
If, for example TplSmartGridCursors.res file is missing, the package can not compile. There are no *.rc files inside. Archive holds all *.res files, but when mentioned .gitignore file was applied to the repo, all *.res files were missing. Having *.res without *.rc might mean that it is a badly crafted package, but it is forked package and not mine, so I have only partial control on it.

That is the reason why I would like to have *.res and *.lrs files excluded from .gitignore, and I would like to discuss if that is in general good thing or bad thing for Lazarus .gitignore. I am more practical then purist, so having a real issue with such .gitignore file config makes me vote for exclusion, but if general preference is to leave it be - I will. I can solve my package issue with local .gitignore modification anyway. The reason I started the discussion at the first place is to determine optimal .gitignore file.

Therefore I am asking if there are some suggestions for further refinement of this gitignore Lazarus template.

You can also exclude *.pcp and *.ppl. The former is the meta file for dynamic packages (aka the PPU variant for packages) and the later is a binary dynamic package (the equivalent to Delphi's .bpl[/i) if the OS allows to change the file extension for libraries (macOS does not for example).
Ok, I will include those in .gitignore file, too. Thank you for the contribution.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12888
  • FPC developer.
Re: gitignore template issues, looking for suggestions
« Reply #10 on: November 15, 2020, 03:32:18 pm »
This is the package example: https://bitbucket.org/avra/ct4laz/downloads/pl_excontrols.zip
If, for example TplSmartGridCursors.res file is missing, the package can not compile. There are no *.rc files inside. Archive holds all *.res files, but when mentioned .gitignore file was applied to the repo, all *.res files were missing. Having *.res without *.rc might mean that it is a badly crafted package, but it is forked package and not mine, so I have only partial control on it.

Yes. But do we really need to unhide the whole large amount of automatically generated res files for that?

Maybe it would be more logical to simply extract the resources with e.g. resource hacker and convert the component to be res-less ?

In time of course, first the native rc compiling compiler has to be released.

avra

  • Hero Member
  • *****
  • Posts: 2590
    • Additional info
Re: gitignore template issues, looking for suggestions
« Reply #11 on: November 15, 2020, 04:53:04 pm »
This is the package example: https://bitbucket.org/avra/ct4laz/downloads/pl_excontrols.zip
If, for example TplSmartGridCursors.res file is missing, the package can not compile. There are no *.rc files inside. Archive holds all *.res files, but when mentioned .gitignore file was applied to the repo, all *.res files were missing. Having *.res without *.rc might mean that it is a badly crafted package, but it is forked package and not mine, so I have only partial control on it.

Yes. But do we really need to unhide the whole large amount of automatically generated res files for that?

Maybe it would be more logical to simply extract the resources with e.g. resource hacker and convert the component to be res-less ?
My CT conversion process is automated, so I don't want to ruin it. I will give up on idea to exclude *.res and *.lrs files from github's official .gitignore Lazarus template, but will keep those exclusions for ct4laz repo. That will fix the problem. However *.pcp, *.ppl, and backup files will be included.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: gitignore template issues, looking for suggestions
« Reply #12 on: November 15, 2020, 05:21:31 pm »
Here is what we use for BGRAControls

Code: Pascal  [Select][+][-]
  1. *.bak
  2. *.dbg
  3. *.exe
  4. *.lps
  5. backup/*
  6. backup
  7. lib
  8. debug
  9. *.res
  10. *.lrt
  11. *.o
  12. *.ppu
  13. *.or
  14. *.compiled
  15. *Thumbs.db
  16. *.app/*
  17. *.dSYM
  18. test/test_bccombobox/test_bccombobox
  19.  
  20. .DS_Store
  21.  

avra

  • Hero Member
  • *****
  • Posts: 2590
    • Additional info
Re: gitignore template issues, looking for suggestions
« Reply #13 on: November 15, 2020, 05:49:17 pm »
Here is what we use for BGRAControls
Thank you for your contribution. I will include *Thumbs.db in .gitignore, too.

I guess I could also include *.dSYM and .DS_Store files for Apple users, but since I am not one I ask if that would be a good thing for general .gitignore Lazarus template file?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

lainz

  • Hero Member
  • *****
  • Posts: 4743
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: gitignore template issues, looking for suggestions
« Reply #14 on: November 15, 2020, 06:26:06 pm »
Well I use a mac sometimes only, so I think that was added by circular, he uses a mac.

 

TinyPortal © 2005-2018