build: make sure ignore files are searched for in base directory

Previously, the paths were just relative paths and depended on the working
directory of the sbt process. However, that's unreliable when the akka
sources are included in another build as in the akka-http nightlies.
This commit is contained in:
Johannes Rudolph 2019-01-16 11:44:07 +01:00
parent 75cb436ce7
commit f44b777e76
No known key found for this signature in database
GPG key ID: 4D293A24CCD39E19
3 changed files with 35 additions and 33 deletions

View file

@ -3,22 +3,24 @@
*/
package sbt
import Keys.baseDirectory
import akka.ProjectFileIgnoreSupport
import sbt.Keys.unmanagedSources
trait ScalafixSupport extends ProjectFileIgnoreSupport {
final override protected val ignoreConfigFileName: String = ".scalafix.conf"
final override protected val descriptor: String = "scalafix"
trait ScalafixSupport {
private val ignoreConfigFileName: String = ".scalafix.conf"
private val descriptor: String = "scalafix"
protected def ignore(configKey: ConfigKey): Def.Setting[Task[Seq[File]]] = {
import scalafix.sbt.ScalafixPlugin.autoImport._
unmanagedSources.in(configKey, scalafix) :=
unmanagedSources.in(configKey, scalafix) := {
val ignoreSupport = new ProjectFileIgnoreSupport((baseDirectory in ThisBuild).value / ignoreConfigFileName, descriptor)
unmanagedSources.in(configKey, scalafix).value
.filterNot(file => isIgnoredByFileOrPackages(file))
.filterNot(file => ignoreSupport.isIgnoredByFileOrPackages(file))
}
}