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

A potential regression in v0.7.0: HeaderPlugin throws 'Unable to auto detect project license' #701

Closed
danicheg opened this issue Apr 21, 2024 · 9 comments

Comments

@danicheg
Copy link
Member

Hey. mouse has encountered this when updating to v0.7.0:

> Check headers and formatting

[error] java.lang.RuntimeException: Unable to auto detect project license
[error] 	at scala.sys.package$.error(package.scala:30)
[error] 	at de.heikoseeberger.sbtheader.HeaderPlugin$.$anonfun$toBeScopedSettings$9(HeaderPlugin.scala:148)
[error] 	at scala.Option.getOrElse(Option.scala:189)
[error] 	at de.heikoseeberger.sbtheader.HeaderPlugin$.$anonfun$toBeScopedSettings$8(HeaderPlugin.scala:148)

However, the build.sbt contains license explicitly set:

licenses := List(License.MIT)

Links:

@armanbilge
Copy link
Member

Maybe because of this?
https://github.com/typelevel/mouse/blob/dfb95570737a4c6039ffdf1bbf938729d56ff34c/build.sbt#L31

tbh I'm not sure what changed in sbt-typelevel that would cause that regression. If you have bandwidth to try some snapshots to bisect it that might help us understand the cause.

@danicheg
Copy link
Member Author

I'll give it a try to fix the mouse's CI tomorrow. Anyway, this doesn't appear to be too important. Just curious about the reason.

@armanbilge
Copy link
Member

Just curious about the reason.

yes, me too. looks like someone else had the problem as well. I'm genuinely confused what change caused it.

@danicheg
Copy link
Member Author

It turned out that adding startYear to the root project fixes the issue in mouse. Can't say what changes in sbt-typelevel might led to this 🤷🏻

@mzuehlke
Copy link
Collaborator

#699 stopped setting a wrong startYear (as now is nearly never the right answer to when a project started.)

@danicheg
Copy link
Member Author

danicheg commented Apr 22, 2024

@armanbilge aha, gotcha! 😄
@mzuehlke thanks for pointing this out.

I think this issue could be closed as we clarified the whole thing.

@mzuehlke
Copy link
Collaborator

sbt-header does a pretty bad job at reporting any errors when detecting the right license 😞
https://github.com/sbt/sbt-header/blob/master/src/main/scala/de/heikoseeberger/sbtheader/LicenseDetection.scala#L48-L52

@danicheg
Copy link
Member Author

Yeah, it's a nice example when Either is much better for enveloping errors than Option in public API. Also, maybe it'd be a nice contribution.

@armanbilge
Copy link
Member

I see that Daniel commented on a relevant sbt-header issue in sbt/sbt-header#153 (comment).

Thanks both for investigating! Looks like this is something that needs to be improved in sbt-header.

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

No branches or pull requests

3 participants