From ea7fceb6e56f53bde3517586dfc57e10a605a524 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Wed, 12 Dec 2018 22:15:38 +0800 Subject: First pass at splitting out worker-api from mill core. (#504) This reduces the {scala,scalajs,scalanative}-worker dependency from the entirety of Mill to a much narrower `mill.api` module. This reduces the amount of classpath pollution within these workers, should mean they're much faster to download the first time, and reduces the amount of random junk they would pull in if they were to be used outside of the Mill project. The interactions between the various *Modules and their *WorkerImpls has been narrowed down to the `*.api` modules, which only depend on other `*.api` modules. A lot of things have been moved around; user code is unlikely to break, but it's possible some will if it references classes that have been moved around. Forwarders have been left for the few internal classes that Mill uses in it's own `build.sc`, to support bootstrapping. Third-party code which breaks should be a straightforward to fix just by updating imports The `*.api` modules have minimal dependencies (mostly uPickle and os-lib) and minimal code. There is still a bunch of implementation code in there: some of it defining data-types that are commonly sent across the module/worker interface (`Agg`, `PathRef`, ...), and some of it just general helper functions that are needed both in modules and workers. The latter code isn't strictly API definitions, but for now is small enough it's not worth splitting into it's own module --- .../worker/0.6/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala | 6 +++--- .../worker/1.0/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'scalajslib/worker') diff --git a/scalajslib/worker/0.6/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala b/scalajslib/worker/0.6/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala index 7c30ece9..64b668e5 100644 --- a/scalajslib/worker/0.6/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala +++ b/scalajslib/worker/0.6/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala @@ -4,7 +4,7 @@ package worker import java.io.File -import mill.eval.Result +import mill.api.Result import org.scalajs.core.tools.io.IRFileCache.IRContainer import org.scalajs.core.tools.io._ import org.scalajs.core.tools.jsdep.ResolvedJSDependency @@ -13,8 +13,8 @@ import org.scalajs.core.tools.logging.ScalaConsoleLogger import org.scalajs.jsenv._ import org.scalajs.jsenv.nodejs._ import org.scalajs.testadapter.TestAdapter - -class ScalaJSWorkerImpl extends mill.scalajslib.ScalaJSWorkerApi { +import mill.scalajslib.api.{ModuleKind, NodeJSConfig} +class ScalaJSWorkerImpl extends mill.scalajslib.api.ScalaJSWorkerApi { def link(sources: Array[File], libraries: Array[File], dest: File, diff --git a/scalajslib/worker/1.0/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala b/scalajslib/worker/1.0/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala index 45795271..f40f7a6b 100644 --- a/scalajslib/worker/1.0/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala +++ b/scalajslib/worker/1.0/src/mill/scalajslib/worker/ScalaJSWorkerImpl.scala @@ -3,8 +3,8 @@ package scalajslib package worker import java.io.File - -import mill.eval.Result +import mill.scalajslib.api.{ModuleKind, NodeJSConfig} +import mill.api.Result import org.scalajs.core.tools.io._ import org.scalajs.core.tools.linker.{ModuleInitializer, Semantics, StandardLinker, ModuleKind => ScalaJSModuleKind} import org.scalajs.core.tools.logging.ScalaConsoleLogger @@ -12,7 +12,7 @@ import org.scalajs.jsenv.ConsoleJSConsole import org.scalajs.jsenv.nodejs._ import org.scalajs.testadapter.TestAdapter -class ScalaJSWorkerImpl extends mill.scalajslib.ScalaJSWorkerApi { +class ScalaJSWorkerImpl extends mill.scalajslib.api.ScalaJSWorkerApi { def link(sources: Array[File], libraries: Array[File], dest: File, -- cgit v1.2.3