Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support module.sc files in subfolders #3213

Merged
merged 73 commits into from
Aug 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e93dfea
.
lihaoyi Jun 13, 2024
9297f37
wip
lihaoyi Jun 16, 2024
3f9425c
compiles
lihaoyi Jun 16, 2024
e0a71c4
compiles
lihaoyi Jun 16, 2024
edac3e9
things compile with multiple root modules
lihaoyi Jun 17, 2024
d5af69e
compile passes kinda
lihaoyi Jun 17, 2024
327e88c
combined sub-folder build.sc resolution works
lihaoyi Jun 17, 2024
338196c
CLI handling of nested rootmodules works
lihaoyi Jun 17, 2024
d9096e3
merge
lihaoyi Jun 17, 2024
c2fd1ed
add test for commands
lihaoyi Jun 18, 2024
8229ed4
wip try to derive segments from nested build.sc
lihaoyi Jun 18, 2024
be77e65
pass Segments to all root modules (now RootModule.Base) and properly …
lihaoyi Jun 18, 2024
db85faf
relativize packages
lihaoyi Jun 18, 2024
56e9af6
add doubly nested build.sc to example
lihaoyi Jun 18, 2024
11b3f51
fix compile errors
lihaoyi Jun 25, 2024
a637e58
merge
lihaoyi Jun 25, 2024
5f8d58d
mill.integration.local.ForeignBuildsTest.checkProjectPaths passes
lihaoyi Jun 25, 2024
41b8bd1
almost all of ForeignBuildsTest passes, one remaining
lihaoyi Jun 25, 2024
279e5ab
all of ForeignBuildsTest passes
lihaoyi Jun 25, 2024
2f07454
avoid walking mill-build folder
lihaoyi Jun 25, 2024
aa336e9
fix
lihaoyi Jun 26, 2024
48e023a
re-enable relative up imports
lihaoyi Jun 26, 2024
2e16b48
fix failure tests
lihaoyi Jun 26, 2024
113f019
.
lihaoyi Jun 26, 2024
c065dfe
.
lihaoyi Jun 27, 2024
2301413
.
lihaoyi Jun 28, 2024
3d2358c
fix
lihaoyi Jun 28, 2024
6046085
.
lihaoyi Jun 28, 2024
7715603
.
lihaoyi Jun 28, 2024
f23bf98
.
lihaoyi Jun 28, 2024
e6f573b
.
lihaoyi Jun 28, 2024
f36f315
.
lihaoyi Jun 28, 2024
eb31770
rename millbuild package to build
lihaoyi Jun 30, 2024
5bca32e
improve package object discovery
lihaoyi Jun 30, 2024
dd0dbcd
remove hardcoded filters from module.sc discovery logic
lihaoyi Jun 30, 2024
e03be05
import nested package objects into scope for enclosing package objects
lihaoyi Jun 30, 2024
be5a5a3
.
lihaoyi Jul 1, 2024
67b1ed4
.
lihaoyi Jul 1, 2024
4810e15
.
lihaoyi Jul 1, 2024
69e254b
.
lihaoyi Jul 1, 2024
de50a36
skip folders without module.sc files
lihaoyi Jul 2, 2024
0e2c0e5
.
lihaoyi Jul 2, 2024
3019b15
update foreign modules tests
lihaoyi Jul 2, 2024
3d9b969
wip
lihaoyi Jul 2, 2024
72650a9
.
lihaoyi Jul 2, 2024
a060b93
.
lihaoyi Jul 2, 2024
a97d988
wip trying to do multi main module resolution
lihaoyi Jul 6, 2024
85806a1
augment resolution logic with nested module.sc files
lihaoyi Jul 6, 2024
34a452a
.
lihaoyi Jul 6, 2024
0cf3f9e
.
lihaoyi Jul 6, 2024
90cc28d
no mainmodule methods in module.sc
lihaoyi Jul 6, 2024
aff816f
reformat
lihaoyi Jul 6, 2024
ab7b9a5
.
lihaoyi Jul 6, 2024
451e409
.
lihaoyi Jul 6, 2024
4f6fc22
.
lihaoyi Jul 7, 2024
5805f98
.
lihaoyi Jul 7, 2024
e6f5aae
introduce BaseModuleTree
lihaoyi Jul 7, 2024
db64a64
pre-computed BaseModuleTree
lihaoyi Jul 7, 2024
61b7656
consolidate rootModule into BaseModuleTree
lihaoyi Jul 7, 2024
3e85f94
.
lihaoyi Jul 7, 2024
b80b9bc
.
lihaoyi Jul 18, 2024
9e7a6b4
.
lihaoyi Jul 18, 2024
f67ba73
.
lihaoyi Jul 18, 2024
949cc97
.
lihaoyi Jul 18, 2024
9789515
.
lihaoyi Jul 18, 2024
ab2a09b
.
lihaoyi Jul 18, 2024
c3f14d6
.
lihaoyi Aug 5, 2024
38e1fa5
.
lihaoyi Aug 5, 2024
6f43b70
.
lihaoyi Aug 5, 2024
422164e
.
lihaoyi Aug 6, 2024
b59e986
cleanup
lihaoyi Aug 6, 2024
d34c2d0
Merge branch 'main' into multi-build-file
lihaoyi Aug 6, 2024
4ebb2f2
.
lihaoyi Aug 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
.
lihaoyi committed Jul 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ab7b9a54274a43ab919bc9a45cf423cc98b12443
8 changes: 8 additions & 0 deletions main/src/mill/main/RootModule.scala
Original file line number Diff line number Diff line change
@@ -20,6 +20,14 @@ abstract class RootModule(implicit
ctx: mill.define.Ctx
) extends RootModule.Base(foreign0 = ctx.foreign)

abstract class RootModuleForeign(implicit
baseModuleInfo: RootModule.Info,
millModuleEnclosing0: sourcecode.Enclosing,
millModuleLine0: sourcecode.Line,
millFile0: sourcecode.File,
ctx: mill.define.Ctx
) extends RootModule.Foreign(foreign0 = ctx.foreign)

@internal
object RootModule {
abstract class Base(foreign0: Option[Segments] = None)(implicit
3 changes: 1 addition & 2 deletions main/src/mill/package.scala
Original file line number Diff line number Diff line change
@@ -10,8 +10,7 @@ package object mill extends mill.api.JsonFormatters {
val Cross = define.Cross
type Agg[T] = mill.api.Loose.Agg[T]
val Agg = mill.api.Loose.Agg
type RootModule = mill.main.RootModule
val RootModule = mill.main.RootModule

class root extends scala.annotation.StaticAnnotation
type Args = define.Args
val Args = define.Args
7 changes: 6 additions & 1 deletion runner/src/mill/runner/MillBuildRootModule.scala
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import mill.util.Util.millProjectModule
import mill.scalalib.api.Versions
import pprint.Util.literalize
import FileImportGraph.backtickWrap
import mill.main.BuildInfo
import mill.main.{BuildInfo, RootModule}

import scala.collection.immutable.SortedMap
import scala.util.Try
@@ -354,6 +354,10 @@ object MillBuildRootModule {
s"_root_.mill.main.RootModule.Foreign(Some(_root_.mill.define.Segments.labels($segsList)))"
}

val imports =
if (name == "build") "import mill.main.RootModule"
else "import mill.main.{RootModuleForeign => RootModule}"

val miscInfoName = s"MiscInfo_$name"

val pkgLine = pkg.map(p => "package " + backtickWrap(p)).mkString("\n")
@@ -362,6 +366,7 @@ object MillBuildRootModule {
s"""$pkgLine
|
|import _root_.mill.runner.MillBuildRootModule
|$imports
|
|object ${backtickWrap(miscInfoName)} {
| implicit lazy val millBuildRootModuleInfo: _root_.mill.runner.MillBuildRootModule.Info = _root_.mill.runner.MillBuildRootModule.Info(