Skip to content

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

Merged
merged 9 commits into from
Jan 29, 2018

Conversation

jonas
Copy link
Contributor

@jonas jonas commented Jan 3, 2018

Refs #1255

Seq(
includeFilter in headerCreate := (includeFilter in unmanagedSources).value,
excludeFilter in headerCreate := (excludeFilter in unmanagedSources).value,
unmanagedSources in headerCreate := Defaults.collectFiles(
Copy link
Contributor Author

@jonas jonas Jan 3, 2018

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?

@akka-ci akka-ci added the validating PR that is currently being validated by Jenkins label Jan 3, 2018
excludeFilter in headerCreate
).value,
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
Copy link
Contributor Author

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.

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR that is currently being validated by Jenkins labels Jan 3, 2018
@akka-ci
Copy link

akka-ci commented Jan 3, 2018

Test PASSed.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins and removed tested PR that was successfully built and tested by Jenkins labels Jan 3, 2018
excludeFilter in headerCreate
).value,
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
Copy link
Contributor Author

@jonas jonas Jan 3, 2018

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please! :)

Seq(
includeFilter in headerCreate := (includeFilter in unmanagedSources).value,
excludeFilter in headerCreate := (excludeFilter in unmanagedSources).value,
unmanagedSources in headerCreate := Defaults.collectFiles(
Copy link
Contributor Author

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?

Copy link
Contributor

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,
Copy link
Contributor Author

@jonas jonas Jan 3, 2018

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.

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR that is currently being validated by Jenkins labels Jan 3, 2018
@akka-ci
Copy link

akka-ci commented Jan 3, 2018

Test PASSed.

@raboof
Copy link
Contributor

raboof commented Jan 3, 2018

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>
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor

@jrudolph jrudolph Jan 3, 2018

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",
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins and removed tested PR that was successfully built and tested by Jenkins labels Jan 10, 2018
@jonas
Copy link
Contributor Author

jonas commented Jan 10, 2018

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 *Spec files).

@akka-ci akka-ci added needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed validating PR that is currently being validated by Jenkins labels Jan 10, 2018
@akka-ci
Copy link

akka-ci commented Jan 10, 2018

Test FAILed.

@jonas
Copy link
Contributor Author

jonas commented Jan 10, 2018

PLS BUILD

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) labels Jan 10, 2018
@akka-ci akka-ci added validating PR that is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed tested PR that was successfully built and tested by Jenkins validating PR that is currently being validated by Jenkins labels Jan 19, 2018
@akka-ci
Copy link

akka-ci commented Jan 19, 2018

Test FAILed.

@jonas
Copy link
Contributor Author

jonas commented Jan 19, 2018

Only Lightbend copyright notices are touched as of the latest version.

@akka-ci akka-ci added validating PR that is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR that is currently being validated by Jenkins labels Jan 19, 2018
@akka-ci
Copy link

akka-ci commented Jan 19, 2018

Test PASSed.

@jrudolph jrudolph merged commit f3e8393 into akka:master Jan 29, 2018
@jrudolph
Copy link
Contributor

Great stuff, thanks a lot, @jonas. It will help a lot in upcoming years!

@ktoso
Copy link
Contributor

ktoso commented Jan 29, 2018

Late to the party but this is fantastic, thanks a lot :)

@jonas jonas deleted the sbt-header branch January 29, 2018 14:38
jrudolph pushed a commit to jrudolph/akka-http that referenced this pull request Jan 29, 2018
… copyright headers (akka#1738)

* Fix akka#1255: Configure sbt-header

* Update Lightbend copyright headers

Based on the following sbt tasks:

    > compile:headerCreate
    > test:headerCreate
    > multi-jvm:headerCreate
jrudolph pushed a commit to jrudolph/akka-http that referenced this pull request Jan 29, 2018
… copyright headers (akka#1738)

* Fix akka#1255: Configure sbt-header

* Update Lightbend copyright headers

Based on the following sbt tasks:

    > compile:headerCreate
    > test:headerCreate
    > multi-jvm:headerCreate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants