Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ object WarningMessages {
def slothCouldNotPatch(subject: String, reason: String): String =
s"Could not patch lazy vals in $subject, using original: $reason"

def slothUnresolvedHierarchy(subject: String, details: String): String =
s"Sloth could not resolve class hierarchies while patching $subject ($details). " +
"Patching continued with widened frames; use --sloth-strict to fail instead."

def slothUnresolvedHierarchyStrict(subject: String, details: String): String =
s"Sloth could not resolve class hierarchies while patching $subject ($details)."

val slothStrictRequiresPatching: String =
"--sloth-strict requires --sloth or --sloth-agent; hierarchy checking has no effect without lazy-val patching."

val slothNonStandaloneBootstrapWarning: String =
"Could not patch lazy vals in non-standalone bootstrap dependencies; use --standalone for batch patching."
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ object SlothAgent:
): Unit =
if options.notForBloopOptions.sloth && options.notForBloopOptions.slothAgent then
logger.message(s"$warnPrefix ${WarningMessages.slothModesMutuallyRedundant}")
if options.notForBloopOptions.slothStrict &&
!options.notForBloopOptions.sloth &&
!options.notForBloopOptions.slothAgent
then
logger.message(s"$warnPrefix ${WarningMessages.slothStrictRequiresPatching}")

private def fetchAgentJar(
options: BuildOptions,
Expand All @@ -57,6 +62,11 @@ object SlothAgent:
): Either[BuildException, os.Path] =
val expectedJarName =
s"${Constants.slothAgentModuleName}-${Constants.slothAgentVersion}.jar"
val plainJarName = s"${Constants.slothAgentModuleName}.jar"
artifacts
.collectFirst { case (_, path) if path.last == expectedJarName => path }
.collectFirst {
// Maven-style: sloth-agent-<version>.jar; Ivy publishLocal often keeps sloth-agent.jar.
case (_, path)
if path.last == expectedJarName || path.last == plainJarName => path
}
.toRight(SlothAgentError(s"Could not resolve sloth agent ${Constants.slothAgentVersion}"))
Loading
Loading