ash-project / igniter

A code generation and project patching framework.

Home Page:https://hexdocs.pm/igniter/readme.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ability for tasks to refuse composition.

jimsynz opened this issue · comments

As much as we really really want to discourage this use case, there may be times that a task should not be used from within another task - eg those that rely on the compiled project for introspection.

This issue is to track discussion on how to best support these use cases and minimise the potential pitfalls of doing so.

This is @jimsynz idea, not mine:

First, we add a requires_compile?: false flag to Igniter.Mix.Task.Info. Then, when calling Igniter.composing tasks, if we're composing a task with requires_compile?: falseand there are any staged changes in the igniter, we show the user a diff & commit prompt w/ a message liketask foo.bar must write all changes and compile before proceeding(must will be in red). If they accept this, then we write everything and do aMix.Task.run("compile")` and continue on as normal.