feat: add TASK_SOURCES special variable #2047
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the
TASK_SOURCESvariable to tasks. If a task defines thesourceskey,TASK_SOURCEScontains the list of paths referenced bysources. Globs are expanded.This was initially implemented by @hernandanielg in #1146 to fix #948. The PR seemed to have stalled since, which is why I'm now opening this new PR. In contrast to #1146 my changes set
TASK_SOURCESto a list, which allows users to use template functions to transform the value ofTASK_SOURCES. Additionally, I decided to name the variableTASK_SOURCESinstead ofSOURCES, as I wanted to make clear that this variable only exists for tasks.I'm aware of this comment by @callegar which wondered if
sourcesshould be changed to accept the value of variables. However, this seemed like a bigger change to me (I may be wrong since I don't know the code in detail). Therefore I opted to stick with the original proposal.The downside of my change is, that globs get expanded whenever the
TASK_SOURCESvariable is set. I'm not yet sure under which circumstancesCompiler.FastGetVariablesandCompiler.GetVariablesare called. Both of those methods call thegetVariablesmethod which in turn calls thegetSpecialVariablesmethod I modified. Would it be enough to just passevaluateShVarstogetSpecialVariables(maybe renaming it tofastin the process) and skip glob expansion if it istrue?