File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -155,4 +155,41 @@ that is shared by the entire build: for example,
155
155
` mill.scalalib.ScalaWorkerApi/scalaWorker ` provides a shared Scala compilation
156
156
service & cache that is shared between all ` ScalaModule ` s, and
157
157
` mill.scalalib.GenIdea/idea ` lets you generate IntelliJ projects without
158
- needing to define your own ` T.command ` in your ` build.sc ` file
158
+ needing to define your own ` T.command ` in your ` build.sc ` file
159
+
160
+ ## Foreign Modules
161
+
162
+ Mill can load other mill projects from external (or sub) directories,
163
+ using Ammonite's ` $file ` magic import, allowing to depend on foreign modules.
164
+ This allows, for instance, to depend on other projects' sources, or split
165
+ your build logic into smaller files.
166
+
167
+
168
+ For instance, assuming the following stucture :
169
+
170
+ ``` text
171
+ foo/
172
+ build.sc
173
+ bar/
174
+ build.sc
175
+ baz/
176
+ build.sc
177
+ ```
178
+
179
+ you can write the following in ` foo/build.sc ` :
180
+
181
+ ``` scala
182
+
183
+ import $file .bar .build
184
+ import $file .^ .baz .build
185
+ import mill ._
186
+
187
+ def someFoo = T {
188
+
189
+ ^ .baz.build.someBaz(...)
190
+ bar.build.someBar(...)
191
+ ...
192
+ }
193
+ ```
194
+
195
+ The output of the foreign tasks will be cached under ` foo/out/foreign-modules/ ` .
You can’t perform that action at this time.
0 commit comments