Skip to content

template_processor: Allow to skip files or directories - #27

Open
fetzerch wants to merge 2 commits into
masterfrom
skip_dirs
Open

template_processor: Allow to skip files or directories#27
fetzerch wants to merge 2 commits into
masterfrom
skip_dirs

Conversation

@fetzerch

Copy link
Copy Markdown
Member

Templated file names can now contain expressions to control if the file or directory should be generated or skipped. If the expression evaluates to a non-empty string, that string is used as file or directory name. If the expression evaluates to an empty string the generation of that file or directory is skipped.

This can be used to provide custom files in the source repo that are not overridden by a template.

For example the directory:
addon/depends/windows/{{ "mingw" if not config.nomingw }} is not generated if 'nomingw': True is added to the config.

@garbear is this what you meant with your comment in kodi-game/game.libretro.2048#6?
I fear in its current form the template engine cannot skip a directory based on the existence of a file in the source repo. With this change, we would just need to add depends/windows/2048/CMakeLists.txt and remove depends/windows/mingw/*. The other changes from https://github.com/kodi-game/game.libretro.2048/pull/6/files (appveyor, common/2048/CMakeLists.txt) would remain as they are, but that shouldn't be an issue.

Maybe also interesting for @Rechi.

@Rechi

Rechi commented Mar 19, 2018

Copy link
Copy Markdown
Contributor

depends/common/{{ game.name }}/windows-deps.txt may also have to be removed/not added in that case.

@coveralls

coveralls commented Nov 15, 2018

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 78.562% when pulling 8deedd6 on skip_dirs into c674a45 on master.

@fetzerch

Copy link
Copy Markdown
Member Author

While refactoring the code, I noticed that this should be already possible: A file is not generated if its content is empty. I'll update this change accordingly.

@fetzerch

Copy link
Copy Markdown
Member Author

@Rechi Is it still the case that 2048 should be compiled without mingw on windows? Then I'll merge this as well.

@fetzerch

Copy link
Copy Markdown
Member Author

There's a bit more todo: (see https://github.com/kodi-game/game.libretro.2048/pull/6/files)

  • depends/common/2048/CMakeLists.txt
  • depends/windows/2048/2048.txt
  • appveyor.yml

@Rechi

Rechi commented Nov 21, 2018

Copy link
Copy Markdown
Contributor

Although it would be nice to get rid of mingw, there is no use if it is only done for one.
Additionally one would have to keep the cmake project in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants