From 14db8c207928281208cf55a1c7fa27552d3d24d3 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 7 Dec 2009 19:02:30 -0500 Subject: [PATCH] Correct classpath for plugins --- launch/Launch.scala | 1 + launch/Provider.scala | 4 +++- launch/interface/src/main/java/xsbti/AppProvider.java | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/launch/Launch.scala b/launch/Launch.scala index c0e10b3a7..cdedf715b 100644 --- a/launch/Launch.scala +++ b/launch/Launch.scala @@ -110,6 +110,7 @@ class Launch(val bootDirectory: File, repositories: List[Repository]) extends xs def target = new UpdateApp(Application(id)) def failLabel = id.name + " " + id.version def lockFile = updateLockFile + def mainClasspath = classpath lazy val mainClass: Class[T] forSome { type T <: xsbti.AppMain } = { diff --git a/launch/Provider.scala b/launch/Provider.scala index 365c2b2d4..c0ada0394 100644 --- a/launch/Provider.scala +++ b/launch/Provider.scala @@ -15,6 +15,8 @@ trait Provider extends NotNull def parentLoader: ClassLoader def lockFile: File + def classpath = Provider.getJars(baseDirectories) + def retrieveFailed: Nothing = fail("") def retrieveCorrupt(missing: Iterable[String]): Nothing = fail(": missing " + missing.mkString(", ")) private def fail(extra: String) = @@ -44,7 +46,7 @@ trait Provider extends NotNull } def createLoader = { - val jars = Provider.getJars(baseDirectories) + val jars = classpath (jars, new URLClassLoader(jars.map(_.toURI.toURL), parentLoader) ) } } diff --git a/launch/interface/src/main/java/xsbti/AppProvider.java b/launch/interface/src/main/java/xsbti/AppProvider.java index 33818b855..8fdafe32f 100644 --- a/launch/interface/src/main/java/xsbti/AppProvider.java +++ b/launch/interface/src/main/java/xsbti/AppProvider.java @@ -1,5 +1,7 @@ package xsbti; +import java.io.File; + public interface AppProvider { /** Returns the ScalaProvider that this AppProvider will use. */ @@ -13,6 +15,9 @@ public interface AppProvider /** Creates a new instance of the entry point of the application given by 'id'. * It is guaranteed that newMain().getClass() == mainClass()*/ public AppMain newMain(); + + /** The classpath from which the main class is loaded, excluding Scala jars.*/ + public File[] mainClasspath(); public ComponentProvider components(); }