Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed May 7, 2024
1 parent 17a5383 commit 5e23501
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/scala/com/elarib/PartialSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import sbt.internal.BuildDependencies.DependencyMap
import sbt._

object BuildKeys {
val partialSbtExcludeFiles = sbt.settingKey[Seq[sbt.File]]("Files that should be excluded from analysis.")
val partialSbtExcludedFiles = sbt.settingKey[Seq[sbt.File]]("Files that should be excluded from analysis.")
}

object PartialSbtPlugin extends AutoPlugin {
Expand All @@ -33,14 +33,14 @@ object PartialSbtPlugin extends AutoPlugin {

override def globalSettings: Seq[Def.Setting[_]] =
Seq(
BuildKeys.partialSbtExcludeFiles := Def.setting(List.empty[sbt.File]).value
BuildKeys.partialSbtExcludedFiles := Def.setting(List.empty[sbt.File]).value
)

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
commands += Command("metaBuildChangedFiles")(_ => PartialSbParser.changeGetterParser)((st, changeGetter) => {
val metaBuildChangedFiles =
getMetaBuildChangedFiles(changeGetter)(baseDirectory.value, BuildKeys.partialSbtExcludeFiles.value)
getMetaBuildChangedFiles(changeGetter)(baseDirectory.value, BuildKeys.partialSbtExcludedFiles.value)

logger.debug(s"${metaBuildChangedFiles.size} meta build files have been changed.")

Expand All @@ -55,7 +55,7 @@ object PartialSbtPlugin extends AutoPlugin {
baseDirectory.value,
loadedBuild.value.allProjectRefs,
buildDependencies.value.classpathTransitive,
BuildKeys.partialSbtExcludeFiles.value
BuildKeys.partialSbtExcludedFiles.value
)

logger.debug(s"${changedProjects.size} projects have been changed")
Expand Down Expand Up @@ -100,7 +100,7 @@ object PartialSbtPlugin extends AutoPlugin {
val modulesWithPath: Seq[(ProjectRef, ResolvedProject)] =
allProjectRefs.filter(_._2.base != baseDir)

val diffsFiles: Seq[sbt.File] = changeGetter.changes.filterNot(f => excludeFile(baseDir)(f, excludeFiles))
val diffsFiles: Seq[sbt.File] = changeGetter.changes.filterNot(f => isFileExcluded(baseDir)(f, excludeFiles))

val modulesToBuild: Seq[ResolvedProject] = modulesWithPath
.filter { case (_, resolvedProject) =>
Expand Down Expand Up @@ -130,7 +130,7 @@ object PartialSbtPlugin extends AutoPlugin {
for {
fileChanged <- changeGetter.changes
.flatMap(_.relativeTo(baseDir))
.filterNot(f => excludeFile(baseDir)(f, excludeFiles))
.filterNot(f => isFileExcluded(baseDir)(f, excludeFiles))
(metaFile, metaFileChecker) <- metaBuildFiles.flatMap { case (metaFile, metaFileChecker) =>
metaFile.relativeTo(baseDir).map((_, metaFileChecker))
}
Expand All @@ -139,7 +139,7 @@ object PartialSbtPlugin extends AutoPlugin {

}

private def excludeFile(baseDir: sbt.File)(file: sbt.File, toExclude: Seq[sbt.File]): Boolean =
private def isFileExcluded(baseDir: sbt.File)(file: sbt.File, toExclude: Seq[sbt.File]): Boolean =
toExclude.exists {
case ef if ef.isAbsolute =>
(for {
Expand Down

0 comments on commit 5e23501

Please sign in to comment.