diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-01-11 11:57:46 +0100 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-01-11 11:57:46 +0100 |
commit | 783a80d0d8f726f7169022457152d4301779244f (patch) | |
tree | 4ab107e2b23e5c9f3be81c676a0ccbaf10520991 /compiler/test/dotty/tools | |
parent | fd9ae07a89264ab3644bfdce9588b4a48fdd9033 (diff) | |
download | dotty-783a80d0d8f726f7169022457152d4301779244f.tar.gz dotty-783a80d0d8f726f7169022457152d4301779244f.tar.bz2 dotty-783a80d0d8f726f7169022457152d4301779244f.zip |
Add useExplicitWhiteList for debugging.
Diffstat (limited to 'compiler/test/dotty/tools')
-rw-r--r-- | compiler/test/dotty/tools/StdLibSources.scala | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/compiler/test/dotty/tools/StdLibSources.scala b/compiler/test/dotty/tools/StdLibSources.scala index 2b37235fb..78a132426 100644 --- a/compiler/test/dotty/tools/StdLibSources.scala +++ b/compiler/test/dotty/tools/StdLibSources.scala @@ -6,11 +6,26 @@ import scala.io.Source object StdLibSources { + /* For debug only */ + private val useExplicitWhiteList = false + private final val stdLibPath = "../scala-scala/src/library/" def blacklistFile: String = "./test/dotc/scala-collections.blacklist" + private def whitelistFile: String = "./test/dotc/scala-collections.whitelist" + + def whitelisted: List[String] = { + lazy val whitelistBasedOnBlacklist = all.diff(blacklisted) + if (!useExplicitWhiteList) { + whitelistBasedOnBlacklist + } else if (!new File(whitelistFile).exists()) { + genWhitelist(whitelistBasedOnBlacklist.map(_.replace(stdLibPath, ""))) + whitelistBasedOnBlacklist + } else { + loadList(whitelistFile) + } + } - def whitelisted: List[String] = (all.toSet -- blacklisted).toList def blacklisted: List[String] = loadList(blacklistFile) def all: List[String] = { @@ -22,6 +37,17 @@ object StdLibSources { collectAllFilesInDir(new File(stdLibPath), Nil) } + private def genWhitelist(list: List[String]): Unit = { + println(s"Generating $whitelistFile based on $blacklistFile") + val whitelist = new File(whitelistFile) + val p = new java.io.PrintWriter(whitelist) + try { + list.foreach(p.println) + } finally { + p.close() + } + } + private def loadList(path: String): List[String] = Source.fromFile(path, "UTF8").getLines() .map(_.trim) // allow identation .filter(!_.startsWith("#")) // allow comment lines prefixed by # |