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.
Implement
ValueSource
for executing npm.This is a very rough first draft.
See #334 for motivations.
Example usage:
Limitations
npm must be installed before
NpmExecSource
can be used.Currently npm is installed using a Task, so NpmExecSource
will fail unless the task runs first. This is not ideal, because I want to (eventually) use
NpmExecSource` in the configuration phase should not depend on the execution of a task.This can be remedied by installing npm in
ValueSource
in the Configuration phase. I think this should be done in a separate PR, andNpmExecSource
can be released as experimental.No caching
Each
NpmExecSource
will recompute the required exec properties independently. This could be slow, or expensive.Gradle does not yet provide a tool to cache configuration-time work https://github.com/gradle/gradle/issues/
We could implement a custom mechanism for caching the exec properties.
Duplicated code
I copied this existing logic from
VariantComputer
andNpmExecRunner
intoNpmExecSource
. This was to avoid the complicated provider mapping logic, which is not necessary inside of aValueSource
, because the values can be computed directly.This means the initial implementation duplicates a lot of code.
I anticipate this will be deduplicated once the tasks are converted to use a '
ValueSource
first' approach.TODO
#334