rules_scala
rules_scala copied to clipboard
Update test scripts for Bzlmod compatibility
Description
These are mostly small changes to make test assertions more flexible between WORKSPACE and Bzlmod runs.
For Bzlmod runs:
-
Fixed
test_scala_config_contentfromtest_scala_config.shby changing a path fromexternal/io_bazel_rules_scala_configtoexternal/*io_bazel_rules_scala_config. -
Fixed a number of tests by updating expected output messages to allow them to start with either
@//or@@//. -
Fixed
test_stamped_target_label_loadingfromtest/shell/test_strict_dependency.shby accommodating the canonicalio_bazel_rules_scala_guavarepo name. Also allows for the optional current Scala version suffix.
Also made these other important changes:
-
Updated all the assertions in
test_helper.shto use Bash builtin regex matching via_expect_failure_with_messagesinstead ofgrep. This allows the expected message patterns to use full regular expressions while avoiding forking a new process. This new function helped reduce duplication in that file at the same time. -
Added
--repo_env="SCALA_VERSION=..."to each test script called from./test_coverage.sh, and setSCALA_VERSIONto 2.12.19 in each of these files. Using other Scala versions technically works, but the output is slightly different, causing thediffcommands in the test cases to fail. -
Updated
test_version.shto copy the top level.bazelversionfile into its test repo. -
Changed how
test_version.shhandles injectingtwitter_scroogerepos into theWORKSPACEfile. This will make it easy to do the equivalent forMODULE.bazelwhen the time comes.
Also includes a few minor, opportunistic formatting cleanups.
Motivation
Part of adding Bzlmod support per #1482.
I'm breaking this out to make sure the current default build configuration continues to pass as I carve off more of my fork's Bzlmod working branch. At the same time, the later changes can land without including so many test changes.
cc: @BillyAutrey @jayconrod @benjaminp @TheGrizzlyDev