Replies: 2 comments 17 replies
-
It seems the problem is that Mill's evaluation model assumes that when you generate the This seems pretty fundamental to how Mill works today, but it's plausible that there's room for improvement. Essentially we would need to separate the definition of the generated source root folder from the actual generation of those sources, basically what you have done in your snippet above. |
Beta Was this translation helpful? Give feedback.
-
@Baccata I'd like to pull the conversation back here, so it doesn't get to scattered over multiple threads. I've thought about this a bit more, and I think a As of now it seems the One concern here would be that requiring people overriding Your PR #4621 is indeed how I imagined it would work. I haven't reviewed it thoroughly, but at a glance it all looks straightforward |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing a pain-point with respect to code-generation and sandboxing. I'm working on a project that colocates modules (let's call them
codegen
) containing code-generation logic with modules that use the generated code (let's call themmain
)The build is wired in such a way that
main
's generatedSources task shells out to thecodegen
mainclass (by means of Jvm.runSubprocess). It's all good and well, but the problem is that in order to produce IDE configuration (be that via GenIdea or Bloop), the generatedSources task has to be invoked, which implies compiling/running the codegen module.This makes the task of upgrading the libraries the
codegen
module depends on rather complicated, as source-breaking changes in these libraries are better tackled within the IDE, but I'm necessarily able to produce configuration for said IDE without compiling thecodegen
module if I've upgraded the libraries. Chicken-and-egg problem, so to say.In previous versions of mill, I was trying to be smart about it by having the generatedSources not actually run the code-generation, but rather just return a PathRef pointing within its dest, and have another task be responsible for writing within that dest.
Obviously this is not ideal, as
compile
will need to run twice for the pathrefs to stabilise, with newer versions of mill, this anti-pattern is no-longer possible, but the chicken-and-egg painpoint remains.Is there a more valid pattern that would would let us address this chicken-and-egg issue ?
Beta Was this translation helpful? Give feedback.
All reactions