From 1384048d0c01b5071ccc68e57fe49e802ed7c61b Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Sun, 16 Feb 2014 02:45:52 +0100 Subject: [PATCH] Add Scalac scanning to the Travis CI build And silence some of the error messages we print so the build log doesn't go above 4MB (Travis' limit) --- .travis.yml | 6 +++++- project/Build.scala | 11 ++++++++++- test/test/ShowClassTests.scala | 21 +++++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25d453828570..0e31b0dbe089 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: scala script: - - sbt update compile test + - sbt -Ddotty.travis.build=yes update compile test jdk: - oraclejdk7 notifications: @@ -9,3 +9,7 @@ notifications: branches: only: - master +before_install: + - cd .. + - git clone https://github.com/scala/scala.git + - cd dotty diff --git a/project/Build.scala b/project/Build.scala index a82fc3484b7b..e268a54ee4ab 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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", @@ -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 } ) diff --git a/test/test/ShowClassTests.scala b/test/test/ShowClassTests.scala index 1ed97a3dff8c..f683b26e7621 100644 --- a/test/test/ShowClassTests.scala +++ b/test/test/ShowClassTests.scala @@ -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 @@ -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) @@ -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)