diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-12-23 22:22:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-23 22:22:43 +0100 |
commit | 9de445f2b8c5b6c6a8cb81f2bc84d9ebabdda200 (patch) | |
tree | 28e1e65b236e295fcb0b7702684b5bb8243f4f27 /stage2 | |
parent | f83825723078a37780906554c437c3b08d5784ae (diff) | |
parent | 2d7586abd292032414e6093ccab0ecb19e03b7dd (diff) | |
download | cbt-9de445f2b8c5b6c6a8cb81f2bc84d9ebabdda200.tar.gz cbt-9de445f2b8c5b6c6a8cb81f2bc84d9ebabdda200.tar.bz2 cbt-9de445f2b8c5b6c6a8cb81f2bc84d9ebabdda200.zip |
Merge pull request #329 from mchav/enable_different_sources
Modifiable source file filter
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BasicBuild.scala | 7 | ||||
-rw-r--r-- | stage2/Lib.scala | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 7ff1f4b..efccfb4 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -82,10 +82,13 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge def compileStatusFile: File = compileTarget ++ ".last-success" /** Source directories and files. Defaults to .scala and .java files in src/ and top-level. */ - def sources: Seq[File] = Seq(defaultSourceDirectory) ++ projectDirectory.listFiles.toVector.filter(lib.sourceFileFilter) + def sources: Seq[File] = Seq(defaultSourceDirectory) ++ projectDirectory.listFiles.toVector.filter(sourceFileFilter) + + /** Which file endings to consider being source files. */ + def sourceFileFilter(file: File): Boolean = file.toString.endsWith(".scala") || file.toString.endsWith(".java") /** Absolute path names for all individual files found in sources directly or contained in directories. */ - final def sourceFiles: Seq[File] = lib.sourceFiles(sources) + final def sourceFiles: Seq[File] = lib.sourceFiles(sources, sourceFileFilter) protected def logEmptySourceDirectories(): Unit = { val nonExisting = diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 769cd97..ca85555 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -266,10 +266,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ def dirname(path: File): File = new File(realpath(path).string.stripSuffix("/").split("/").dropRight(1).mkString("/")) def nameAndContents(file: File) = basename(file) -> readAllBytes(file.toPath) - /** Which file endings to consider being source files. */ - def sourceFileFilter(file: File): Boolean = file.toString.endsWith(".scala") || file.toString.endsWith(".java") - - def sourceFiles( sources: Seq[File], sourceFileFilter: File => Boolean = sourceFileFilter ): Seq[File] = { + def sourceFiles( sources: Seq[File], sourceFileFilter: File => Boolean ): Seq[File] = { for { base <- sources.filter(_.exists).map(lib.realpath) file <- lib.listFilesRecursive(base) if file.isFile && sourceFileFilter(file) |