question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add scripted as library dependency for builds of sbt plugins

See original GitHub issue

problem

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:

  1. 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 }.
  2. 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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
jvicancommented, Oct 20, 2017

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.

2reactions
sjrdcommented, Jan 21, 2018

Sbt plugins have only one way of being tested: scripted.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found