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_SOURCES
variable to tasks. If a task defines thesources
key,TASK_SOURCES
contains 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_SOURCES
to a list, which allows users to use template functions to transform the value ofTASK_SOURCES
. Additionally, I decided to name the variableTASK_SOURCES
instead 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
sources
should 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_SOURCES
variable is set. I'm not yet sure under which circumstancesCompiler.FastGetVariables
andCompiler.GetVariables
are called. Both of those methods call thegetVariables
method which in turn calls thegetSpecialVariables
method I modified. Would it be enough to just passevaluateShVars
togetSpecialVariables
(maybe renaming it tofast
in the process) and skip glob expansion if it istrue
?