diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-05-31 15:23:04 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-06-07 17:10:36 +0200 |
commit | 09b2f39731386cd5b3688d5c3badf75d956d4f6d (patch) | |
tree | d122fc0e96d6c1cd22d7e0d0b5ee523563d534e7 /bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt | |
parent | 030ff82070197f0c126f5c0287e076b0f6b6dd8d (diff) | |
download | dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.tar.gz dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.tar.bz2 dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.zip |
Make the dotty-bridge sbt project a subproject of dotty
Note that the dotty-bridge tests will not be run automatically by `test`
which is short for `dotty/test`, to run the dotty-bridge tests, do in sbt:
> dotty-bridge/test
> dotty-bridge/scripted
Original history: https://github.com/smarter/dotty-bridge/commits/master
Diffstat (limited to 'bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt')
-rw-r--r-- | bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt b/bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt new file mode 100644 index 000000000..d24e304b1 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt @@ -0,0 +1,40 @@ +logLevel := Level.Debug + +incOptions := incOptions.value.withNameHashing(true) + +// disable sbt's heauristic which recompiles everything in case +// some fraction (e.g. 50%) of files is scheduled to be recompiled +// in this test we want precise information about recompiled files +// which that heuristic would distort +incOptions := incOptions.value.copy(recompileAllFraction = 1.0) + +/* Performs checks related to compilations: + * a) checks in which compilation given set of files was recompiled + * b) checks overall number of compilations performed + */ +TaskKey[Unit]("check-compilations") := { + val analysis = (compile in Compile).value + val srcDir = (scalaSource in Compile).value + def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f + val allCompilations = analysis.compilations.allCompilations + val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c => + val recompiledFiles = analysis.apis.internal.collect { + case (file, api) if api.compilation.startTime == c.startTime => relative(file) + } + recompiledFiles.toSet + } + def recompiledFilesInIteration(iteration: Int, fileNames: Set[String]) = { + val files = fileNames.map(new java.io.File(_)) + assert(recompiledFiles(iteration) == files, "%s != %s".format(recompiledFiles(iteration), files)) + } + // Y.scala is compiled only at the beginning as changes to A.scala do not affect it + recompiledFilesInIteration(0, Set("X.scala", "Y.scala")) + // A.scala is changed and recompiled + recompiledFilesInIteration(1, Set("A.scala")) + // change in A.scala causes recompilation of B.scala, C.scala, D.scala which depend on transtiviely + // and by inheritance on A.scala + // X.scala is also recompiled because it depends by member reference on B.scala + // Note that Y.scala is not recompiled because it depends just on X through member reference dependency + recompiledFilesInIteration(2, Set("B.scala", "C.scala", "D.scala")) + assert(allCompilations.size == 3) +} |