diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-25 18:08:07 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-25 18:08:07 -0700 |
commit | b659cb97f58a3d7be641f94885c940375b1aa23f (patch) | |
tree | 3d3b6a49ec1dac104c01de824dc217a88c0391de /main/src | |
parent | 664686bf91b076a47efc4ac8c4928f599293ee3b (diff) | |
parent | f45f11b88fe00ea6fecb44e7da0aadbfffd01b25 (diff) | |
download | mill-b659cb97f58a3d7be641f94885c940375b1aa23f.tar.gz mill-b659cb97f58a3d7be641f94885c940375b1aa23f.tar.bz2 mill-b659cb97f58a3d7be641f94885c940375b1aa23f.zip |
Merge branch 'master' of github.com:lihaoyi/mill
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/mill/modules/Jvm.scala | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/main/src/mill/modules/Jvm.scala b/main/src/mill/modules/Jvm.scala index 9c63d108..92469988 100644 --- a/main/src/mill/modules/Jvm.scala +++ b/main/src/mill/modules/Jvm.scala @@ -103,19 +103,16 @@ object Jvm { classLoaderOverrideSbtTesting: Boolean, body: ClassLoader => T) (implicit ctx: Ctx.Home): T = { + val urls = classPath.map(_.toIO.toURI.toURL) val cl = if (classLoaderOverrideSbtTesting) { val outerClassLoader = getClass.getClassLoader - new URLClassLoader(classPath.map(_.toIO.toURI.toURL).toArray, mill.util.ClassLoader.create(Seq(), null)){ - override def findClass(name: String) = { - if (name.startsWith("sbt.testing.")){ - outerClassLoader.loadClass(name) - }else{ - super.findClass(name) - } - } - } + mill.util.ClassLoader.create(urls.toVector, null, customFindClass = { name => + if (name.startsWith("sbt.testing.")) + Some(outerClassLoader.loadClass(name)) + else None + }) } else { - mill.util.ClassLoader.create(classPath.map(_.toIO.toURI.toURL).toVector, null) + mill.util.ClassLoader.create(urls.toVector, null) } val oldCl = Thread.currentThread().getContextClassLoader Thread.currentThread().setContextClassLoader(cl) |