-
Notifications
You must be signed in to change notification settings - Fork 595
Configure sbt-header and update Lightbend copyright headers #1738
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
Conversation
project/CopyrightHeader.scala
Outdated
Seq( | ||
includeFilter in headerCreate := (includeFilter in unmanagedSources).value, | ||
excludeFilter in headerCreate := (excludeFilter in unmanagedSources).value, | ||
unmanagedSources in headerCreate := Defaults.collectFiles( |
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.
@hseeberger As mentioned in sbt/sbt-header#147 I could not get excludeFilter.in(unmanagedSources.in(headerCreate))
to work. It could be the lack of configuration scope however, the sbt-header code doesn't seem to use Defaults.collectFiles
or something similar to apply these filters. Is this a bug?
project/CopyrightHeader.scala
Outdated
excludeFilter in headerCreate | ||
).value, | ||
headerLicense := Some(HeaderLicense.Custom( | ||
"""|Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com> |
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.
Not sure whether to use http://
or https://
and ending /
or not.
Test PASSed. |
project/CopyrightHeader.scala
Outdated
excludeFilter in headerCreate | ||
).value, | ||
headerLicense := Some(HeaderLicense.Custom( | ||
"""|Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com> |
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.
[rebased so recommenting]
Please confirm whether using https://
is OK.
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.
Yes, please! :)
project/CopyrightHeader.scala
Outdated
Seq( | ||
includeFilter in headerCreate := (includeFilter in unmanagedSources).value, | ||
excludeFilter in headerCreate := (excludeFilter in unmanagedSources).value, | ||
unmanagedSources in headerCreate := Defaults.collectFiles( |
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.
@hseeberger (Sorry to ping you twice) As mentioned in sbt/sbt-header#147 I could not get excludeFilter.in(unmanagedSources.in(headerCreate))
to work. It could be the lack of configuration scope however, the sbt-header code doesn't seem to use Defaults.collectFiles
or something similar to apply these filters. Is this a bug?
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.
Probably a Bug/missing feature.
@@ -57,6 +57,7 @@ lazy val root = Project( | |||
.settings( | |||
// Unidoc doesn't like macros | |||
unidocProjectExcludes := Seq(parsing), | |||
unmanagedSources in (Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get, |
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.
Manage sbt project file headers as part of the root project.
Test PASSed. |
Hmm I wonder if we want to update all years, or try to preserve them (using https://github.com/sbt/sbt-header#custom-comment-creators) |
/** | ||
* Copyright (C) 2017 Lightbend Inc. <http://www.lightbend.com/> | ||
/* | ||
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com> |
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.
AFAIU the year range was meant to keep track of when the file was created. For example, Cache
was created on 2017, so this year should be 2017-2018. Is this something legal? Or just a good thing to have?
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.
A nice to have AFAIR. We can use the automatic template hm
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.
AFAIU the year range was meant to keep track of when the file was created. For example, Cache was created on 2017, so this year should be 2017-2018. Is this something legal? Or just a good thing to have?
That's one way to use/interpret them but it seems that Akka uses the convention to use the same headers everywhere (e.g. akka/akka@6c70852 where everything was changed to 2017). It would make sense to keep it consistent between Akka sub-projects. When it comes to history, there's always the commit history as the ultimate truth.
build.sbt
Outdated
@@ -91,6 +93,11 @@ lazy val httpCore = project("akka-http-core") | |||
.settings(Dependencies.httpCore) | |||
.settings(VersionGenerator.versionSettings) | |||
.enablePlugins(BootstrapGenjavadoc) | |||
.settings( | |||
excludeFilter in (Compile, headerCreate) := | |||
"LastEventId.*" || "ServerSentEvent.*" || "Base64Parsing.scala" || "StringBuilding.scala", |
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.
Hmm, that seems quite brittle to me. The plugin shouldn't touch any files that are not yet copyright Lightbend. Can we do that somehow?
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.
It looks like we can match on the previous header text and update accordingly. Will give it a try.
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.
Access to existing headers was added by @raboof in sbt/sbt-header#142 and has not yet been released. Since it simplifies a lot I suggest we wait until a new release is out.
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.
sbt-header 4.1.0 has been released. I'll update the PR to get rid of the excludes.
The years are now preserved. Additional text in the Lightbend copyright headers are not preserved however. There was one such header. This also detected one Typesafe copyright header and several missing headers (mainly in |
Test FAILed. |
PLS BUILD |
Based on the following sbt tasks: > compile:headerCreate > test:headerCreate > multi-jvm:headerCreate
Test FAILed. |
Only Lightbend copyright notices are touched as of the latest version. |
Test PASSed. |
Great stuff, thanks a lot, @jonas. It will help a lot in upcoming years! |
Late to the party but this is fantastic, thanks a lot :) |
Refs #1255