facebook / facebook/buck2

Can configs and constraints be restricted to targets selectively?

Open
#385 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

We have an audio processing library internally, and this audio library only supports windows and mac. If building on Linux, the audio library should not be present. We'd like to represent this with a `target_compatible_with`, but the semantics of that are an AND, not an OR (in other words, we can't say `target_compatible_with = linux | windows`.

At the same time, I don't know how to selectively attach a set of constraint_values, or config_settings, to a target. I can stick them on the platform object when creating the top-level `ExecutionPlatformInfo`, but this is global to all targets.

A transition rule seems like it will work, however [the documentation](https://buck2.build/docs/rule_authors/configuration_transitions/#per-attribute-transition) states that when dependencies are resolved, they are resolved with the transformed configuration. This would suggest that if I have A and B where B depends on A, and I apply the transition rule to B, then A will be built with the transformed configuration. This isn't what I want though, I want only B to have the transformed configuration because otherwise A will have configuration info that isn't relevant and is polluting the configuration hash.

Is this possible?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.