Closed blast-hardcheese closed 9 months ago
I don't love the <module>
syntax there, making users type out fully-qualified class names. I think we could do some things here to simplify:
dev.guardrail.generators.{language}.{generator-name}.Interp
(or something). Then a user would only have to specify {generator-name}
and we'd fill in the rest. If we see a FQCN, then we use it as is.Option 1 feels kind of like how Gradle handles plugin registration, I'm not super thrilled about the lack of flexibility.
I think 2 makes sense, and kind of parallels how openapi-parser registers classpath transformers. I'm not super thrilled with adding the mapping files into the core modules though.
What about having the mapping done in the plugin itself, exposing short names but giving the user the opportunity to specify FQCNs only if they truly need something custom?
Option 1 feels kind of like how Gradle handles plugin registration, I'm not super thrilled about the lack of flexibility.
How is that not flexible? It's a shortcut for the generators we distribute, but we'd still accept FQCNs in that spot for third-party things that don't conform to the 'standard' naming.
What about having the mapping done in the plugin itself, exposing short names but giving the user the opportunity to specify FQCNs only if they truly need something custom?
I'd rather not; this just means we have the same list in three places that will need to be updated.
Yes 🙌. That is all ☺️. Let me know if there is grunt work you would like done. I'm happy to participate!
Good progress! #1280 actually works
Repackaging notes, for people implementing against guardrail internals: https://gist.github.com/blast-hardcheese/1c4dcfe2151510dfc87ec8e384d87cd1
So, with 1.0.0-SNAPSHOTs being published and everything working reasonably well, I think it's fair to close this out. 🎉
Problem
Currently, guardrail has no explicit library dependencies brought into consuming projects, permitting users to supply their own implementations that satisfy source compatibility. This is a core design goal of guardrail, and one that I aim to maintain.
One challenge, however, is that any change to any source generators for any language necessitates a version bump for the whole project, leading to unnecessary upgrade PRs and work for users, for explicitly no benefit.
Explicitly, a user who only uses Scala source generators should not have to bump guardrail if only the Java generators have changed, and vice versa.
Proposed solution
Core guardrail repo
The
guardrail
project will be further modularized, instead of emittingwe will instead release
where each individual module has its own
version.sbt
, distinct fromguardrail-core
.As it stands today, this will end up with the following:
Build tools (sbt)
For
sbt-guardrail
, this will have two ramifications.First, the
modules
configuration will move into sbt-guardrail.Instead of:
we would instead have:
where a proof-of-concept of how the modules might be implemented being
with
sbt-guardrail
depending on all known guardrail-published modules using theProvided
scope.GuardrailModules
being a special type, similar to the magnet pattern, wherein the following implicit conversions would be supplied:which has the additional benefit of permitting ad-hoc extensions of guardrail functionality:
... or for extensions to core functionality to be released as a library itself and depended on:
Build tools (maven)
Similar to sbt, maven would utilize runtime class loading from fully-qualified class names (FQCN) in order to describe modules, with modular dependencies specified such that they would be available to
generate-sources
:This would reduce the need to release the guardrail-maven-plugin to only ABI-incompatible releases, again similar to the sbt plugin, with guardrail module updates being opened against the section under the
plugin directly.
Build tools (gradle)
Presumably the changes to the gradle plugin will be somewhere between the sbt and maven changes, but I really don't have much confidence in my ability to design around gradle at this time.
TL;DR
I believe it would be better for users if...
I believe it would be better for maintainers if...