bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
363 stars 278 forks source link

Fix Bazel 7 related protobuf build failures #1620

Closed mbland closed 1 month ago

mbland commented 1 month ago

Description

Fixes protobuf related build failures under Bazel 7, while remaining compatible with Bazel 6.

Related to #1482, #1618, and #1619. Results from the investigation documented at:

Updates _import_paths() in scala_proto_aspect.bzl to handle differences ProtoInfo.proto_source_root and ProtoInfo.direct_sources values between Bazel 6 and Bazel 7.

Without this change, _import_paths() emits incorrect values under Bazel 7, causing targets containing generated .proto inputs to fail, e.g. //test/proto3:test_generated_proto.

See also:

Motivation

This helps unblock the resolution of #1482 to add Bzlmod support, by removing an obstacle to updating to Bazel 7. I decided not to include this in #1619 to give this subtle, substantial issue the focused attention it deserves. Either PR can go in first, but both must go in before updating to Bazel 7.

cc: @BillyAutrey @jayconrod @benjaminp @TheGrizzlyDev