Add scripted as library dependency for builds of sbt plugins
See original GitHub issueproblem
Sbt plugins have only one way of being tested: scripted. Scripted is used by almost any sbt plugin in the world. Yet, every sbt plugin has to bring the scripted plugin dependency manually.
Shortcomings:
- Users need to get the scripted library from the docs every time they create a new plugin:
libraryDependencies += { "org.scala-sbt" % "scripted-plugin" % sbtVersion.value }
. - Users need to reload their build once the dependency has been added.
expectation
It would be nice if scripted
is added automatically for those builds for which sbtPlugin := true
. I’m proposing to internalize the scripted plugin inside the sbt repo in a similar way IvyPlugin
and others are.
My goal with this is to make it easier for devs to define sbt plugins. Those builds that already specify the scripted library dependency will use the specified plugin instead of the “internalized” one.
I cannot think of any reason why this hasn’t been done before, but I believe it’s a good moment to do it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How can I add a dependency to my sbt plugin? - Stack Overflow
I would like to add a library that I am going to use within the code of my SBT-Plugin. I did ... sbtPlugin...
Read more >sbt Reference Manual — Plugins
Project dependencies can be declared in project/plugins.sbt (similarly to build.sbt file in a normal project) and will be available to the build definitions....
Read more >How to setup the SBT Scripted Test Framework
This just adds the scripted plugin as a dependency to your project. Create a file named scripted.sbt with the following content:.
Read more >Chapter 11. Defining a plugin - sbt in Action - liveBook · Manning
sbt will then add the necessary dependencies and settings to your project so that the project will be packaged and distributed as a...
Read more >sbt/sbt - Gitter
When I add import io.getquill.codegen.jdbc.SimpleJdbcCodegen to build.sbt (after adding quill-codegen-jdbc as a library dependency in the project's build) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was thinking of porting my improvements from the scripted sbt suite to the scripted plugin (to get batch and parallel execution). If you say that this requires us to port the scripted plugin inside the
SbtPlugin
plugin, I can do both changes at once.If you like this approach, let me know and I’ll open a PR.
This is simply not true. I have a totally different way of testing sbt plugins, which results in much faster turnarounds, because it does not need to reload a new sbt instance for every single test. The idea is to have the build include the sources of the sbt plugin it defines, and have projects in the build itself that test the sbt plugin.
See for example how it’s done in sbt-dynscalajs:
Please don’t add non-essential dependencies to sbt plugins.
Also, who knows, maybe one day someone will come up with another way to test sbt plugins, which would compete with scripted. In that case, the extra dependency would be even more annoying. Consider that automatically depending on scripted is similar to automatically depending on ScalaTest for regular Scala projects. No one wants that.