On Thu, 21 Jun 2012 15:06:33 -0700 (PDT)
Sandro Gržičić <
serio...@gmail.com> wrote:
> Hello!
>
> So, in short: my GSoC project this summer is the integration of SBT inside
> ScalaIDE (Eclipse). I'm going to create a custom console for SBT, which
> will have all sorts of nice features.
>
> Anyway, right now I'm wondering what would be the best way to actually
> integrate SBT. The only other SBT integrated console that I know of - the
> SBT Console for IDEA - seems to be using the java.lang.ProcessBuilder class
> in order to host the SBT process inside the IDEA SBT console. This is
> obviously doable as well inside Eclipse, but I was looking for a better
> option. I want to be able to somehow interact with SBT itself, not just
> attach to its input/output streams.
>
> So, is there any sort of support for doing this - running SBT and
> programatically hooking into the spawned SBT instance - or should I forget
> about it and just use it as a dumb process? I'm really hoping against doing
> the latter. :)
>
> If some minimal support for this exists or is in the making, but requires
> someone to write proper support and generate a pull request, I'm definitely
> the person for that as well. I've already gone through SBT's source (it has
> a very .. interesting .. structure :D) but I haven't been able to find
> anything useful (besides API calls for instantiating a new Scala REPL, or
> evaling some code). Maybe there's already mostly complete support for this
> kind of thing, but I haven't been able to find it yet.
You will probably want to fork sbt as a separate process to isolate eclipse from sbt, but it doesn't need to be a dumb process. I would write an sbt Command that listens on a local socket for instructions from the main Eclipse code, schedules commands, and provides information back to the Eclipse code. You would start sbt like 'sbt custom-command'. For more on Commands, see:
https://github.com/harrah/xsbt/wiki/Commands
See also the implementation of the interactive prompt (called 'shell') and the '<' command, which can read commands over the loopback interface.
> What I'd like to achieve with this is at least some proper output syntax
> highlighting, preferably with clickable links in stacktraces - most of the
> hard work will be done by myself I believe, but it would be nice if I could
> query SBT for the currently loaded classes, etc. Also, as I understand, SBT
> has a graph-like representation of the currently loaded classes when a
> project is loaded, so I think that this could be used to generate a visual
> graph using (for example) JUNG. There are definitely more things that could
> be accomplished by directly using SBT API calls.
Can you clarify what you mean by currently loaded classes? Do you meant the classes used to define the build or application classes or what?
-Mark
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/simple-build-tool/-/CAPhQu84ZeQJ.
> To post to this group, send email to
simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
simple-build-t...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/simple-build-tool?hl=en.
>