Skip to content

Commit 1384048

Browse files
committed
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)
1 parent 153146c commit 1384048

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: scala
22
script:
3-
- sbt update compile test
3+
- sbt -Ddotty.travis.build=yes update compile test
44
jdk:
55
- oraclejdk7
66
notifications:
@@ -9,3 +9,7 @@ notifications:
99
branches:
1010
only:
1111
- master
12+
before_install:
13+
- cd ..
14+
- git clone https://github.com/scala/scala.git
15+
- cd dotty

project/Build.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Process._
44

55
object DottyBuild extends Build {
66

7+
val TRAVIS_BUILD = "dotty.travis.build"
8+
79
val defaults = Defaults.defaultSettings ++ Seq(
810
// set sources to src/, tests to test/ and resources to resources/
911
scalaSource in Compile := baseDirectory.value / "src",
@@ -45,7 +47,14 @@ object DottyBuild extends Build {
4547
// dotty itself needs to be in the bootclasspath
4648
val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList
4749
// System.err.println("BOOTPATH: " + fullpath)
48-
fullpath
50+
51+
val travis_build = // propagate if this is a travis build
52+
if (sys.props.isDefinedAt(TRAVIS_BUILD))
53+
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}")
54+
else
55+
List()
56+
57+
travis_build ::: fullpath
4958
}
5059
)
5160

test/test/ShowClassTests.scala

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import org.junit.Test
1212

1313
class ShowClassTests extends DottyTest {
1414

15+
def debug_println(msg: => Any) = {
16+
if (!sys.props.isDefinedAt("dotty.travis.build"))
17+
println(msg)
18+
}
19+
1520
private val blackList = List(
1621
// the following classes cannot be read correctly because they
1722
// contain illegally pickled @throws annotations
@@ -44,12 +49,12 @@ class ShowClassTests extends DottyTest {
4449
def showPackage(pkg: TermSymbol)(implicit ctx: Context): Unit = {
4550
val path = pkg.fullName.toString
4651
if (blackList contains path)
47-
println(s"blacklisted package: $path")
52+
debug_println(s"blacklisted package: $path")
4853
else {
4954
for (
5055
sym <- pkg.info.decls if sym.owner == pkg.moduleClass && !(sym.name contains '$')
5156
) {
52-
println(s"showing $sym in ${pkg.fullName}")
57+
debug_println(s"showing $sym in ${pkg.fullName}")
5358
if (sym is PackageVal) showPackage(sym.asTerm)
5459
else if (sym.isClass && !(sym is Module)) showClass(sym)
5560
else if (sym is ModuleVal) showClass(sym.moduleClass)
@@ -60,25 +65,25 @@ class ShowClassTests extends DottyTest {
6065
def showPackage(path: String, expectedStubs: Int)(implicit ctx: Context): Unit = doTwice { implicit ctx =>
6166
showPackage(ctx.requiredPackage(path))
6267
val nstubs = Symbols.stubs.length
63-
println(s"$nstubs stubs")
68+
debug_println(s"$nstubs stubs")
6469
assert(nstubs <= expectedStubs, s"stubs found $nstubs, expected: $expectedStubs")
6570
}
6671

6772
def showClass(cls: Symbol)(implicit ctx: Context) = {
6873
val path = cls.fullName.stripModuleClassSuffix.toString
6974
if (blackList contains path)
70-
println(s"blacklisted: $path")
75+
debug_println(s"blacklisted: $path")
7176
else {
72-
println(s"showing $path -> ${cls.denot}")
77+
debug_println(s"showing $path -> ${cls.denot}")
7378
val cinfo = cls.info
7479
val infoStr = if (cinfo.exists) cinfo.show else " is missing"
75-
println("======================================")
76-
println(cls.show + infoStr)
80+
debug_println("======================================")
81+
debug_println(cls.show + infoStr)
7782
}
7883
}
7984

8085
def showClasses(path: String)(implicit ctx: Context): Unit = doTwice { implicit ctx =>
81-
println(s"showing file $path")
86+
debug_println(s"showing file $path")
8287
val cls = ctx.requiredClass(path.toTypeName)
8388
showClass(cls)
8489
showClass(cls.linkedClass)

0 commit comments

Comments
 (0)