I would love if RenovateBot could work on SBT Scala builds (https://www.scala-sbt.org/) and renovate the build.sbt file of a project.
As for Maven, dependencies can be found on Maven central repository.
What changes from Maven is the way dependencies are declared which is not a declarative XML file but is plain Scala code.
Some sbt plugins already exist to upgrade dependencies. I didn't test them but maybe they could be reused or used a codebase:
Given a build.sbt file with this content:
// Scala dependency
libraryDependencies += "com.typesafe.play" %% "play-ws" % "2.6.10"
// Java dependency with test scope
libraryDependencies += "org.mockito" % "mockito-all" % "1.10.18" % Test
When I run RenovateBot
Then I would like to have a merge request with this content:
// Scala dependency
libraryDependencies += "com.typesafe.play" %% "play-ws" % "2.7.0"
// Java dependency with test scope
libraryDependencies += "org.mockito" % "mockito-all" % "1.10.19" % Test
The only thing to take care of is the fact that dependencies can be declared in multiple ways in the build.sbt file as it is itself a Scala file.
For instance, following content could be possible:
val myDependencyVersion: String = "2.6.10"
val myDependency: ModuleID = "com.typesafe.play" %% "play-json" % myDependencyVersion
libraryDependencies += myDependency
N/A
N/A
Sounds good! I think we can start with the most obvious format first and add others on demand. Is libraryDependencies a reserved term or can that vary per-project too?
Indeed, libraryDependencies is a reserved term.
I agree we can start with the most common format.
But please note that the following format is pretty common too (multiple dependencies declared at the same time):
libraryDependencies ++= Seq(
groupID % artifactID % revision,
groupID % otherID % otherRevision
)
Sbt documentation: https://www.scala-sbt.org/1.x/docs/Library-Dependencies.html (managed dependencies section).
I have no idea at all about how RenovateBot works.
If it uses some text parsing, maybe looking at the groupID % artifactID % revision or groupID %% artifactID % revision (notice the double %%) patterns is a good start.
Although more advanced declarations will be tricky to work with if just using parsing IMHO.
Would be glad to help if I can in any way ;)
@gaeljw thanks very much for this info. Do you think you could try filling out as much of this readme as possible for sbt/scala? You can submit it as a PR into lib/manager/sbt/readme.md. Even if it's still a WIP, we can use it as the basis for implementation. Please also check out other lib/manager/*/readme.md examples too, e.g. buildkite, bundler or cargo.
@rarkins Just initiated a PR for the README (https://github.com/renovatebot/renovate/pull/3458).
Answering all the questions of the README make me say it won't be as easy as I could think in the first place.. lot of cases to cover. I'm not even sure I know all ways sbt can be used. But I described what I know, which is I hope the most common ways sbt is used.
Maybe it will be helpful to take a look at the approach used in aiyanbo/sbt-dependency-updates. It has the dependencyUpgrade task that actually upgrades project's dependencies. But it requires dependencies to be specified in a more strict format within a special project/Dependencies.scala file which is then referenced in the main build.sbt. The need to move dependencies to a separate file is a fairly low price for the ability to update them automatically.
Another example is https://github.com/fthomas/scala-steward
Scala-Steward looks interesting, maybe we could look at how they work and even discuss with them as this could be part of Renovate :thinking:
Updated status:
Todo:
:tada: This issue has been resolved in version 16.9.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Most helpful comment
Another example is https://github.com/fthomas/scala-steward