[WIP] Access Task sources, generates, and task maps#2615
[WIP] Access Task sources, generates, and task maps#2615CuckooEXE wants to merge 3 commits intogo-task:mainfrom
sources, generates, and task maps#2615Conversation
|
You can do everything you want with existing features, essentially, a Taskfile that works like a template. Exactly how ... for starters: myApp:
vars:
APP_NAME: '{{.USER_WORKING_DIR}}'
sources: ["*.c"]
generates: ["{{.ROOT_DIR}}/bin/{{.APP_NAME}}"]
cmd: gcc -o {{.ROOT_DIR}}/{{.APP_NAME}} *.c1/ replace That's it. More of less ... I suggest starting a topic in the "Discussions", if you need more help. A PR will not get much attention. |
|
I think that pattern forces codebases to comply with Taskfile's usage (rather, limitations). For that to work I have to change either how I (and my CI/CD) build (by changing directories before building), and it forces me to layout my files in a specific structure. I'm not sure your suggestion actually satisfies the original points in my description. This PR stemmed from discussion in the discord with @andreynering. |
b7aab34 to
a339039
Compare
|
I (read: the AI) significantly changed the code (and the files modified). I (read: this time actually me) wrote the tests and they pass for my updated implementation. I think this makes more sense after studying the codebase, and it more matches the pattern of existing variables. |
Do not merge, opening for discussion
This PR was created by taking fhofherr's PR and feeding it through Cursor's AI. I don't know golang, let alone this codebase, so I was more exploring if what I was looking for would even be possible.
Specifically, I'm looking for two features:
What I mean is, when writing a simple
gcc-based target, you'll find yourself repeating a lot of code. Right now this is how you would do it:By implementing the first feature, we could instead write something like this (using this PR):
TASK_GENERATESworks a little funny because the files don't exist yet. So any globs would have to be passed in as raw strings with the glob pattern.The other feature would allow me to re-use information already in the Taskfile in other targets, for example (and this is not implemented correctly in this PR):
This is partially implemented in this PR by exposing a Task's mapping in a for loop as such:
I'm very invested in this feature (my team is looking to migrate away from our Makefile-hell), so anything I can do to help out with this, I'm here for!