summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-02 10:23:12 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-02 10:23:12 -0800
commit4d79af93f907264a16abe3661ea417a268b0ef67 (patch)
tree54d2cfd7e7ba63121eb2f733733876249fe3838f /core/src
parentf1153f8fff92be3711fd238cd2c7c06ac2a7a5bc (diff)
downloadmill-4d79af93f907264a16abe3661ea417a268b0ef67.tar.gz
mill-4d79af93f907264a16abe3661ea417a268b0ef67.tar.bz2
mill-4d79af93f907264a16abe3661ea417a268b0ef67.zip
Move `ScalaWorkerApi`/`ScalaJSBridge` over to new `ExternalModule` class
Also add a simple unit to validate that you can use `ExternalModule`s as part of a build, and that the
Diffstat (limited to 'core/src')
-rw-r--r--core/src/mill/define/Module.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/src/mill/define/Module.scala b/core/src/mill/define/Module.scala
index 09e8e974..11a98d95 100644
--- a/core/src/mill/define/Module.scala
+++ b/core/src/mill/define/Module.scala
@@ -95,10 +95,9 @@ object BaseModule{
class BaseModule(basePath0: Path)
(implicit millModuleEnclosing0: sourcecode.Enclosing,
millModuleLine0: sourcecode.Line,
- millName0: sourcecode.Name,
- overrides0: Overrides)
+ millName0: sourcecode.Name)
extends Module()(
- mill.define.Ctx.make(implicitly, implicitly, implicitly, BasePath(basePath0), Segments(), implicitly)
+ mill.define.Ctx.make(implicitly, implicitly, implicitly, BasePath(basePath0), Segments(), Overrides(0))
){
// A BaseModule should provide an empty Segments list to it's children, since
// it is the root of the module tree, and thus must not include it's own
@@ -107,4 +106,16 @@ class BaseModule(basePath0: Path)
override def basePath = millOuterCtx.basePath
override implicit def millModuleBasePath: BasePath = BasePath(basePath)
implicit def millImplicitBaseModule: BaseModule.Implicit = BaseModule.Implicit(this)
+}
+
+class ExternalModule(implicit millModuleEnclosing0: sourcecode.Enclosing,
+ millModuleLine0: sourcecode.Line,
+ millName0: sourcecode.Name) extends BaseModule(ammonite.ops.pwd){
+ assert(
+ !" #".exists(millModuleEnclosing0.value.contains(_)),
+ "External modules must be at a top-level static path, not " + millModuleEnclosing0.value
+ )
+ override implicit def millModuleSegments = {
+ Segments(millModuleEnclosing0.value.split('.').map(Segment.Label):_*)
+ }
} \ No newline at end of file