These are chat archives for sbt/sbt

19th
Jun 2015
Dale Wijnand
@dwijnand
Jun 19 2015 14:17

Would be nice if you could just exec an arbitrary plugin's task from the command line.
Say something like

mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy-dependencies

but for sbt-dependency-graph's dependencyDot without having to add it to global or local plugins.sbt

eugene yokota
@eed3si9n
Jun 19 2015 15:32
finally going to spend some time looking into Scala version bump issue (#1980) myself
Dale Wijnand
@dwijnand
Jun 19 2015 16:33
:+1:
eugene yokota
@eed3si9n
Jun 19 2015 19:06

when I do

bridge.getClass.getMethods foreach { x => println(x) }
public void sbt.test.ScriptedRunner.run6(java.io.File,boolean,java.lang.String[],java.io.File,java.lang.String[],scala.Function1)

I see the method, but it's unable to call it via structural:

[error] (sbtRoot/*:scripted) java.lang.NoSuchMethodException: sbt.test.ScriptedRunner.run6(java.io.File, boolean, [Ljava.lang.String;, java.io.File, [Ljava.lang.String;, scala.Function1)
eugene yokota
@eed3si9n
Jun 19 2015 20:06

it seems like scala.Function1 created in one classloader is unable to cast itself into scala.Function1 running in the build

[error] (sbtRoot/*:scripted) java.lang.ClassCastException: $974bcbbdd2f1a32e3ad5$$anonfun$otherRootSettings$1$$anonfun$apply$11 cannot be cast to scala.Function1

/cc @jsuereth

I've put in scala.version := "2.10.5" in project/p.sbt
Josh Suereth
@jsuereth
Jun 19 2015 20:24
which classloader?
You're probably not sharing the scala library between them
eugene yokota
@eed3si9n
Jun 19 2015 20:25
one of them is coming from
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
  val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
  publishAll.value
  doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
    (scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
}
Josh Suereth
@jsuereth
Jun 19 2015 20:25
"share" => parent classloader
yeah, what's up with "doScripted"
eugene yokota
@eed3si9n
Jun 19 2015 20:26
the other is the classloader used by project/Scripted.scala
Josh Suereth
@jsuereth
Jun 19 2015 20:26
and where is the class coming from
eugene yokota
@eed3si9n
Jun 19 2015 20:26
it's basically trying to access scripted built using the build from the build
so the usual
try { r.invoke(bridge, sourcePath, true: java.lang.Boolean, args.toArray[String], launcher, launcherVmOptions, prescripted) }
catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause }
Josh Suereth
@jsuereth
Jun 19 2015 20:27
That should be ok, generally, if you stick to java-only interfaces (like a mina method)
Ohhhh, nice
SO because you're using a different scala version, the shared classlaoder thign deosn't kick in
so scala.Function1 is literally a different classfile
eugene yokota
@eed3si9n
Jun 19 2015 20:28
well I tried to align them, but it didn't seem to stick
Josh Suereth
@jsuereth
Jun 19 2015 20:28
how?
eugene yokota
@eed3si9n
Jun 19 2015 20:28
so I am thinking about using java.util.List
Josh Suereth
@jsuereth
Jun 19 2015 20:28
it was shared by accident before
Sure, but I'd guess it's the "presecripted" thing that's the issue
eugene yokota
@eed3si9n
Jun 19 2015 20:28
by putting in scalaVersion := "2.10.5", but yea
it's likely that
Josh Suereth
@jsuereth
Jun 19 2015 20:28
Yeah, so the classpath for the build isn't normal
eugene yokota
@eed3si9n
Jun 19 2015 20:29
java.util.List<E> has add method, which seems close enough to apply
lol. it worked like a charm.
    try {
      bridge.run6(sourcePath, true, args.toArray, launcher, launcherVmOptions, 
        new java.util.AbstractList[File] {
          override def add(x: File): Boolean = {
            prescripted(x)
            false
          }
          def get(x: Int): sbt.File = ???
          def size(): Int = 0
        })
    } catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause }
Running actions / add-alias
[success] Total time: 18 s, completed Jun 19, 2015 4:32:36 PM
Josh Suereth
@jsuereth
Jun 19 2015 20:53
nice
I <3 binary compatibility
and classloader magikz
eugene yokota
@eed3si9n
Jun 19 2015 20:53
do you want to nominate alt reviewer besides @dwijnand?
Josh Suereth
@jsuereth
Jun 19 2015 20:54
Nah, do you want me to review? i have like 10 min
then I'm ALMOST on vacatoin (packing first)
eugene yokota
@eed3si9n
Jun 19 2015 20:54
are you gone for a 1wk or a 1day?
here's the PR - sbt/sbt#2068
Josh Suereth
@jsuereth
Jun 19 2015 21:03
1 week + 1 day
Dominik Dorn
@domdorn
Jun 19 2015 22:49
anyone here with some sbt-multi-project experience ? I feel I'm going crazy here.