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

Report when we could not detect the declaring parent of a target #2885

Merged
merged 7 commits into from
Nov 19, 2023

Conversation

lefou
Copy link
Member

@lefou lefou commented Nov 19, 2023

This is related to #2844.

We report the target name in case we weren't able to detect it's declaring parent class.

Tested manually with a Mill version before the merge of #2883.

// /tmp/mill-2844/build.sc
import mill._

object mod extends Module {

  object foo extends Module {
    def bar = T {
      baz()
    }
  }

  private def baz = T { "baz" }
}
> mill -i dev.run /tmp/mill-2844 -i mod.foo.bar
[1691/1691] dev.run 
[info] compiling 1 Scala source to /tmp/mill-2844/out/mill-build/compile.dest/classes ...
[info] done compiling
Could not detect the parent class of target mod.baz. Please report this at https://github.com/com-lihaoyi/mill/issues/new/choose. As a workaround, you can run Mill with `--disable-callgraph-invalidation` option.

Pull request: #2885

Seq(launcher().path.toString) ++ rest,
forkEnv(),
workingDir = wd
)
catch {
case e: Throwable => () /*ignore to avoid confusing stacktrace and error messages*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hides any failures as dev.run will succeed.

@@ -116,15 +123,15 @@ private[mill] trait GroupEvaluator {
ctx.enclosingModule match {
case null => None
case m: mill.define.Module => Some((m, m.millOuterCtx))
case unknown => sys.error(s"Unknown ctx: $unknown")
case unknown => throw new MillException(s"Unknown ctx of target ${namedTask}: $unknown")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change adding more context to the error message.

@lefou lefou merged commit 9e0ec9a into main Nov 19, 2023
37 checks passed
@lefou lefou deleted the report-missing-parent branch November 19, 2023 11:24
@lefou lefou added this to the 0.11.6 milestone Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant