Skip to content

Commit

Permalink
Fix project source file headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Jan 27, 2024
1 parent d18ad4e commit 6f4abc3
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 15 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/headers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Headers

on:
pull_request:

permissions: {}

jobs:
check-headers:
name: Check headers
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8

- name: Cache Coursier cache
uses: coursier/cache-action@v6.4.0

- name: Check headers
run: sbt +headerCheckAll
4 changes: 1 addition & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
lazy val `sbt-pull-request-validator` = (project in file("."))
.enablePlugins(AutomateHeaderPlugin)
lazy val `sbt-pull-request-validator` = project in file(".")

sbtPlugin := true
enablePlugins(SbtPlugin)
Expand All @@ -13,7 +12,6 @@ organization := "com.github.sbt"
homepage := Some(url("https://github.com/sbt/sbt-pull-request-validator"))
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))

organizationName := "Hewlett Packard Enterprise"
startYear := Some(2018)

// https://mvnrepository.com/artifact/org.kohsuke/github-api
Expand Down
30 changes: 30 additions & 0 deletions project/Header.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sbt._

import de.heikoseeberger.sbtheader.HeaderPlugin
import de.heikoseeberger.sbtheader.HeaderPlugin.{ autoImport => SbtHeaderKeys }

object Header extends AutoPlugin {
override lazy val requires = plugins.JvmPlugin && HeaderPlugin
override lazy val trigger = allRequirements
import SbtHeaderKeys.{ HeaderFileType, HeaderCommentStyle, HeaderLicense }

override lazy val projectSettings = Seq(
SbtHeaderKeys.headerMappings ++= Map(
HeaderFileType.scala -> HeaderCommentStyle.cStyleBlockComment,
HeaderFileType.java -> HeaderCommentStyle.cStyleBlockComment
),
SbtHeaderKeys.headerLicense := Some(
HeaderLicense.Custom(
"""|Sbt Pull Request Validator
|Copyright Lightbend and Hewlett Packard Enterprise
|
|Licensed under Apache License 2.0
|SPDX-License-Identifier: Apache-2.0
|
|See the NOTICE file distributed with this work for
|additional information regarding copyright ownership.
|""".stripMargin
)
)
)
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.0.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.22.0")
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
/*
* Copyright 2018 Hewlett Packard Enterprise
* Sbt Pull Request Validator
* Copyright Lightbend and Hewlett Packard Enterprise
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under Apache License 2.0
* SPDX-License-Identifier: Apache-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package com.github.sbt.pullrequestvalidator
Expand Down
11 changes: 11 additions & 0 deletions src/main/scala/com/hpe/sbt/package.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Sbt Pull Request Validator
* Copyright Lightbend and Hewlett Packard Enterprise
*
* Licensed under Apache License 2.0
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package com.hpe

package object sbt {
Expand Down

0 comments on commit 6f4abc3

Please sign in to comment.