forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package de.heikoseeberger.sbtheader | ||
|
||
import sbt._ | ||
import sbt.Keys._ | ||
import sbt.plugins.JvmPlugin | ||
|
||
object HeaderPlugin extends AutoPlugin { | ||
|
||
final object autoImport { | ||
class License | ||
object HeaderLicense { | ||
case class Custom(s: String) extends License | ||
} | ||
val headerLicense: SettingKey[Option[License]] = settingKey[Option[License]]("header License") | ||
|
||
val headerSources = taskKey[scala.collection.Seq[File]]("Sources which need headers checked or created.") | ||
|
||
val headerResources = taskKey[scala.collection.Seq[File]]("Resources which need headers checked or created.") | ||
|
||
def headerSettings(configurations: Configuration*): Seq[Setting[_]] = | ||
configurations.foldLeft(List.empty[Setting[_]]) { _ ++ inConfig(_)(toBeScopedSettings) } | ||
} | ||
|
||
import autoImport._ | ||
|
||
override def trigger = allRequirements | ||
|
||
override def requires = JvmPlugin | ||
|
||
override def projectSettings = headerSettings(Compile, Test) | ||
|
||
private def toBeScopedSettings = Vector(headerSources := Nil, headerResources := Nil) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters