Skip to content

Add Scalac scanning to the Travis CI build #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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