Skip to content

Commit

Permalink
Add Scalac scanning to the Travis CI build
Browse files Browse the repository at this point in the history
And silence some of the error messages we print so the build log
doesn't go above 4MB (Travis' limit)
  • Loading branch information
VladUreche committed Feb 16, 2014
1 parent 153146c commit 1384048
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: scala
script:
- sbt update compile test
- sbt -Ddotty.travis.build=yes update compile test
jdk:
- oraclejdk7
notifications:
Expand All @@ -9,3 +9,7 @@ notifications:
branches:
only:
- master
before_install:
- cd ..
- git clone https://github.com/scala/scala.git
- cd dotty
11 changes: 10 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Process._

object DottyBuild extends Build {

val TRAVIS_BUILD = "dotty.travis.build"

val defaults = Defaults.defaultSettings ++ Seq(
// set sources to src/, tests to test/ and resources to resources/
scalaSource in Compile := baseDirectory.value / "src",
Expand Down Expand Up @@ -45,7 +47,14 @@ object DottyBuild extends Build {
// dotty itself needs to be in the bootclasspath
val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList
// System.err.println("BOOTPATH: " + fullpath)
fullpath

val travis_build = // propagate if this is a travis build
if (sys.props.isDefinedAt(TRAVIS_BUILD))
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}")
else
List()

travis_build ::: fullpath
}
)

Expand Down
21 changes: 13 additions & 8 deletions test/test/ShowClassTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import org.junit.Test

class ShowClassTests extends DottyTest {

def debug_println(msg: => Any) = {
if (!sys.props.isDefinedAt("dotty.travis.build"))
println(msg)
}

private val blackList = List(
// the following classes cannot be read correctly because they
// contain illegally pickled @throws annotations
Expand Down Expand Up @@ -44,12 +49,12 @@ class ShowClassTests extends DottyTest {
def showPackage(pkg: TermSymbol)(implicit ctx: Context): Unit = {
val path = pkg.fullName.toString
if (blackList contains path)
println(s"blacklisted package: $path")
debug_println(s"blacklisted package: $path")
else {
for (
sym <- pkg.info.decls if sym.owner == pkg.moduleClass && !(sym.name contains '$')
) {
println(s"showing $sym in ${pkg.fullName}")
debug_println(s"showing $sym in ${pkg.fullName}")
if (sym is PackageVal) showPackage(sym.asTerm)
else if (sym.isClass && !(sym is Module)) showClass(sym)
else if (sym is ModuleVal) showClass(sym.moduleClass)
Expand All @@ -60,25 +65,25 @@ class ShowClassTests extends DottyTest {
def showPackage(path: String, expectedStubs: Int)(implicit ctx: Context): Unit = doTwice { implicit ctx =>
showPackage(ctx.requiredPackage(path))
val nstubs = Symbols.stubs.length
println(s"$nstubs stubs")
debug_println(s"$nstubs stubs")
assert(nstubs <= expectedStubs, s"stubs found $nstubs, expected: $expectedStubs")
}

def showClass(cls: Symbol)(implicit ctx: Context) = {
val path = cls.fullName.stripModuleClassSuffix.toString
if (blackList contains path)
println(s"blacklisted: $path")
debug_println(s"blacklisted: $path")
else {
println(s"showing $path -> ${cls.denot}")
debug_println(s"showing $path -> ${cls.denot}")
val cinfo = cls.info
val infoStr = if (cinfo.exists) cinfo.show else " is missing"
println("======================================")
println(cls.show + infoStr)
debug_println("======================================")
debug_println(cls.show + infoStr)
}
}

def showClasses(path: String)(implicit ctx: Context): Unit = doTwice { implicit ctx =>
println(s"showing file $path")
debug_println(s"showing file $path")
val cls = ctx.requiredClass(path.toTypeName)
showClass(cls)
showClass(cls.linkedClass)
Expand Down

0 comments on commit 1384048

Please sign in to comment.