-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4eb8358
Report when we could not detect the declaring parent of a target
lefou fe59962
Don't swallow failed mill runs in `dev.run`
lefou 1c94328
scalafmt
lefou 4a54680
.
lefou 4d22b60
.
lefou 74f8328
Enhance an unrelated error message with the target name
lefou a8a4882
scalafmt
lefou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,14 @@ private[mill] trait GroupEvaluator { | |
if decode(m.getName) == namedTask.ctx.segment.pathSegments.head | ||
} yield m | ||
|
||
val methodClass = methods.head.getDeclaringClass.getName | ||
val methodClass = methods | ||
.headOption | ||
.getOrElse(throw new MillException( | ||
s"Could not detect the parent class of target ${namedTask}. " + | ||
s"Please report this at ${BuildInfo.millReportNewIssueUrl} . " + | ||
s"As a workaround, you can run Mill with `--disable-callgraph-invalidation` option." | ||
)) | ||
.getDeclaringClass.getName | ||
val name = namedTask.ctx.segment.pathSegments.last | ||
val expectedName = methodClass + "#" + name + "()mill.define.Target" | ||
|
||
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change adding more context to the error message. |
||
} | ||
} | ||
|
||
val constructorHashes = allEnclosingModules | ||
.map(m => | ||
constructorHashSignatures.get(m.getClass.getName) match { | ||
case Some(Seq((singleMethod, hash))) => hash | ||
case Some(multiple) => sys.error( | ||
case Some(multiple) => throw new MillException( | ||
s"Multiple constructors found for module $m: ${multiple.mkString(",")}" | ||
) | ||
case None => 0 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.