-
Notifications
You must be signed in to change notification settings - Fork 6
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
Any way to detect if this launcher is being used? #72
Comments
This works! def detectedCsbt(): Boolean = {
try {
val klass = Class.forName("lmcoursier.definitions.ToCoursier$")
val m = klass.getMethod("project", Class.forName("lmcoursier.definitions.Project"))
m.getReturnType().getName == "coursier.core.Project"
} catch {
case _: Throwable => false
}
}
if (detectedCsbt())
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "2.0.0-RC3-3")
else
Seq() Specific scenario here is I wanted to stick sbt-coursier into my global plugins, conditional on the use of the relevant launcher. This does the trick. For posterity, the idea here comes from @dcsobral: try using a Coursier-specific plugin task (in my case, |
@djspiewak @dcsobral May I ask what makes you prefer |
Dependency graph is much, much slower and also a lot harder to read. |
I keep making the mistake of using this launcher (as it's my default) in lampepfl/dotty and later realising when it breaks.
I was thinking: can I detected if this launcher is being used, say, in the build? Perhaps I can fast-fail the
onLoad
and avoid myself (and others) the same mistake.The text was updated successfully, but these errors were encountered: