Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addPluginSbtFile command #4211

Merged
merged 1 commit into from
Jun 19, 2018
Merged

addPluginSbtFile command #4211

merged 1 commit into from
Jun 19, 2018

Conversation

eed3si9n
Copy link
Member

Fixes #1502

This adds --addPluginSbtFile=<file> command, which adds the given .sbt file to the plugin build.
Using this mechanism editors or IDEs can start a build with required plugin.

$ cat /tmp/extra.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7")

$ sbt --addPluginSbtFile=/tmp/extra.sbt
...
sbt:helloworld> plugins
In file:/xxxx/hellotest/
  ...
  sbtassembly.AssemblyPlugin: enabled in root

/cc @jastice

@smarter
Copy link
Contributor

smarter commented Jun 18, 2018

@Duhemm Looks like this could replace https://github.com/scalacenter/load-plugin for the IDE usecase.

@eed3si9n
Copy link
Member Author

--addPluginSbtFile=<file> gets to the State before project loading (reload), so it by design does not require extra reloading, and also survives reload command issued by the build user.

sbt:helloworld> reload
[info] Loading settings for project global-plugins from vimquit.sbt,pgp.sbt ...
[info] Loading settings for project global-plugins from extra.sbt ...

Fixes sbt#1502

This adds `--addPluginSbtFile=<file>` command, which adds the given .sbt file to the plugin build.
Using this mechanism editors or IDEs can start a build with required plugin.

```
$ cat /tmp/extra.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7")

$ sbt --addPluginSbtFile=/tmp/extra.sbt
...
sbt:helloworld> plugins
In file:/xxxx/hellotest/
  ...
  sbtassembly.AssemblyPlugin: enabled in root
```
@jastice
Copy link
Contributor

jastice commented Jun 18, 2018

Nice!

@eed3si9n eed3si9n added this to the 1.2.0 milestone Jun 18, 2018
@eed3si9n eed3si9n merged commit 6fbb7f0 into sbt:1.x Jun 19, 2018
@eed3si9n eed3si9n deleted the wip/loadplugin branch June 19, 2018 02:35
@nafg
Copy link
Contributor

nafg commented Jun 19, 2018

Nice. Can it be set in .sbtopts?

@@ -96,6 +97,14 @@ $HelpCommand <regular expression>
The order is preserved between all early commands, so `sbt "early(a)" "early(b)"` executes `a` and `b` in order.
"""

def addPluginSbtFileHelp = {
val brief =
(s"--$AddPluginSbtFileCommand=<file>", "Adds the given *.sbt file to the plugin build.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't most options with a single dash (at least in the help)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The single line convention comes from Java, and since Java 9 is updating to more UNIX -- style, I am following the cargo cult.

jastice added a commit to jastice/sbt that referenced this pull request Jul 20, 2018
jastice added a commit to jastice/sbt that referenced this pull request Aug 23, 2018
eed3si9n added a commit that referenced this pull request Sep 20, 2018
[0.13] port sddPluginSbtFile command from #4211
@matt-leaguecio
Copy link

matt-leaguecio commented Apr 23, 2019

In IntelliJ i keep getting the following, it seems it doesn't support space in a folder specification. I can't find where to change the path:

"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=localhost:50825,suspend=n,server=y -Xdebug -server -Xmx1536M -Didea.managed=true -Dfile.encoding=UTF-8 -Dsbt.log.noformat=true -jar "C:\Users\Matt Ryan\.IntelliJIdea2019.1\config\plugins\Scala\launcher\sbt-launch.jar" "--addPluginSbtFile=C:\Users\Matt Ryan\AppData\Local\Temp\idea.sbt" "; set ideaPort in Global := 50780 ; idea-shell"
Listening for transport dt_socket at address: 50825
[error] Expected non-whitespace character
[error] --addPluginSbtFile=C:\Users\Matt Ryan\AppData\Local\Temp\idea.sbt

@jastice
Copy link
Contributor

jastice commented Apr 24, 2019

@matt-leaguecio Looks like a bug in the Scala plugin. I've created an issue:
https://youtrack.jetbrains.com/issue/SCL-15360

eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Nov 10, 2019
Ref sbt#4211
Fixes sbt#4395
Fixes sbt#4600

This is a reimplementation of `--addPluginSbtFile`. sbt#4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Nov 10, 2019
Ref sbt#4211
Fixes sbt#4395
Fixes sbt#4600

This is a reimplementation of `--addPluginSbtFile`. sbt#4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Nov 11, 2019
Ref sbt#4211
Fixes sbt#4395
Fixes sbt#4600

This is a reimplementation of `--addPluginSbtFile`. sbt#4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
eed3si9n added a commit to eed3si9n/sbt that referenced this pull request Nov 22, 2019
Ref sbt#4211
Fixes sbt#4395
Fixes sbt#4600

This is a reimplementation of `--addPluginSbtFile`. sbt#4211 implemented the command to load extra `*.sbt` files as part of the global plugin subproject. That had the unwanted side effects of not working when `.sbt/1.0/plugins` directory does not exist. This changes the strategy to load the `*.sbt` files as part of the meta build.

```
$ sbt -Dsbt.global.base=/tmp/hello/global --addPluginSbtFile=/tmp/plugins/plugin.sbt
[info] Loading settings for project hello-build from plugin.sbt ...
[info] Loading project definition from /private/tmp/hello/project
sbt:hello> plugins
In file:/private/tmp/hello/
	sbt.plugins.IvyPlugin: enabled in root
	sbt.plugins.JvmPlugin: enabled in root
	sbt.plugins.CorePlugin: enabled in root
	sbt.ScriptedPlugin
	sbt.plugins.SbtPlugin
	sbt.plugins.SemanticdbPlugin: enabled in root
	sbt.plugins.JUnitXmlReportPlugin: enabled in root
	sbt.plugins.Giter8TemplatePlugin: enabled in root
	sbtvimquit.VimquitPlugin: enabled in root
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants