You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Pekko and its projects uses sbt-header in order to check that all source content has the correct headers. In order to check the headers for a project you can run the following

sbt headerCheckAll


A success will provide a result that looks like this

sbt-header success
<@incubator-pekko>-<⎇ main>-<*>-> sbt headerCheckAll
[info] welcome to sbt 1.9.2 (Homebrew Java 11.0.19)
[info] loading global plugins from /Users/mdedetrich/.sbt/1.0/plugins
[info] loading settings for project incubator-pekko-build-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project/project
[info] loading settings for project incubator-pekko-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project
[success] Generated .bloop/incubator-pekko-build-build.json
[success] Total time: 0 s, completed 19 Jul 2023, 16:41:57
[info] loading settings for project incubator-pekko-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project
[success] Generated .bloop/incubator-pekko-build.json
[success] Total time: 2 s, completed 19 Jul 2023, 16:41:59
[info] loading settings for project pekko from build.sbt ...
[info] resolving key references (65176 settings) ...
[info] 
[info] ________     ______ ______        
[info] ___  __ \_______  /____  /_______ 
[info] __  /_/ /  _ \_  //_/_  //_/  __ \
[info] _  ____//  __/  ,<  _  ,<  / /_/ /
[info] /_/     \___//_/|_| /_/|_| \____/   1.0.1-RC1+1-24050622-SNAPSHOT
[info] 
[info] Useful sbt tasks:
[info] >  compile - Compile the current project
[info] >  test - Run all the tests
[info] >  testQuick - Runs all the tests. When run multiple times will only run previously failing tests (shell mode only)
[info] >  testOnly *.AnySpec - Only run a selected test
[info] >  testQuick *.AnySpec - Only run a selected test. When run multiple times will only run previously failing tests (shell mode only)
[info] >  testQuickUntilPassed - Runs all tests in a continuous loop until all tests pass
[info] >  publishLocal - Publish current snapshot version to local ~/.ivy2 repo
[info] >  verifyCodeStyle - Verify code style
[info] >  applyCodeStyle - Apply code style
[info] >  sortImports - Sort the imports
[info] >  mimaReportBinaryIssues  - Check binary issues
[info] >  validatePullRequest  - Validate pull request
[info] >  docs/paradox - Build documentation
[info] >  docs/paradoxBrowse - Browse the generated documentation
[info] >  tips: - prefix commands with `+` to run against cross Scala versions.
[info] >  Contributing guide: - https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md
[success] Total time: 4 s, completed 19 Jul 2023, 16:42:11


Where as a failure would look like this

sbt-header failure
<@incubator-pekko>-<⎇ main>-<*>-> sbt headerCheckAll
[info] welcome to sbt 1.9.2 (Homebrew Java 11.0.19)
[info] loading global plugins from /Users/mdedetrich/.sbt/1.0/plugins
[info] loading settings for project incubator-pekko-build-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project/project
[info] loading settings for project incubator-pekko-build-build from metals.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project
[success] Generated .bloop/incubator-pekko-build-build.json
[success] Total time: 0 s, completed 19 Jul 2023, 16:43:35
[info] loading settings for project incubator-pekko-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project
[success] Generated .bloop/incubator-pekko-build.json
[success] Total time: 1 s, completed 19 Jul 2023, 16:43:36
[info] loading settings for project pekko from build.sbt,version.sbt ...
[info] resolving key references (65178 settings) ...
[info] 
[info] ________     ______ ______        
[info] ___  __ \_______  /____  /_______ 
[info] __  /_/ /  _ \_  //_/_  //_/  __ \
[info] _  ____//  __/  ,<  _  ,<  / /_/ /
[info] /_/     \___//_/|_| /_/|_| \____/   1.0.1-RC1
[info] 
[info] Useful sbt tasks:
[info] >  compile - Compile the current project
[info] >  test - Run all the tests
[info] >  testQuick - Runs all the tests. When run multiple times will only run previously failing tests (shell mode only)
[info] >  testOnly *.AnySpec - Only run a selected test
[info] >  testQuick *.AnySpec - Only run a selected test. When run multiple times will only run previously failing tests (shell mode only)
[info] >  testQuickUntilPassed - Runs all tests in a continuous loop until all tests pass
[info] >  publishLocal - Publish current snapshot version to local ~/.ivy2 repo
[info] >  verifyCodeStyle - Verify code style
[info] >  applyCodeStyle - Apply code style
[info] >  sortImports - Sort the imports
[info] >  mimaReportBinaryIssues  - Check binary issues
[info] >  validatePullRequest  - Validate pull request
[info] >  docs/paradox - Build documentation
[info] >  docs/paradoxBrowse - Browse the generated documentation
[info] >  tips: - prefix commands with `+` to run against cross Scala versions.
[info] >  Contributing guide: - https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md
[error] There are files without headers!
[error]   /Users/mdedetrich/github/incubator-pekko/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala
[error] (actor / Compile / headerCheck) There are files without headers!
[error]   /Users/mdedetrich/github/incubator-pekko/actor/src/main/scala/org/apache/pekko/actor/AbstractActor.scala
[error] Total time: 2 s, completed 19 Jul 2023, 16:43:43


You can also create headers for source files that don't currently contain one by running


sbt headerCreateAll


All of Pekko projects run the header check on every PR which in addition to protected branches helps alleviate regressions in license headers, i.e. using core Pekko project as an example


Do note that while its possible to use other tools to check for headers (such as rat) its not recommend because all of the header requirements that resulted from legal discussions such as Unable to render Jira issues macro, execution error. are encoded into sbt-header and certain kinds of rules for checking header files aren't even possible in rat because they are programmatic in nature (see https://github.com/apache/incubator-pekko/blob/main/project/CopyrightHeader.scala as an example).


  • No labels