-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: templates_parser
for file initializations
#1890
Conversation
commit 72eff5c Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Mon Mar 10 23:55:41 2025 +0100 Self-review commit 4174977 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Mon Mar 10 23:21:52 2025 +0100 Downgrade templates parser to avoid GNAT>=11 commit 9cece27 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Mon Mar 10 23:17:50 2025 +0100 Hash to avoid arbitrary regeneration commit bd24060 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Mon Mar 10 23:06:53 2025 +0100 Tests passing commit b37e33e Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Mon Mar 10 14:45:27 2025 +0100 update init to use templates commit ffd90a0 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 23:15:35 2025 +0100 Proof of concept working commit 9551420 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 22:46:06 2025 +0100 Templated file trees commit 557e67e Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 21:15:56 2025 +0100 Remove custom experiments in main commit f0c573d Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 21:12:23 2025 +0100 Write file with templating commit 947d1db Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 20:12:23 2025 +0100 Embedded resource writing (no templating) commit 5e533d5 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 11:30:06 2025 +0100 Template registration commit fc19c09 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 10:55:06 2025 +0100 embedder script commit 90d0778 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Mar 9 10:32:14 2025 +0100 Sample binary crate commit ce9ef50 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Nov 10 19:00:53 2024 +0100 wip: on track to 1st prototype commit 1e52e58 Author: Alejandro R. Mosteo <amosteo@unizar.es> Date: Sun Oct 27 20:05:57 2024 +0100 WIP: experimenting with embedded resources
de4c522
to
419790e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the use of ARE for this use case. We have another way to handle resources for native applications: https://github.com/alire-project/resources
@@ -69,3 +69,6 @@ | |||
[submodule "deps/yeison"] | |||
path = deps/yeison | |||
url = https://github.com/mosteo/yeison | |||
[submodule "deps/templates-parser"] | |||
path = deps/templates-parser | |||
url = https://github.com/alire-project/templates-parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the official repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the official repo is missing a project file which is generated with make
, and I don't want to introduce that dependency in the build of alr
from scratch without alr
... I like depending only on gprbuild
for as long as possible.
An alternative to templates parser could be JinTP which I just became aware of the other day. It looks more like the liquid templates in jekyll, and seems to be quite light. I don't know if you have experience with it, I don't know how mature it is in real use.
This is to make Or if for example we started using templates for the long help descriptions, it would also be nice not to depend on external files. |
1054113
to
0d7d688
Compare
The idea is to use
Templates_Parser
to generate files (currently only duringalr init
), which enhances maintenance, and opens the door to user templates (not in this PR, this only deals with our own hardcoded initializations).This is achieved this way:
templates
replicate the trees we want to generate. These can contain TP variables/filters/etc.support/embedder/embedder.sh
script generates embedded resources undersrc/templates
. It relies onawsres
from AWS, but since this is done independently of Alire's build, it doesn't introduce new dependencies (in particular I didn't want to depend on AWS fromalr
).alr
with the same simplicity.Alire.Templates
provides a couple of wrappers over TP to use the embedded resources.Alire.Templates.Builtins
constants define the structure of folders we want to generate.User templates could be had e.g. via
alr init --template=<url>
with little extra effort now that the basis is in place.This makes the only new dependency to be
templates_parser
, and it doesn't require special compilation as I forked their repo to have the preconfiguration done, sogprbuild
is still enough to build.Edit: I initially thought xmlada was also required but it can be disabled in templates_parser.
Fixes #11.
Fixes #1896.