Replies: 1 comment 4 replies
-
If your only concern is the size of the One caveat though, you can't instantiate modules in these other script files. Instead you may need to just declare them as // file: a/Modules.sc
trait a extends Module {
object aa extends ScalaModule {
}
}
// file: b/Modules.sc
import $file.^.a.{Modules => A}
trait b extends Module {
// abstract reference to external module
def a: A.a
object bb extends ScalaModule {
// use the still abstract reference to external modules
def moduleDeps = Seq(a.aa)
}
}
// file: build.sc
import $file.a.{Modules => A}
import $file.b.{Modules => B}
object a extends A.a
object b extends B.b {
override def a = a
} This looks a bit complicated and it is. But it's also in reach with what's possible with current mill. Because of the limitations you described, I never even tried to use mill's foreign module concept. |
Beta Was this translation helpful? Give feedback.
-
I'm working on a monorepo which has a few projects which need to interact, but where developers mostly work on one project day-to-day. So far, everything has been configured in one
build.sc
at the root of all projects, but that file is getting quite large. I would like to split it, and have seen that mill supports this in the form of Foreign Modules.My initial idea was to transform the repository from a structure like:
to something like
and then have the builds reference each other when needed.
This effectively creates separate mill builds, which unfortunately has a couple of drawbacks:
out/foreign-modules
. This makes it impossible to share compilation results between projects, instead if two projects depend on a third, they will both need to recompile the third one.Maybe foreign modules are the wrong approach to splitting up a large build config. Does someone have a suggestion on how to effectively split up with a very large build configuration regrouping many quasi-independent projects?
Beta Was this translation helpful? Give feedback.
All reactions