simplify and remove failures from --noproto_profile while path specified
Clients should be able to just append `--noproto_profile` to opt out
of this feature without additional friction.
PiperOrigin-RevId: 819786164
Change-Id: Id9d639ead105139dfe8f5a3012d417bee7a9ca45
diff --git a/cc/private/rules_impl/fdo/fdo_context.bzl b/cc/private/rules_impl/fdo/fdo_context.bzl
index c997bb6..38389cb 100644
--- a/cc/private/rules_impl/fdo/fdo_context.bzl
+++ b/cc/private/rules_impl/fdo/fdo_context.bzl
@@ -140,17 +140,16 @@
# If AutoFDO is in effect, a file called proto.profile next to the AutoFDO
# profile is used, if it exists.
proto_profile_artifact = None
- if not cpp_config.proto_profile() and _proto_profile:
- fail("--proto_profile_path cannot be set if --proto_profile is false")
- if _proto_profile:
- proto_profile_artifact = _symlink_to(
- ctx,
- name_prefix = "fdo",
- artifact = _proto_profile,
- progress_message = "Symlinking protobuf profile %{input}",
- )
- elif cpp_config.proto_profile():
- proto_profile_artifact = getattr(fdo_inputs, "proto_profile_artifact", None)
+ if cpp_config.proto_profile():
+ if _proto_profile:
+ proto_profile_artifact = _symlink_to(
+ ctx,
+ name_prefix = "fdo",
+ artifact = _proto_profile,
+ progress_message = "Symlinking protobuf profile %{input}",
+ )
+ else:
+ proto_profile_artifact = getattr(fdo_inputs, "proto_profile_artifact", None)
branch_fdo_profile = None
if fdo_inputs: