akka-js / shocon

Simple pure-scala Typesafe HOCON implementation using FastParse
Apache License 2.0
74 stars 21 forks source link

build.sc/mill and shoconConcat #47

Open larsjaas opened 5 years ago

larsjaas commented 5 years ago

I've ditched sbt for mill. I'm now wondering how to use shocon in a project, the shoconConcat-task in particular. Is mill supported? Will I need to keep a build.sbt file around for that purpose?

andreaTP commented 5 years ago

Hi @larsjaas ! a couple of things to say, shocon itself can be used without the sbt-plugin, what you need to do is to make the configuration files available before the compilation task starts (and macros are resolved). An example of doing it is here: https://github.com/akka-js/shocon/blob/master/build.sbt#L29 Other than that I think it's pretty straight forward to re-implement this logic ( https://github.com/akka-js/shocon/blob/master/plugin/src/main/scala/org/akkajs/shocon/sbtplugin/ShoconPlugin.scala#L83 ) in as a Mill task.

WDYT?

larsjaas commented 5 years ago

Yeah, I doubt it's very difficult, just wondered if I had overlooked a ready-made solution. I'll see what I figure out as I get more familiar with mill, and follow up in this thread if I produce anything that would be of interest to others.

andreaTP commented 5 years ago

great, thanks! :+1:

larsjaas commented 5 years ago

Made some progress. Got a working 'shoconConcat' target task hooked up, and I'm able to read config values in my project (didn't find the typesafe shim mentioned in the readme, but Config.fromFile() covered my needs). I still need to inject the task as a compile/run-dependency, and preferably also not have to specify the mill-specific full path of the generated shocon.conf file when reading the file.

andreaTP commented 5 years ago

Great to hear! I would love to have a PR with a Readme update about the process if you can!