scala-steward
scala-steward copied to clipboard
Support extracting dependencies from a YAML/JSON file
Hi,
We are using Steward for a while and it's very convenient. Though recently we started generating sbt projects (there are some things which are very hard to squeeze into plain sbt) and we don't want to keep them in the repository.
Would it be possible to implement a feature allowing us to keep all our dependencies in a YAML/JSON file in the root of our repository? So both Steward and our project generator may parse it.
The project in question: https://github.com/7mind/izumi, build.sbt is now generated by sbtgen script
If you want Scala Steward to update version numbers of your dependencies, you need to have a sbt project which depend on these dependencies. So if your script contains the same dependencies as defined in the sbt build, Scala Steward could then change both version numbers.
I'm doing something similar to keep Giter8 templates up-to-date and it could also be used to update Ammonite's ivy-imports.
If you want Scala Steward to update version numbers of your dependencies, you need to have a sbt project which depend on these dependencies.
I understand that, but it's very inconvenient as per I'm generating projects and there are many possible form of one project (different artifacts, different dependencies, etc)
Maybe it's possible to support declarative dependency data source, like a yaml file .scala-steward.yml in the root of the repository?
Scala Steward already support repository specific configuration in .scala-steward.conf.
https://github.com/fthomas/scala-steward/blob/master/docs/repo-specific-configuration.md
Maybe it's possible to extend that config with another section, like
dependencies {
better_files = "com.github.pathikrit%%better-files%3.8.0"
}
?
And it might also requires a new entry to configure which files should be updated, something like this:
additionalFilesToUpdate = [
{ path : "path/to/a/file.ext" },
{ pattern : ".md" }
]
In fact in my case it would be enough to have .scala-steward.conf itself updated. My project generator may parse it and take dependencies from there.
@pshirshov @neko-kai Now that https://github.com/7mind/izumi/issues/672 is closed, can this issue be closed, too?
We made a dirty workaround for our problems. But it would be really great if you may implement a feature like I described.
Maybe it's possible to support declarative dependency data source, like a yaml file .scala-steward.yml in the root of the repository?
This reminds me of @alexarchambault's deps which centralizes all dependencies and resolvers in a single deps.json which then can be used in sbt or Mill builds as source for dependencies. Since this issue has been opened, Scala Steward started supporting multiple build tools (sbt, Maven, and Mill). Supporting a build tool means extracting dependencies and resolvers from the build. The deps.json provides exactly that so it is not far fetched to use that as source for dependencies and resolvers and handle it like any other build tool in Scala Steward. The only thing required to support deps.json would be an implementation of the BuildToolAlg interface.