diff options
Diffstat (limited to 'main/src/mill/modules')
-rw-r--r-- | main/src/mill/modules/Jvm.scala | 9 | ||||
-rw-r--r-- | main/src/mill/modules/Util.scala | 31 |
2 files changed, 10 insertions, 30 deletions
diff --git a/main/src/mill/modules/Jvm.scala b/main/src/mill/modules/Jvm.scala index 8d2c4de4..1a51ed8b 100644 --- a/main/src/mill/modules/Jvm.scala +++ b/main/src/mill/modules/Jvm.scala @@ -13,7 +13,8 @@ import coursier.util.{Gather, Task} import geny.Generator import mill.main.client.InputPumper import mill.eval.{PathRef, Result} -import mill.util.{Ctx, IO} +import mill.util.Ctx +import mill.api.IO import mill.util.Loose.Agg import scala.collection.mutable @@ -165,15 +166,15 @@ object Jvm { val urls = classPath.map(_.toIO.toURI.toURL) val cl = if (classLoaderOverrideSbtTesting) { val outerClassLoader = getClass.getClassLoader - mill.util.ClassLoader.create(urls.toVector, null, customFindClass = { name => + mill.api.ClassLoader.create(urls.toVector, null, customFindClass = { name => if (name.startsWith("sbt.testing.")) Some(outerClassLoader.loadClass(name)) else None }) } else if (isolated) { - mill.util.ClassLoader.create(urls.toVector, null) + mill.api.ClassLoader.create(urls.toVector, null) } else { - mill.util.ClassLoader.create(urls.toVector, getClass.getClassLoader) + mill.api.ClassLoader.create(urls.toVector, getClass.getClassLoader) } val oldCl = Thread.currentThread().getContextClassLoader diff --git a/main/src/mill/modules/Util.scala b/main/src/mill/modules/Util.scala index 2f57595e..2b98a304 100644 --- a/main/src/mill/modules/Util.scala +++ b/main/src/mill/modules/Util.scala @@ -2,8 +2,9 @@ package mill.modules import coursier.Repository -import mill.eval.PathRef -import mill.util.{Ctx, IO, Loose} +import mill.api.{PathRef, IO} +import mill.util.{Ctx, Loose} + object Util { def cleanupScaladoc(v: String) = { @@ -42,31 +43,9 @@ object Util { val tmpName = if (dest == os.rel / "tmp.zip") "tmp2.zip" else "tmp.zip" val downloaded = download(url, tmpName) - unpackZip(downloaded.path, dest) + IO.unpackZip(downloaded.path, dest) } - def unpackZip(src: os.Path, dest: os.RelPath = "unpacked") - (implicit ctx: Ctx.Dest) = { - - val byteStream = os.read.inputStream(src) - val zipStream = new java.util.zip.ZipInputStream(byteStream) - while({ - zipStream.getNextEntry match{ - case null => false - case entry => - if (!entry.isDirectory) { - val entryDest = ctx.dest / dest / os.RelPath(entry.getName) - os.makeDir.all(entryDest / ammonite.ops.up) - val fileOut = new java.io.FileOutputStream(entryDest.toString) - IO.stream(zipStream, fileOut) - fileOut.close() - } - zipStream.closeEntry() - true - } - })() - PathRef(ctx.dest / dest) - } def millProjectModule(key: String, artifact: String, @@ -75,7 +54,7 @@ object Util { artifactSuffix: String = "_2.12") = { val localPath = sys.props(key) if (localPath != null) { - mill.eval.Result.Success( + mill.api.Result.Success( Loose.Agg.from(localPath.split(',').map(p => PathRef(os.Path(p), quick = true))) ) } else { |