diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/mill/util/ClassLoader.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/mill/util/ClassLoader.scala b/core/src/mill/util/ClassLoader.scala new file mode 100644 index 00000000..7f4a9836 --- /dev/null +++ b/core/src/mill/util/ClassLoader.scala @@ -0,0 +1,12 @@ +package mill.util + +import java.net.{URL, URLClassLoader} + +import io.github.retronym.java9rtexport.Export + +object ClassLoader { + def create(urls: Seq[URL], parent: java.lang.ClassLoader): URLClassLoader = { + val rtOpt = if (ammonite.util.Util.java9OrAbove) Some(Export.export().toURI.toURL) else None + new URLClassLoader((urls ++ rtOpt).toArray, parent) + } +} |