- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Option to extend Plug-in Classpaths?
Fri, 2011-12-16, 10:37
Hi,
I have a compiler plug-in that has a dependency on a third-party jar,
so I somehow need to get that onto the classpath for the plug-in. When
using scalac directly, I can use the "toolcp" option, but from what I
can see, this option is only used in the shell script:
misto@pin6108475 ~/repos/scala 0 (2.9.x)
% ack toolcp
src/compiler/scala/tools/ant/templates/tool-unix.tmpl
131: -toolcp)
src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
30: val toolcp = PathSetting("-toolcp", "Add to the runner classpath.", "")
Is there any other way to get something on the plug-in's classpath? In
particular I need a way that also works with SBT, because ultimately
the compiler plug-in is used in the Scala IDE. My current workaround
is to also add the jar dependeny as a plug-in, which works but results
in a compiler warning.. :-)
In the compiler, plug-ins are loaded like this:
val compilerLoader = classOf[Plugin].getClassLoader
val jarurls = jarfiles map (_.toURL)
new URLClassLoader(jarurls.toArray, compilerLoader)
Could we simply add the "toolcp" to this classloader?
Cheers,
Mirko
Fri, 2011-12-16, 11:11
#2
Re: Option to extend Plug-in Classpaths?
Hi Grzegorz
On Fri, Dec 16, 2011 at 10:44, Grzegorz Kossakowski
wrote:
> What about packaging dependency into plug-in jar? Sort of what sbt-assembly
> plug-in does.
Hm, yes that would be another (better) option right now. The question
is, should there be a way to extend the plug-in classpath or are "fat
plugins" preferred?
Cheers,
Mirko
Fri, 2011-12-16, 15:31
#3
Re: Option to extend Plug-in Classpaths?
On Fri, Dec 16, 2011 at 1:58 AM, Mirko Stocker wrote:
> Hm, yes that would be another (better) option right now. The question
> is, should there be a way to extend the plug-in classpath or are "fat
> plugins" preferred?
https://issues.scala-lang.org/browse/SI-4841
I haven't applied the patch because I am attempting to avoid sprouting
any more ad-hoc mechanisms for manipulating the classpath in favor of
a more uniform mechanism.
Fri, 2011-12-16, 15:51
#4
Re: Option to extend Plug-in Classpaths?
On Friday 16 December 2011 06:28:07 Paul Phillips wrote:
> I haven't applied the patch because I am attempting to avoid sprouting
> any more ad-hoc mechanisms for manipulating the classpath in favor of
> a more uniform mechanism.
Oh, I missed that ticket.. thanks!
What about packaging dependency into plug-in jar? Sort of what sbt-assembly plug-in does.
--
Grzegorz Kossakowski