Skip to content

gergelyfabian/bazel-scala-example

 
 

Repository files navigation

A minimal example of using bazel to build scala, with a library, binary, and tests.

bazel test example-lib:test
bazel run example-bin

Code coverage:

# Install lcov once for your local package manager:
sudo apt install lcov

# Run tests with coverage:
bazel coverage \
  --combined_report=lcov \
  --coverage_report_generator="@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main" \
  //...

# Analyse results with lcov:
lcov --list bazel-out/k8-fastbuild/testlogs/example-lib/test/coverage.dat
lcov --list bazel-out/k8-fastbuild/testlogs/example-maven/test/coverage.dat

# You can also use tools/coverage.sh to generate an HTML report (already includes running coverage):
tools/coverage.sh

Also includes an example of using https://github.com/bazelbuild/rules_jvm_external to use transitive maven dependencies.

bazel build example-maven

See the rules_jvm_external README for info on how to use the dependencies.

You may want to regenerate the maven-install.json after changing depedencies with:

bazel run @unpinned_maven//:pin

About

A minimal example of using bazel to build scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Starlark 76.6%
  • Java 12.3%
  • Shell 5.7%
  • Scala 5.4%