Interim fix for #3583, for 1.0.3

In 0.13.x, zinc would discover only top-level objects and classes
containing tests to the test framework. In 1.x, however, zinc can
discover also nested objects and classes; that causes the "name"
of a ClassLike to no longer be usable for reflection.

This change filters out nested objects/classes from the list,
restoring compatibility with 0.13. A zinc extension of ClassLike
will probably be introduced in 1.1 or 1.2, in order to provide
the test framework with enough information to deal with nested
classes.

This patch unblocks https://github.com/sbt/sbt-standalone-build/issues/15
This commit is contained in:
Antonio Cunei 2017-10-26 00:30:03 +02:00
parent 4c3cf6bfe7
commit 53ea3596ec
1 changed files with 5 additions and 1 deletions

View File

@ -385,7 +385,11 @@ object Tests {
defined(subclasses, d.baseClasses, d.isModule) ++
defined(annotations, d.annotations, d.isModule)
val discovered = Discovery(firsts(subclasses), firsts(annotations))(definitions)
val discovered = Discovery(firsts(subclasses), firsts(annotations))(definitions.filter {
case c: ClassLike =>
c.topLevel
case _ => false
})
// TODO: To pass in correct explicitlySpecified and selectors
val tests = for ((df, di) <- discovered; fingerprint <- toFingerprints(di))
yield new TestDefinition(df.name, fingerprint, false, Array(new SuiteSelector))