scalabazelscala-version-cross-build

Cross-building Scala libraries


I would like to cross-build some of my Bazel targets to Scala 2.12 and 2.13. As a further point of complexity, I need to be able to express cross-target dependencies (eg. some 2.13 target may have a Bazel dependency on a 2.12 target).

Note: this isn't a regular library dependency (eg. with the dependency 2.12-built JAR showing up on the class path when compiling the 2.13 JAR), as that would almost surely result in issues due to having two incompatible versions of the Scala standard library on the class path. Rather, this is just a case where I need the dependency JAR built so I can use it in some integration tests in the 2.13 target.

What I've found online so far...


Solution

  • Wrote a blog post cross build anything with Bazel using Scala cross building as example in both traditional WORKSPACE way and the new MODULE.bazel way.

    See https://github.com/eed3si9n/gigahorse/pull/85 for a working example.