scoverage / sbt-scoverage

sbt plugin for scoverage
Apache License 2.0
645 stars 155 forks source link

coverageAggregate does not working properly with Cross-building #315

Open angelcervera opened 3 years ago

angelcervera commented 3 years ago

coverageAggregate ignores cross-building versions.

This code does not aggregate reports:

$ sbt clean "++2.13.3 test"
$ find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./module2/target/scala-2.13/scoverage-data/scoverage.coverage
./core/target/scala-2.13/scoverage-data/scoverage.coverage
./module1/target/scala-2.13/scoverage-data/scoverage.coverage
$ # Next is not working
$ sbt "++2.13.3 coverageAggregate"
 find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./module2/target/scala-2.13/coverage-report/cobertura.xml
./module2/target/scala-2.13/scoverage-data/scoverage.coverage
./core/target/scala-2.13/coverage-report/cobertura.xml
./core/target/scala-2.13/scoverage-data/scoverage.coverage
./module1/target/scala-2.13/coverage-report/cobertura.xml
./module1/target/scala-2.13/scoverage-data/scoverage.coverage
$ # Neither next ...
$ sbt coverageAggregate
 find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./module2/target/scala-2.13/coverage-report/cobertura.xml
./module2/target/scala-2.13/scoverage-data/scoverage.coverage
./core/target/scala-2.13/coverage-report/cobertura.xml
./core/target/scala-2.13/scoverage-data/scoverage.coverage
./module1/target/scala-2.13/coverage-report/cobertura.xml
./module1/target/scala-2.13/scoverage-data/scoverage.coverage

I expected reports aggregated at ./target/scala-2.13/coverage-report/cobertura.xml

Using the default scala version, it works only if the Scala version is not specified.:

$ sbt clean "++2.12.2 test"
$ find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./moduleOnly212/target/scala-2.12/scoverage-data/scoverage.coverage
./module2/target/scala-2.12/scoverage-data/scoverage.coverage
./core/target/scala-2.12/scoverage-data/scoverage.coverage
./module1/target/scala-2.12/scoverage-data/scoverage.coverage
$ # Next is not working
$ sbt "++2.12.2 coverageAggregate"
$ find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./moduleOnly212/target/scala-2.12/coverage-report/cobertura.xml
./moduleOnly212/target/scala-2.12/scoverage-data/scoverage.coverage
./module2/target/scala-2.12/coverage-report/cobertura.xml
./module2/target/scala-2.12/scoverage-data/scoverage.coverage
./core/target/scala-2.12/coverage-report/cobertura.xml
./core/target/scala-2.12/scoverage-data/scoverage.coverage
./module1/target/scala-2.12/coverage-report/cobertura.xml
./module1/target/scala-2.12/scoverage-data/scoverage.coverage
$ # But excluding the version and using the default one, works:
$ sbt coverageAggregate
$ find . -type f \( -name scoverage.coverage -o -name cobertura.xml \)
./moduleOnly212/target/scala-2.12/coverage-report/cobertura.xml
./moduleOnly212/target/scala-2.12/scoverage-data/scoverage.coverage
./module2/target/scala-2.12/coverage-report/cobertura.xml
./module2/target/scala-2.12/scoverage-data/scoverage.coverage
./target/scala-2.12/coverage-report/cobertura.xml
./core/target/scala-2.12/coverage-report/cobertura.xml
./core/target/scala-2.12/scoverage-data/scoverage.coverage
./module1/target/scala-2.12/coverage-report/cobertura.xml
./module1/target/scala-2.12/scoverage-data/scoverage.coverage

Versions: sbt 1.3.13 sbt-scoverage 1.6.1

The full example at https://github.com/angelcervera/sbt-multimodule-template

arvkonstantin commented 7 months ago

+1