Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties are not resolved #11

Closed
kierendavies opened this issue Sep 6, 2022 · 1 comment · Fixed by #12
Closed

Properties are not resolved #11

kierendavies opened this issue Sep 6, 2022 · 1 comment · Fixed by #12
Labels
bug Something isn't working

Comments

@kierendavies
Copy link

My default.properties contains these lines:

name=My New Service
module=$name;format="lower,word"$
package=com.zivver.$module$

which results in this output:

$ mill g8.validate
[2/6] g8.generate.overridden.io.kipp.mill.giter8.G8Module.generate
Ignoring unrecognized parameter: module=$name;format
Template applied in [...]

and sets the package property to literally com.zivver.$module$ instead of com.zivver.mynewservice.

G8Module.generate calls G8.transformProps, but all that does is apply Maven version lookups. When it then passes the arguments to G8.fromDirectory, they are treated as literal and they are not resolved. Giter8 itself usually does a more complicated thing which seems to always boil down to applyTemplate.

G8.fromDirectory skips the interactive prompt if at least one property is passed as an argument. I suggest passing just the first property, since it generally ought to be a literal (or is required to be? I'm not sure).

@ckipp01
Copy link
Owner

ckipp01 commented Sep 7, 2022

Hey @kierendavies, thanks a lot for the report!

G8Module.generate calls G8.transformProps, but all that does is apply Maven version lookups. When it then passes the arguments to G8.fromDirectory, they are treated as literal and they are not resolved. Giter8 itself usually does a more complicated thing which seems to always boil down to applyTemplate.

Thanks a lot for digging in and linking all this. 🤔 I'll have to think a bit more about the best way to approach/fix this.

@ckipp01 ckipp01 added the bug Something isn't working label Sep 7, 2022
ckipp01 added a commit that referenced this issue Sep 10, 2022
Prior to this change only the maven properties were actually resolved
leaving the rest not. This would cause for example `$package$` to end up
being generated as `$package`. Now we ensure everything that we can is
resolved by mimicking the way it's done in the sbt plugin.

NOTE: I still plan on improving this a bit by allowing the user to pass
in values to validate/generate which can be used to generate with
specific values.

Closes #11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants